Module Name:    src
Committed By:   christos
Date:           Tue Sep 15 15:49:03 UTC 2015

Modified Files:
        src/sys/arch/aarch64/include: ptrace.h
        src/sys/arch/alpha/include: ptrace.h
        src/sys/arch/amd64/include: ptrace.h
        src/sys/arch/arm/include: ptrace.h
        src/sys/arch/hppa/include: ptrace.h
        src/sys/arch/i386/include: ptrace.h
        src/sys/arch/ia64/include: ptrace.h
        src/sys/arch/m68k/include: ptrace.h
        src/sys/arch/mips/include: ptrace.h
        src/sys/arch/or1k/include: ptrace.h
        src/sys/arch/powerpc/include: ptrace.h
        src/sys/arch/riscv/include: ptrace.h
        src/sys/arch/sh3/include: ptrace.h
        src/sys/arch/sparc/include: ptrace.h
        src/sys/arch/vax/include: ptrace.h

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


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/aarch64/include/ptrace.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/include/ptrace.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amd64/include/ptrace.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/include/ptrace.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/include/ptrace.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/include/ptrace.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/ia64/include/ptrace.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/m68k/include/ptrace.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mips/include/ptrace.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/or1k/include/ptrace.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/include/ptrace.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/include/ptrace.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sh3/include/ptrace.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc/include/ptrace.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/vax/include/ptrace.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/aarch64/include/ptrace.h
diff -u src/sys/arch/aarch64/include/ptrace.h:1.2 src/sys/arch/aarch64/include/ptrace.h:1.3
--- src/sys/arch/aarch64/include/ptrace.h:1.2	Mon Aug 11 18:09:08 2014
+++ src/sys/arch/aarch64/include/ptrace.h	Tue Sep 15 11:49:02 2015
@@ -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>

Index: src/sys/arch/alpha/include/ptrace.h
diff -u src/sys/arch/alpha/include/ptrace.h:1.6 src/sys/arch/alpha/include/ptrace.h:1.7
--- src/sys/arch/alpha/include/ptrace.h:1.6	Fri Jan 25 07:03:36 2008
+++ src/sys/arch/alpha/include/ptrace.h	Tue Sep 15 11:49:02 2015
@@ -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]

Index: src/sys/arch/amd64/include/ptrace.h
diff -u src/sys/arch/amd64/include/ptrace.h:1.3 src/sys/arch/amd64/include/ptrace.h:1.4
--- src/sys/arch/amd64/include/ptrace.h:1.3	Mon Apr 16 08:22:26 2007
+++ src/sys/arch/amd64/include/ptrace.h	Tue Sep 15 11:49:02 2015
@@ -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"
 

Index: src/sys/arch/arm/include/ptrace.h
diff -u src/sys/arch/arm/include/ptrace.h:1.6 src/sys/arch/arm/include/ptrace.h:1.7
--- src/sys/arch/arm/include/ptrace.h:1.6	Wed Dec  5 14:05:46 2012
+++ src/sys/arch/arm/include/ptrace.h	Tue Sep 15 11:49:02 2015
@@ -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]

Index: src/sys/arch/hppa/include/ptrace.h
diff -u src/sys/arch/hppa/include/ptrace.h:1.3 src/sys/arch/hppa/include/ptrace.h:1.4
--- src/sys/arch/hppa/include/ptrace.h:1.3	Tue Nov  3 00:07:26 2009
+++ src/sys/arch/hppa/include/ptrace.h	Tue Sep 15 11:49:02 2015
@@ -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]

