diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-ppc64/ptrace.h | 121 |
1 files changed, 69 insertions, 52 deletions
diff --git a/include/asm-ppc64/ptrace.h b/include/asm-ppc64/ptrace.h index c96aad28fc08..a736000d7cf8 100644 --- a/include/asm-ppc64/ptrace.h +++ b/include/asm-ppc64/ptrace.h | |||
@@ -25,56 +25,49 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifndef __ASSEMBLY__ | 27 | #ifndef __ASSEMBLY__ |
28 | #define PPC_REG unsigned long | 28 | |
29 | struct pt_regs { | 29 | struct pt_regs { |
30 | PPC_REG gpr[32]; | 30 | unsigned long gpr[32]; |
31 | PPC_REG nip; | 31 | unsigned long nip; |
32 | PPC_REG msr; | 32 | unsigned long msr; |
33 | PPC_REG orig_gpr3; /* Used for restarting system calls */ | 33 | unsigned long orig_gpr3; /* Used for restarting system calls */ |
34 | PPC_REG ctr; | 34 | unsigned long ctr; |
35 | PPC_REG link; | 35 | unsigned long link; |
36 | PPC_REG xer; | 36 | unsigned long xer; |
37 | PPC_REG ccr; | 37 | unsigned long ccr; |
38 | PPC_REG softe; /* Soft enabled/disabled */ | 38 | unsigned long softe; /* Soft enabled/disabled */ |
39 | PPC_REG trap; /* Reason for being here */ | 39 | unsigned long trap; /* Reason for being here */ |
40 | PPC_REG dar; /* Fault registers */ | 40 | unsigned long dar; /* Fault registers */ |
41 | PPC_REG dsisr; | 41 | unsigned long dsisr; |
42 | PPC_REG result; /* Result of a system call */ | 42 | unsigned long result; /* Result of a system call */ |
43 | }; | 43 | }; |
44 | 44 | ||
45 | #define PPC_REG_32 unsigned int | ||
46 | struct pt_regs32 { | 45 | struct pt_regs32 { |
47 | PPC_REG_32 gpr[32]; | 46 | unsigned int gpr[32]; |
48 | PPC_REG_32 nip; | 47 | unsigned int nip; |
49 | PPC_REG_32 msr; | 48 | unsigned int msr; |
50 | PPC_REG_32 orig_gpr3; /* Used for restarting system calls */ | 49 | unsigned int orig_gpr3; /* Used for restarting system calls */ |
51 | PPC_REG_32 ctr; | 50 | unsigned int ctr; |
52 | PPC_REG_32 link; | 51 | unsigned int link; |
53 | PPC_REG_32 xer; | 52 | unsigned int xer; |
54 | PPC_REG_32 ccr; | 53 | unsigned int ccr; |
55 | PPC_REG_32 mq; /* 601 only (not used at present) */ | 54 | unsigned int mq; /* 601 only (not used at present) */ |
56 | /* Used on APUS to hold IPL value. */ | 55 | unsigned int trap; /* Reason for being here */ |
57 | PPC_REG_32 trap; /* Reason for being here */ | 56 | unsigned int dar; /* Fault registers */ |
58 | PPC_REG_32 dar; /* Fault registers */ | 57 | unsigned int dsisr; |
59 | PPC_REG_32 dsisr; | 58 | unsigned int result; /* Result of a system call */ |
60 | PPC_REG_32 result; /* Result of a system call */ | ||
61 | }; | 59 | }; |
62 | 60 | ||
61 | #ifdef __KERNEL__ | ||
62 | |||
63 | #define instruction_pointer(regs) ((regs)->nip) | 63 | #define instruction_pointer(regs) ((regs)->nip) |
64 | |||
64 | #ifdef CONFIG_SMP | 65 | #ifdef CONFIG_SMP |
65 | extern unsigned long profile_pc(struct pt_regs *regs); | 66 | extern unsigned long profile_pc(struct pt_regs *regs); |
66 | #else | 67 | #else |
67 | #define profile_pc(regs) instruction_pointer(regs) | 68 | #define profile_pc(regs) instruction_pointer(regs) |
68 | #endif | 69 | #endif |
69 | 70 | ||
70 | #endif /* __ASSEMBLY__ */ | ||
71 | |||
72 | #define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ | ||
73 | |||
74 | /* Size of dummy stack frame allocated when calling signal handler. */ | ||
75 | #define __SIGNAL_FRAMESIZE 128 | ||
76 | #define __SIGNAL_FRAMESIZE32 64 | ||
77 | |||
78 | #define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1) | 71 | #define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1) |
79 | 72 | ||
80 | #define force_successful_syscall_return() \ | 73 | #define force_successful_syscall_return() \ |
@@ -89,6 +82,16 @@ extern unsigned long profile_pc(struct pt_regs *regs); | |||
89 | #define TRAP(regs) ((regs)->trap & ~0xF) | 82 | #define TRAP(regs) ((regs)->trap & ~0xF) |
90 | #define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1) | 83 | #define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1) |
91 | 84 | ||
85 | #endif /* __KERNEL__ */ | ||
86 | |||
87 | #endif /* __ASSEMBLY__ */ | ||
88 | |||
89 | #define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ | ||
90 | |||
91 | /* Size of dummy stack frame allocated when calling signal handler. */ | ||
92 | #define __SIGNAL_FRAMESIZE 128 | ||
93 | #define __SIGNAL_FRAMESIZE32 64 | ||
94 | |||
92 | /* | 95 | /* |
93 | * Offsets used by 'ptrace' system call interface. | 96 | * Offsets used by 'ptrace' system call interface. |
94 | */ | 97 | */ |
@@ -135,17 +138,21 @@ extern unsigned long profile_pc(struct pt_regs *regs); | |||
135 | #define PT_XER 37 | 138 | #define PT_XER 37 |
136 | #define PT_CCR 38 | 139 | #define PT_CCR 38 |
137 | #define PT_SOFTE 39 | 140 | #define PT_SOFTE 39 |
141 | #define PT_TRAP 40 | ||
142 | #define PT_DAR 41 | ||
143 | #define PT_DSISR 42 | ||
138 | #define PT_RESULT 43 | 144 | #define PT_RESULT 43 |
139 | 145 | ||
140 | #define PT_FPR0 48 | 146 | #define PT_FPR0 48 |
141 | 147 | ||
142 | /* Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will have | 148 | /* |
143 | * visibility to the asm-ppc/ptrace.h header instead of this one. | 149 | * Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will |
150 | * have visibility to the asm-ppc/ptrace.h header instead of this one. | ||
144 | */ | 151 | */ |
145 | #define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ | 152 | #define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ |
146 | 153 | ||
147 | #ifdef __KERNEL__ | 154 | #ifdef __KERNEL__ |
148 | #define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */ | 155 | #define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */ |
149 | #endif | 156 | #endif |
150 | 157 | ||
151 | #define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */ | 158 | #define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */ |
@@ -173,17 +180,27 @@ extern unsigned long profile_pc(struct pt_regs *regs); | |||
173 | #define PTRACE_GETVRREGS 18 | 180 | #define PTRACE_GETVRREGS 18 |
174 | #define PTRACE_SETVRREGS 19 | 181 | #define PTRACE_SETVRREGS 19 |
175 | 182 | ||
176 | /* Additional PTRACE requests implemented on PowerPC. */ | 183 | /* |
177 | #define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ | 184 | * While we dont have 64bit book E processors, we need to reserve the |
178 | #define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ | 185 | * relevant ptrace calls for 32bit compatibility. |
179 | #define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ | 186 | */ |
180 | #define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ | 187 | #if 0 |
181 | #define PPC_PTRACE_PEEKTEXT_3264 0x95 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ | 188 | #define PTRACE_GETEVRREGS 20 |
182 | #define PPC_PTRACE_PEEKDATA_3264 0x94 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ | 189 | #define PTRACE_SETEVRREGS 21 |
183 | #define PPC_PTRACE_POKETEXT_3264 0x93 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */ | 190 | #endif |
184 | #define PPC_PTRACE_POKEDATA_3264 0x92 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */ | ||
185 | #define PPC_PTRACE_PEEKUSR_3264 0x91 /* Read a register (specified by ADDR) out of the "user area" on a 64-bit process from a 32-bit process. */ | ||
186 | #define PPC_PTRACE_POKEUSR_3264 0x90 /* Write DATA into location ADDR within the "user area" on a 64-bit process from a 32-bit process. */ | ||
187 | 191 | ||
192 | /* Additional PTRACE requests implemented on PowerPC. */ | ||
193 | #define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ | ||
194 | #define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ | ||
195 | #define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ | ||
196 | #define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ | ||
197 | |||
198 | /* Calls to trace a 64bit program from a 32bit program */ | ||
199 | #define PPC_PTRACE_PEEKTEXT_3264 0x95 | ||
200 | #define PPC_PTRACE_PEEKDATA_3264 0x94 | ||
201 | #define PPC_PTRACE_POKETEXT_3264 0x93 | ||
202 | #define PPC_PTRACE_POKEDATA_3264 0x92 | ||
203 | #define PPC_PTRACE_PEEKUSR_3264 0x91 | ||
204 | #define PPC_PTRACE_POKEUSR_3264 0x90 | ||
188 | 205 | ||
189 | #endif /* _PPC64_PTRACE_H */ | 206 | #endif /* _PPC64_PTRACE_H */ |