1 #ifndef _SPARC_PTRACE_H
2 #define _SPARC_PTRACE_H
6 /* This struct defines the way the registers are stored on the
7 * stack during a system call and basically all traps.
12 #include <linux/types.h>
19 unsigned long u_regs[16]; /* globals and ins */
38 #define UREG_WIM UREG_G0
39 #define UREG_FADDR UREG_G0
40 #define UREG_FP UREG_I6
41 #define UREG_RETPC UREG_I7
43 /* A register window */
45 unsigned long locals[8];
49 /* A Sparc stack frame */
51 unsigned long locals[8];
53 struct sparc_stackf *fp;
54 unsigned long callers_pc;
56 unsigned long xargs[6];
57 unsigned long xxargs[1];
60 #define TRACEREG_SZ sizeof(struct pt_regs)
61 #define STACKFRAME_SZ sizeof(struct sparc_stackf)
65 static inline bool pt_regs_is_syscall(struct pt_regs *regs)
67 return (regs->psr & PSR_SYSCALL);
70 static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
72 return (regs->psr &= ~PSR_SYSCALL);
75 #define user_mode(regs) (!((regs)->psr & PSR_PS))
76 #define instruction_pointer(regs) ((regs)->pc)
77 #define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
78 unsigned long profile_pc(struct pt_regs *);
79 extern void show_regs(struct pt_regs *);
82 #else /* __ASSEMBLY__ */
83 /* For assembly code. */
84 #define TRACEREG_SZ 0x50
85 #define STACKFRAME_SZ 0x60
89 * The asm-offsets.h is a generated file, so we cannot include it.
90 * It may be OK for glibc headers, but it's utterly pointless for C code.
91 * The assembly code using those offsets has to include it explicitly.
93 /* #include <asm/asm-offsets.h> */
95 /* These are for pt_regs. */
119 /* Reg_window offsets */
137 /* Stack_frame offsets */
155 #define SF_XARG0 0x44
156 #define SF_XARG1 0x48
157 #define SF_XARG2 0x4c
158 #define SF_XARG3 0x50
159 #define SF_XARG4 0x54
160 #define SF_XARG5 0x58
161 #define SF_XXARG 0x5c
163 /* Stuff for the ptrace system call */
164 #define PTRACE_SPARC_DETACH 11
165 #define PTRACE_GETREGS 12
166 #define PTRACE_SETREGS 13
167 #define PTRACE_GETFPREGS 14
168 #define PTRACE_SETFPREGS 15
169 #define PTRACE_READDATA 16
170 #define PTRACE_WRITEDATA 17
171 #define PTRACE_READTEXT 18
172 #define PTRACE_WRITETEXT 19
173 #define PTRACE_GETFPAREGS 20
174 #define PTRACE_SETFPAREGS 21
176 #endif /* !(_SPARC_PTRACE_H) */