Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Provide access to pc/sp/syscall-return registers li...



details:   https://anonhg.NetBSD.org/src/rev/eb4497c49f84
branches:  trunk
changeset: 810737:eb4497c49f84
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Sep 15 15:49:02 2015 +0000

description:
Provide access to pc/sp/syscall-return registers like we have for mcontext

diffstat:

 sys/arch/aarch64/include/ptrace.h |   9 ++++++++-
 sys/arch/alpha/include/ptrace.h   |   8 +++++++-
 sys/arch/amd64/include/ptrace.h   |   8 +++++++-
 sys/arch/arm/include/ptrace.h     |   8 +++++++-
 sys/arch/hppa/include/ptrace.h    |  11 ++++++++++-
 sys/arch/i386/include/ptrace.h    |   8 +++++++-
 sys/arch/ia64/include/ptrace.h    |  10 +++++++++-
 sys/arch/m68k/include/ptrace.h    |   8 +++++++-
 sys/arch/mips/include/ptrace.h    |   7 ++++++-
 sys/arch/or1k/include/ptrace.h    |   8 +++++++-
 sys/arch/powerpc/include/ptrace.h |   8 +++++++-
 sys/arch/riscv/include/ptrace.h   |   8 +++++++-
 sys/arch/sh3/include/ptrace.h     |   7 ++++++-
 sys/arch/sparc/include/ptrace.h   |  11 ++++++++++-
 sys/arch/vax/include/ptrace.h     |   9 ++++++++-
 15 files changed, 113 insertions(+), 15 deletions(-)

diffs (truncated from 314 to 300 lines):

diff -r 781856a06aa3 -r eb4497c49f84 sys/arch/aarch64/include/ptrace.h
--- a/sys/arch/aarch64/include/ptrace.h Tue Sep 15 15:09:10 2015 +0000
+++ b/sys/arch/aarch64/include/ptrace.h Tue Sep 15 15:49:02 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ptrace.h,v 1.2 2014/08/11 22:09:08 matt Exp $ */
+/* $NetBSD: ptrace.h,v 1.3 2015/09/15 15:49:02 christos Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -49,6 +49,13 @@
        "PT_GETFPREGS", \
        "PT_SETFPREGS",
 
+
+#include <machine/reg.h>
+#define PTRACE_REG_PC(r)       (r)->r_pc
+#define PTRACE_REG_SET_PC(r, v)        (r)->r_pc = (v)
+#define PTRACE_REG_SP(r)       (r)->r_sp
+#define PTRACE_REG_INTRV(r)    (r)->r_reg[0]
+
 #elif defined(__arm__)
 
 #include <arm/ptrace.h>
diff -r 781856a06aa3 -r eb4497c49f84 sys/arch/alpha/include/ptrace.h
--- a/sys/arch/alpha/include/ptrace.h   Tue Sep 15 15:09:10 2015 +0000
+++ b/sys/arch/alpha/include/ptrace.h   Tue Sep 15 15:49:02 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ptrace.h,v 1.6 2008/01/25 12:03:36 skrll Exp $ */
+/* $NetBSD: ptrace.h,v 1.7 2015/09/15 15:49:02 christos Exp $ */
 
 /*
  * Copyright (c) 1994 Christopher G. Demetriou
@@ -44,3 +44,9 @@
        "PT_SETREGS", \
        "PT_GETFPREGS", \
        "PT_SETFPREGS",
+
+#include <machine/reg.h>
+#define PTRACE_REG_PC(r)       (r)->r_regs[R_ZERO]
+#define PTRACE_REG_SET_PC(r, v)        (r)->r_regs[R_ZERO] = (v)
+#define PTRACE_REG_SP(r)       (r)->r_regs[R_SP]
+#define PTRACE_REG_INTRV(r)    (r)->r_regs[R_V0]
diff -r 781856a06aa3 -r eb4497c49f84 sys/arch/amd64/include/ptrace.h
--- a/sys/arch/amd64/include/ptrace.h   Tue Sep 15 15:09:10 2015 +0000
+++ b/sys/arch/amd64/include/ptrace.h   Tue Sep 15 15:49:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptrace.h,v 1.3 2007/04/16 12:22:26 njoly Exp $ */
+/*     $NetBSD: ptrace.h,v 1.4 2015/09/15 15:49:02 christos Exp $      */
 
 /*
  * Copyright (c) 1993 Christopher G. Demetriou
@@ -46,6 +46,12 @@
        "PT_GETFPREGS", \
        "PT_SETFPREGS",
 
+#include <machine/reg.h>
+#define PTRACE_REG_PC(r)       (r)->regs[_REG_RIP]
+#define PTRACE_REG_SET_PC(r, v)        (r)->regs[_REG_RIP] = (v)
+#define PTRACE_REG_SP(r)       (r)->regs[_REG_RSP]
+#define PTRACE_REG_INTRV(r)    (r)->regs[_REG_RAX]
+
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd32.h"
 
diff -r 781856a06aa3 -r eb4497c49f84 sys/arch/arm/include/ptrace.h
--- a/sys/arch/arm/include/ptrace.h     Tue Sep 15 15:09:10 2015 +0000
+++ b/sys/arch/arm/include/ptrace.h     Tue Sep 15 15:49:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptrace.h,v 1.6 2012/12/05 19:05:46 matt Exp $  */
+/*     $NetBSD: ptrace.h,v 1.7 2015/09/15 15:49:02 christos Exp $      */
 
 /*
  * Copyright (c) 1995 Frank Lancaster
@@ -51,3 +51,9 @@
        "old PT_SETFPREGS", \
        "PT_GETFPREGS", \
        "PT_SETFPREGS",
+
+#include <machine/reg.h>
+#define PTRACE_REG_PC(r)       (r)->r_pc
+#define PTRACE_REG_SET_PC(r, v)        (r)->r_pc = (v)
+#define PTRACE_REG_SP(r)       (r)->r_sp
+#define PTRACE_REG_INTRV(r)    (r)->r[0]
diff -r 781856a06aa3 -r eb4497c49f84 sys/arch/hppa/include/ptrace.h
--- a/sys/arch/hppa/include/ptrace.h    Tue Sep 15 15:09:10 2015 +0000
+++ b/sys/arch/hppa/include/ptrace.h    Tue Sep 15 15:49:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptrace.h,v 1.3 2009/11/03 05:07:26 snj Exp $   */
+/*     $NetBSD: ptrace.h,v 1.4 2015/09/15 15:49:02 christos Exp $      */
 
 /*     $OpenBSD: ptrace.h,v 1.2 1998/12/01 03:05:44 mickey Exp $       */
 
