patch-1.3.44 linux/include/asm-sparc/ptrace.h
Next file: linux/include/asm-sparc/resource.h
Previous file: linux/include/asm-sparc/psr.h
Back to the patch index
Back to the overall index
- Lines: 183
- Date:
Sat Nov 25 04:32:34 1995
- Orig file:
v1.3.43/linux/include/asm-sparc/ptrace.h
- Orig date:
Tue Jun 27 14:11:46 1995
diff -u --recursive --new-file v1.3.43/linux/include/asm-sparc/ptrace.h linux/include/asm-sparc/ptrace.h
@@ -1,29 +1,170 @@
+/* $Id: ptrace.h,v 1.14 1995/11/25 02:32:33 davem Exp $ */
#ifndef _SPARC_PTRACE_H
#define _SPARC_PTRACE_H
-/* I have not looked enough into how this should be done. Without playing
- * lots of tricks to optimize I think we need to save the whole register
- * window frame plus the floating-point registers. We'll see...
+#include <asm/psr.h>
+
+/* This struct defines the way the registers are stored on the
+ * stack during a system call and basically all traps.
*/
-/* this struct defines the way the registers are stored on the
- stack during a system call. */
+#ifndef __ASSEMBLY__
struct pt_regs {
- unsigned long psr; /* for condition codes */
- unsigned long pc; /* current and next program counter */
+ unsigned long psr;
+ unsigned long pc;
unsigned long npc;
unsigned long y;
- /* not sure yet whether all regs are necessary
- * but this is how it is traditionally done on the sparc.
- */
unsigned long u_regs[16]; /* globals and ins */
};
+#define UREG_G0 0
+#define UREG_G1 1
+#define UREG_G2 2
+#define UREG_G3 3
+#define UREG_G4 4
+#define UREG_G5 5
+#define UREG_G6 6
+#define UREG_G7 7
+#define UREG_I0 8
+#define UREG_I1 9
+#define UREG_I2 10
+#define UREG_I3 11
+#define UREG_I4 12
+#define UREG_I5 13
+#define UREG_I6 14
+#define UREG_I7 15
+#define UREG_WIM UREG_G0
+#define UREG_FP UREG_I6
+#define UREG_RETPC UREG_I7
+
+/* A register window */
+struct reg_window {
+ unsigned long locals[8];
+ unsigned long ins[8];
+};
+
+
+/* A Sparc stack frame */
+struct sparc_stackf {
+ unsigned long locals[8];
+ unsigned long ins[6];
+ struct sparc_stackf *fp;
+ unsigned long callers_pc;
+ char *structptr;
+ unsigned long xargs[6];
+ unsigned long xxargs[1];
+};
+
+#define TRACEREG_SZ sizeof(struct pt_regs)
+#define STACKFRAME_SZ sizeof(struct sparc_stackf)
+#define REGWIN_SZ sizeof(struct reg_window)
+
#ifdef __KERNEL__
-/* if previous supervisor is 0, came from user */
-#define user_mode(regs) (0x0)
+#define user_mode(regs) (!((regs)->psr & PSR_PS))
+#define instruction_pointer(regs) ((regs)->pc)
extern void show_regs(struct pt_regs *);
#endif
+#else /* __ASSEMBLY__ */
+/* For assembly code. */
+#define TRACEREG_SZ 0x50
+#define STACKFRAME_SZ 0x60
+#define REGWIN_SZ 0x40
#endif
+
+/* First generic task_struct offsets. sizeof(task_struct)=1536 */
+#define TASK_STATE 0x000
+#define TASK_PRIORITY 0x008
+#define TASK_SIGNAL 0x00c
+#define TASK_BLOCKED 0x010
+#define TASK_FLAGS 0x014
+#define TASK_SAVED_KSTACK 0x054
+#define TASK_KSTACK_PG 0x058
+
+/* Thread stuff. */
+#define THREAD_UMASK 0x210
+#define THREAD_SADDR 0x218
+#define THREAD_SDESC 0x21c
+#define THREAD_KSP 0x220
+#define THREAD_KPC 0x224
+#define THREAD_KPSR 0x228
+#define THREAD_KWIM 0x22c
+#define THREAD_REG_WINDOW 0x230
+#define THREAD_STACK_PTRS 0x430
+#define THREAD_W_SAVED 0x450
+#define THREAD_PGD_PTR 0x454
+#define THREAD_CONTEXT 0x458
+#define THREAD_FLOAT_REGS 0x460
+#define THREAD_FSR 0x560
+#define THREAD_SIGSTK 0x5e8
+
+/* These are for pt_regs. */
+#define PT_PSR 0x0
+#define PT_PC 0x4
+#define PT_NPC 0x8
+#define PT_Y 0xc
+#define PT_G0 0x10
+#define PT_WIM PT_G0
+#define PT_G1 0x14
+#define PT_G2 0x18
+#define PT_G3 0x1c
+#define PT_G4 0x20
+#define PT_G5 0x24
+#define PT_G6 0x28
+#define PT_G7 0x2c
+#define PT_I0 0x30
+#define PT_I1 0x34
+#define PT_I2 0x38
+#define PT_I3 0x3c
+#define PT_I4 0x40
+#define PT_I5 0x44
+#define PT_I6 0x48
+#define PT_FP PT_I6
+#define PT_I7 0x4c
+
+/* Reg_window offsets */
+#define RW_L0 0x00
+#define RW_L1 0x04
+#define RW_L2 0x08
+#define RW_L3 0x0c
+#define RW_L4 0x10
+#define RW_L5 0x14
+#define RW_L6 0x18
+#define RW_L7 0x1c
+#define RW_I0 0x20
+#define RW_I1 0x24
+#define RW_I2 0x28
+#define RW_I3 0x2c
+#define RW_I4 0x30
+#define RW_I5 0x34
+#define RW_I6 0x38
+#define RW_I7 0x3c
+
+/* Stack_frame offsets */
+#define SF_L0 0x00
+#define SF_L1 0x04
+#define SF_L2 0x08
+#define SF_L3 0x0c
+#define SF_L4 0x10
+#define SF_L5 0x14
+#define SF_L6 0x18
+#define SF_L7 0x1c
+#define SF_I0 0x20
+#define SF_I1 0x24
+#define SF_I2 0x28
+#define SF_I3 0x2c
+#define SF_I4 0x30
+#define SF_I5 0x34
+#define SF_FP 0x38
+#define SF_PC 0x3c
+#define SF_RETP 0x40
+#define SF_XARG0 0x44
+#define SF_XARG1 0x48
+#define SF_XARG2 0x4c
+#define SF_XARG3 0x50
+#define SF_XARG4 0x54
+#define SF_XARG5 0x58
+#define SF_XXARG 0x5c
+
+#endif /* !(_SPARC_PTRACE_H) */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this