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 #include <asm/system.h>
67 static inline bool pt_regs_is_syscall(struct pt_regs
*regs
)
69 return (regs
->psr
& PSR_SYSCALL
);
72 static inline bool pt_regs_clear_syscall(struct pt_regs
*regs
)
74 return (regs
->psr
&= ~PSR_SYSCALL
);
77 #define arch_ptrace_stop_needed(exit_code, info) \
78 ({ flush_user_windows(); \
79 current_thread_info()->w_saved != 0; \
82 #define arch_ptrace_stop(exit_code, info) \
83 synchronize_user_stack()
85 #define user_mode(regs) (!((regs)->psr & PSR_PS))
86 #define instruction_pointer(regs) ((regs)->pc)
87 #define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
88 unsigned long profile_pc(struct pt_regs
*);
89 extern void show_regs(struct pt_regs
*);
92 #else /* __ASSEMBLY__ */
93 /* For assembly code. */
94 #define TRACEREG_SZ 0x50
95 #define STACKFRAME_SZ 0x60
99 * The asm-offsets.h is a generated file, so we cannot include it.
100 * It may be OK for glibc headers, but it's utterly pointless for C code.
101 * The assembly code using those offsets has to include it explicitly.
103 /* #include <asm/asm-offsets.h> */
105 /* These are for pt_regs. */
129 /* Reg_window offsets */
147 /* Stack_frame offsets */
165 #define SF_XARG0 0x44
166 #define SF_XARG1 0x48
167 #define SF_XARG2 0x4c
168 #define SF_XARG3 0x50
169 #define SF_XARG4 0x54
170 #define SF_XARG5 0x58
171 #define SF_XXARG 0x5c
173 /* Stuff for the ptrace system call */
174 #define PTRACE_SPARC_DETACH 11
175 #define PTRACE_GETREGS 12
176 #define PTRACE_SETREGS 13
177 #define PTRACE_GETFPREGS 14
178 #define PTRACE_SETFPREGS 15
179 #define PTRACE_READDATA 16
180 #define PTRACE_WRITEDATA 17
181 #define PTRACE_READTEXT 18
182 #define PTRACE_WRITETEXT 19
183 #define PTRACE_GETFPAREGS 20
184 #define PTRACE_SETFPAREGS 21
186 #endif /* !(_SPARC_PTRACE_H) */