@@ -43,3 +43,12 @@
        "PT_SETREGS", \
        "PT_GETFPREGS", \
        "PT_SETFPREGS",
+
+#include <machine/reg.h>
+#define PTRACE_REG_PC(r)       (r)->r_pcoqh
+#define PTRACE_REG_SET_PC(r, v)        do {    \
+       (r)->r_pcoqh = (v);             \
+       (r)->r_pcoqt = (v) + 4;         \
+    } while (/*CONSTCOND*/0)
+#define PTRACE_REG_SP(r)       (r)->r_out[30]
+#define PTRACE_REG_INTRV(r)    (r)->r_out[28]
diff -r 781856a06aa3 -r eb4497c49f84 sys/arch/i386/include/ptrace.h
--- a/sys/arch/i386/include/ptrace.h    Tue Sep 15 15:09:10 2015 +0000
+++ b/sys/arch/i386/include/ptrace.h    Tue Sep 15 15:49:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptrace.h,v 1.13 2006/03/05 07:17:21 christos Exp $     */
+/*     $NetBSD: ptrace.h,v 1.14 2015/09/15 15:49:02 christos Exp $     */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -96,6 +96,12 @@
        "PT_GETXMMREGS", \
        "PT_SETXMMREGS",
 
+#include <machine/reg.h>
+#define PTRACE_REG_PC(r)       (r)->r_eip
+#define PTRACE_REG_SET_PC(r, v)        (r)->r_eip = (v)
+#define PTRACE_REG_SP(r)       (r)->r_esp
+#define PTRACE_REG_INTRV(r)    (r)->r_eax
+
 #ifdef _KERNEL
 
 /*
diff -r 781856a06aa3 -r eb4497c49f84 sys/arch/ia64/include/ptrace.h
--- a/sys/arch/ia64/include/ptrace.h    Tue Sep 15 15:09:10 2015 +0000
+++ b/sys/arch/ia64/include/ptrace.h    Tue Sep 15 15:49:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptrace.h,v 1.2 2008/01/25 12:03:36 skrll Exp $ */
+/*     $NetBSD: ptrace.h,v 1.3 2015/09/15 15:49:02 christos Exp $      */
 
 /*
  * Copyright (c) 1994 Christopher G. Demetriou
@@ -45,3 +45,11 @@
        "PT_SETREGS", \
        "PT_GETFPREGS", \
        "PT_SETFPREGS",
+
+#include <machine/reg.h>
+#define PTRACE_REG_PC(r)       (r)->r_special.iip
+#define PTRACE_REG_SET_PC(r, v)        (r)->r_special.iip = (v)
+#define PTRACE_REG_SP(r)       (r)->r_special.sp
+#ifdef notyet
+#define PTRACE_REG_INTRV(r)    (r)->r_special.!!!
+#endif
diff -r 781856a06aa3 -r eb4497c49f84 sys/arch/m68k/include/ptrace.h
--- a/sys/arch/m68k/include/ptrace.h    Tue Sep 15 15:09:10 2015 +0000
+++ b/sys/arch/m68k/include/ptrace.h    Tue Sep 15 15:49:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptrace.h,v 1.8 2008/01/25 12:03:36 skrll Exp $ */
+/*     $NetBSD: ptrace.h,v 1.9 2015/09/15 15:49:02 christos Exp $      */
 
 /*
  * Copyright (c) 1993 Christopher G. Demetriou
@@ -48,4 +48,10 @@
        "PT_GETFPREGS", \
        "PT_SETFPREGS",
 
+#include <machine/reg.h>
+#define PTRACE_REG_PC(r)       (r)->r_pc
+#define PTRACE_REG_SET_PC(r, v)        (r)->r_pc = (v)
+#define PTRACE_REG_SP(r)       (r)->r_regs[15]
+#define PTRACE_REG_INTRV(r)    (r)->r_regs[0]
+
 #endif /* !_M68K_PTRACE_H_ */