Index: src/sys/arch/i386/include/ptrace.h
diff -u src/sys/arch/i386/include/ptrace.h:1.13 src/sys/arch/i386/include/ptrace.h:1.14
--- src/sys/arch/i386/include/ptrace.h:1.13	Sun Mar  5 02:17:21 2006
+++ src/sys/arch/i386/include/ptrace.h	Tue Sep 15 11:49:02 2015
@@ -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
 
 /*

Index: src/sys/arch/ia64/include/ptrace.h
diff -u src/sys/arch/ia64/include/ptrace.h:1.2 src/sys/arch/ia64/include/ptrace.h:1.3
--- src/sys/arch/ia64/include/ptrace.h:1.2	Fri Jan 25 07:03:36 2008
+++ src/sys/arch/ia64/include/ptrace.h	Tue Sep 15 11:49:02 2015
@@ -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

Index: src/sys/arch/m68k/include/ptrace.h
diff -u src/sys/arch/m68k/include/ptrace.h:1.8 src/sys/arch/m68k/include/ptrace.h:1.9
--- src/sys/arch/m68k/include/ptrace.h:1.8	Fri Jan 25 07:03:36 2008
+++ src/sys/arch/m68k/include/ptrace.h	Tue Sep 15 11:49:02 2015
@@ -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_ */

Index: src/sys/arch/mips/include/ptrace.h
diff -u src/sys/arch/mips/include/ptrace.h:1.12 src/sys/arch/mips/include/ptrace.h:1.13
--- src/sys/arch/mips/include/ptrace.h:1.12	Fri Jan 25 07:03:36 2008
+++ src/sys/arch/mips/include/ptrace.h	Tue Sep 15 11:49:02 2015
@@ -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
  */

Index: src/sys/arch/or1k/include/ptrace.h
diff -u src/sys/arch/or1k/include/ptrace.h:1.1 src/sys/arch/or1k/include/ptrace.h:1.2
--- src/sys/arch/or1k/include/ptrace.h:1.1	Wed Sep  3 15:34:26 2014
+++ src/sys/arch/or1k/include/ptrace.h	Tue Sep 15 11:49:03 2015
@@ -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_ */

Index: src/sys/arch/powerpc/include/ptrace.h
diff -u src/sys/arch/powerpc/include/ptrace.h:1.11 src/sys/arch/powerpc/include/ptrace.h:1.12
--- src/sys/arch/powerpc/include/ptrace.h:1.11	Mon Jan 17 20:02:54 2011
+++ src/sys/arch/powerpc/include/ptrace.h	Tue Sep 15 11:49:03 2015
@@ -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"

Index: src/sys/arch/riscv/include/ptrace.h
diff -u src/sys/arch/riscv/include/ptrace.h:1.1 src/sys/arch/riscv/include/ptrace.h:1.2
--- src/sys/arch/riscv/include/ptrace.h:1.1	Fri Sep 19 13:36:26 2014
+++ src/sys/arch/riscv/include/ptrace.h	Tue Sep 15 11:49:03 2015
@@ -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_ */

Index: src/sys/arch/sh3/include/ptrace.h
diff -u src/sys/arch/sh3/include/ptrace.h:1.10 src/sys/arch/sh3/include/ptrace.h:1.11
--- src/sys/arch/sh3/include/ptrace.h:1.10	Mon Oct 31 15:08:45 2011
+++ src/sys/arch/sh3/include/ptrace.h	Tue Sep 15 11:49:03 2015
@@ -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

Index: src/sys/arch/sparc/include/ptrace.h
diff -u src/sys/arch/sparc/include/ptrace.h:1.7 src/sys/arch/sparc/include/ptrace.h:1.8
--- src/sys/arch/sparc/include/ptrace.h:1.7	Fri Jan 25 07:03:37 2008
+++ src/sys/arch/sparc/include/ptrace.h	Tue Sep 15 11:49:03 2015
@@ -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]

Index: src/sys/arch/vax/include/ptrace.h
diff -u src/sys/arch/vax/include/ptrace.h:1.4 src/sys/arch/vax/include/ptrace.h:1.5
--- src/sys/arch/vax/include/ptrace.h:1.4	Fri Jan 25 07:03:37 2008
+++ src/sys/arch/vax/include/ptrace.h	Tue Sep 15 11:49:03 2015
@@ -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 $	*/
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -41,3 +41,10 @@
 	"PT_STEP", \
 	"PT_GETREGS", \
 	"PT_SETREGS",
+
+#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)->sp
+#define PTRACE_REG_INTRV(r)	(r)->r0

Reply via email to