]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/sparc/include/asm/ptrace_32.h
Merge branch 'linus' into x86/xen
[linux-2.6-omap-h63xx.git] / arch / sparc / include / asm / ptrace_32.h
1 #ifndef _SPARC_PTRACE_H
2 #define _SPARC_PTRACE_H
3
4 #include <asm/psr.h>
5
6 /* This struct defines the way the registers are stored on the
7  * stack during a system call and basically all traps.
8  */
9
10 #ifndef __ASSEMBLY__
11
12 #include <linux/types.h>
13
14 struct pt_regs {
15         unsigned long psr;
16         unsigned long pc;
17         unsigned long npc;
18         unsigned long y;
19         unsigned long u_regs[16]; /* globals and ins */
20 };
21
22 #define UREG_G0        0
23 #define UREG_G1        1
24 #define UREG_G2        2
25 #define UREG_G3        3
26 #define UREG_G4        4
27 #define UREG_G5        5
28 #define UREG_G6        6
29 #define UREG_G7        7
30 #define UREG_I0        8
31 #define UREG_I1        9
32 #define UREG_I2        10
33 #define UREG_I3        11
34 #define UREG_I4        12
35 #define UREG_I5        13
36 #define UREG_I6        14
37 #define UREG_I7        15
38 #define UREG_WIM       UREG_G0
39 #define UREG_FADDR     UREG_G0
40 #define UREG_FP        UREG_I6
41 #define UREG_RETPC     UREG_I7
42
43 static inline bool pt_regs_is_syscall(struct pt_regs *regs)
44 {
45         return (regs->psr & PSR_SYSCALL);
46 }
47
48 static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
49 {
50         return (regs->psr &= ~PSR_SYSCALL);
51 }
52
53 /* A register window */
54 struct reg_window {
55         unsigned long locals[8];
56         unsigned long ins[8];
57 };
58
59 /* A Sparc stack frame */
60 struct sparc_stackf {
61         unsigned long locals[8];
62         unsigned long ins[6];
63         struct sparc_stackf *fp;
64         unsigned long callers_pc;
65         char *structptr;
66         unsigned long xargs[6];
67         unsigned long xxargs[1];
68 };
69
70 #define TRACEREG_SZ   sizeof(struct pt_regs)
71 #define STACKFRAME_SZ sizeof(struct sparc_stackf)
72
73 #ifdef __KERNEL__
74
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 *);
80 #endif
81
82 #else /* __ASSEMBLY__ */
83 /* For assembly code. */
84 #define TRACEREG_SZ       0x50
85 #define STACKFRAME_SZ     0x60
86 #endif
87
88 /*
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.
92  */
93 /* #include <asm/asm-offsets.h> */
94
95 /* These are for pt_regs. */
96 #define PT_PSR    0x0
97 #define PT_PC     0x4
98 #define PT_NPC    0x8
99 #define PT_Y      0xc
100 #define PT_G0     0x10
101 #define PT_WIM    PT_G0
102 #define PT_G1     0x14
103 #define PT_G2     0x18
104 #define PT_G3     0x1c
105 #define PT_G4     0x20
106 #define PT_G5     0x24
107 #define PT_G6     0x28
108 #define PT_G7     0x2c
109 #define PT_I0     0x30
110 #define PT_I1     0x34
111 #define PT_I2     0x38
112 #define PT_I3     0x3c
113 #define PT_I4     0x40
114 #define PT_I5     0x44
115 #define PT_I6     0x48
116 #define PT_FP     PT_I6
117 #define PT_I7     0x4c
118
119 /* Reg_window offsets */
120 #define RW_L0     0x00
121 #define RW_L1     0x04
122 #define RW_L2     0x08
123 #define RW_L3     0x0c
124 #define RW_L4     0x10
125 #define RW_L5     0x14
126 #define RW_L6     0x18
127 #define RW_L7     0x1c
128 #define RW_I0     0x20
129 #define RW_I1     0x24
130 #define RW_I2     0x28
131 #define RW_I3     0x2c
132 #define RW_I4     0x30
133 #define RW_I5     0x34
134 #define RW_I6     0x38
135 #define RW_I7     0x3c
136
137 /* Stack_frame offsets */
138 #define SF_L0     0x00
139 #define SF_L1     0x04
140 #define SF_L2     0x08
141 #define SF_L3     0x0c
142 #define SF_L4     0x10
143 #define SF_L5     0x14
144 #define SF_L6     0x18
145 #define SF_L7     0x1c
146 #define SF_I0     0x20
147 #define SF_I1     0x24
148 #define SF_I2     0x28
149 #define SF_I3     0x2c
150 #define SF_I4     0x30
151 #define SF_I5     0x34
152 #define SF_FP     0x38
153 #define SF_PC     0x3c
154 #define SF_RETP   0x40
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
162
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
175
176 #endif /* !(_SPARC_PTRACE_H) */