diff -r 781856a06aa3 -r eb4497c49f84 sys/arch/mips/include/ptrace.h
--- a/sys/arch/mips/include/ptrace.h    Tue Sep 15 15:09:10 2015 +0000
+++ b/sys/arch/mips/include/ptrace.h    Tue Sep 15 15:49:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptrace.h,v 1.12 2008/01/25 12:03:36 skrll Exp $        */
+/*     $NetBSD: ptrace.h,v 1.13 2015/09/15 15:49:02 christos Exp $     */
 
 /*
  * Copyright (c) 1992, 1993
@@ -53,6 +53,11 @@
        "PT_GETFPREGS", \
        "PT_SETFPREGS",
 
+#include <machine/reg.h>
+#define PTRACE_REG_PC(r)       (r)->r_regs[35]
+#define PTRACE_REG_SET_PC(r, v)        (r)->r_regs[35] = (v)
+#define PTRACE_REG_SP(r)       (r)->r_regs[29]
+#define PTRACE_REG_INTRV(r)    (r)->r_regs[2]
 /*
  * Glue for gdb: map NetBSD register names to legacy ptrace register names
  */
diff -r 781856a06aa3 -r eb4497c49f84 sys/arch/or1k/include/ptrace.h
--- a/sys/arch/or1k/include/ptrace.h    Tue Sep 15 15:09:10 2015 +0000
+++ b/sys/arch/or1k/include/ptrace.h    Tue Sep 15 15:49:02 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ptrace.h,v 1.1 2014/09/03 19:34:26 matt Exp $ */
+/* $NetBSD: ptrace.h,v 1.2 2015/09/15 15:49:03 christos Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -43,4 +43,10 @@
        "PT_GETREGS", \
        "PT_SETREGS"
 
+#include <machine/reg.h>
+#define PTRACE_REG_PC(r)       (r)->r_reg[31]  // XXX:!?!
+#define PTRACE_REG_SET_PC(r, v)        (r)->r_reg[31] = (v)
+#define PTRACE_REG_SP(r)       (r)->r_reg[11]
+#define PTRACE_REG_INTRV(r)    (r)->r_reg[0]
+
 #endif /* _OR1K_PTRACE_H_ */
diff -r 781856a06aa3 -r eb4497c49f84 sys/arch/powerpc/include/ptrace.h
--- a/sys/arch/powerpc/include/ptrace.h Tue Sep 15 15:09:10 2015 +0000
+++ b/sys/arch/powerpc/include/ptrace.h Tue Sep 15 15:49:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptrace.h,v 1.11 2011/01/18 01:02:54 matt Exp $ */
+/*     $NetBSD: ptrace.h,v 1.12 2015/09/15 15:49:03 christos Exp $     */
 
 #ifndef _POWERPC_PTRACE_H
 #define        _POWERPC_PTRACE_H
@@ -17,6 +17,12 @@
        "PT_GETFPREGS",         "PT_SETFPREGS",         \
        "PT_GETVECREGS",        "PT_SETVECREGS",
 
+#include <machine/reg.h>
+#define PTRACE_REG_PC(r)       (r)->pc
+#define PTRACE_REG_SET_PC(r, v)        (r)->pc = (v)
+#define PTRACE_REG_SP(r)       (r)->fixreg[1]
+#define PTRACE_REG_INTRV(r)    (r)->fixreg[3]
+
 #ifdef _KERNEL
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
diff -r 781856a06aa3 -r eb4497c49f84 sys/arch/riscv/include/ptrace.h
--- a/sys/arch/riscv/include/ptrace.h   Tue Sep 15 15:09:10 2015 +0000
+++ b/sys/arch/riscv/include/ptrace.h   Tue Sep 15 15:49:02 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ptrace.h,v 1.1 2014/09/19 17:36:26 matt Exp $ */
+/* $NetBSD: ptrace.h,v 1.2 2015/09/15 15:49:03 christos Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -47,4 +47,10 @@
        "PT_GETFPREGS", \
        "PT_SETFPREGS"
 
+#include <machine/reg.h>
+#define PTRACE_REG_PC(r)       (r)->r_pc
+#define PTRACE_REG_SET_PC(r, v)        (r)->r_pc = (v)
+#define PTRACE_REG_SP(r)       (r)->r_reg[1]
+#define PTRACE_REG_INTRV(r)    (r)->r_reg[9]
+
 #endif /* _RISCV_PTRACE_H_ */
diff -r 781856a06aa3 -r eb4497c49f84 sys/arch/sh3/include/ptrace.h
--- a/sys/arch/sh3/include/ptrace.h     Tue Sep 15 15:09:10 2015 +0000
+++ b/sys/arch/sh3/include/ptrace.h     Tue Sep 15 15:49:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptrace.h,v 1.10 2011/10/31 19:08:45 uwe Exp $  */
+/*     $NetBSD: ptrace.h,v 1.11 2015/09/15 15:49:03 christos Exp $     */
 
 /*
  * Copyright (c) 1993 Christopher G. Demetriou
@@ -58,6 +58,11 @@
        "PT_GETREGS", \
        "PT_SETREGS",
 
+#include <machine/reg.h>
+#define PTRACE_REG_PC(r)       r->r_spc
+#define PTRACE_REG_SET_PC(r, v)        r->r_spc = (v)
+#define PTRACE_REG_SP(r)       r->r_r15
+#define PTRACE_REG_INTV(r)     r->r_r0
 
 #ifdef _KERNEL
 #ifdef _KERNEL_OPT
diff -r 781856a06aa3 -r eb4497c49f84 sys/arch/sparc/include/ptrace.h
--- a/sys/arch/sparc/include/ptrace.h   Tue Sep 15 15:09:10 2015 +0000
+++ b/sys/arch/sparc/include/ptrace.h   Tue Sep 15 15:49:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptrace.h,v 1.7 2008/01/25 12:03:37 skrll Exp $ */
+/*     $NetBSD: ptrace.h,v 1.8 2015/09/15 15:49:03 christos Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -53,3 +53,12 @@
        "PT_SETREGS", \
        "PT_GETFPREGS", \
        "PT_SETFPREGS",
+
+#include <machine/reg.h>
+#define PTRACE_REG_PC(r)       (r)->r_pc
+#define PTRACE_REG_SET_PC(r, v)        do {    \
+       (r)->r_pc = (v);                \
+       (r)->r_npc = (v) + 4;           \
+    } while (/*CONSTCOND*/0)
+#define PTRACE_REG_SP(r)       (r)->r_out[6]
+#define PTRACE_REG_INTRV(r)    (r)->r_out[0]
diff -r 781856a06aa3 -r eb4497c49f84 sys/arch/vax/include/ptrace.h
--- a/sys/arch/vax/include/ptrace.h     Tue Sep 15 15:09:10 2015 +0000
+++ b/sys/arch/vax/include/ptrace.h     Tue Sep 15 15:49:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptrace.h,v 1.4 2008/01/25 12:03:37 skrll Exp $ */
+/*     $NetBSD: ptrace.h,v 1.5 2015/09/15 15:49:03 christos Exp $      */



Home | Main Index | Thread Index | Old Index