aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/ptrace.h
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-06-04 01:15:43 -0400
committerPaul Mackerras <paulus@samba.org>2007-06-14 08:29:56 -0400
commite17666ba48f78ff10162d7448e7c92d668d8faf6 (patch)
tree7d3e2c99d383a968491178439b638dc1062e5269 /include/asm-powerpc/ptrace.h
parentacd89828484db6371202f5d292781ae6f832eda2 (diff)
[POWERPC] ptrace updates & new, better requests
The powerpc ptrace interface is dodgy at best. We have defined our "own" versions of GETREGS/SETREGS/GETFPREGS/SETFPREGS that strangely take arguments in reverse order from other archs (in addition to having different request numbers) and have subtle issue, like not accessing all of the registers in their respective categories. This patch moves the implementation of those to a separate function in order to facilitate their deprecation in the future, and provides new ptrace requests that mirror the x86 and sparc ones and use the same numbers: PTRACE_GETREGS : returns an entire pt_regs (the whole thing, not only the 32 GPRs, though that doesn't include the FPRs etc... There's a compat version for 32 bits that returns a 32 bits compatible pt_regs (44 uints) PTRACE_SETREGS : sets an entire pt_regs (the whole thing, not only the 32 GPRs, though that doesn't include the FPRs etc... Some registers cannot be written to and will just be dropped, this is the same as with POKEUSR, that is anything above MQ on 32 bits and CCR on 64 bits. There is a compat version as well. PTRACE_GETFPREGS : returns all the FP registers -including- the FPSCR that is 33 doubles (regardless of 32/64 bits) PTRACE_SETFPREGS : sets all the FP registers -including- the FPSCR that is 33 doubles (regardless of 32/64 bits) And two that only exist on 64 bits kernels: PTRACE_GETREGS64 : Same as PTRACE_GETREGS, except there is no compat function, a 32 bits process will obtain the full 64 bits registers PTRACE_SETREGS64 : Same as PTRACE_SETREGS, except there is no compat function, a 32 bits process will set the full 64 bits registers The two later ones makes things easier to have a 32 bits debugger on a 64 bits program (or on a 32 bits program that uses the full 64 bits of the GPRs, which is possible though has issues that will be fixed in a later patch). Finally, while at it, the patch removes a whole bunch of code duplication between ptrace32.c and ptrace.c, in large part by having the former call into the later for all requests that don't need any special "compat" treatment. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc/ptrace.h')
-rw-r--r--include/asm-powerpc/ptrace.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/include/asm-powerpc/ptrace.h b/include/asm-powerpc/ptrace.h
index 4ad77a13f865..53d24584e968 100644
--- a/include/asm-powerpc/ptrace.h
+++ b/include/asm-powerpc/ptrace.h
@@ -158,9 +158,7 @@ do { \
158 158
159#define PT_NIP 32 159#define PT_NIP 32
160#define PT_MSR 33 160#define PT_MSR 33
161#ifdef __KERNEL__
162#define PT_ORIG_R3 34 161#define PT_ORIG_R3 34
163#endif
164#define PT_CTR 35 162#define PT_CTR 35
165#define PT_LNK 36 163#define PT_LNK 36
166#define PT_XER 37 164#define PT_XER 37
@@ -169,11 +167,12 @@ do { \
169#define PT_MQ 39 167#define PT_MQ 39
170#else 168#else
171#define PT_SOFTE 39 169#define PT_SOFTE 39
170#endif
172#define PT_TRAP 40 171#define PT_TRAP 40
173#define PT_DAR 41 172#define PT_DAR 41
174#define PT_DSISR 42 173#define PT_DSISR 42
175#define PT_RESULT 43 174#define PT_RESULT 43
176#endif 175#define PT_REGS_COUNT 44
177 176
178#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */ 177#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */
179 178
@@ -229,7 +228,17 @@ do { \
229#define PTRACE_GET_DEBUGREG 25 228#define PTRACE_GET_DEBUGREG 25
230#define PTRACE_SET_DEBUGREG 26 229#define PTRACE_SET_DEBUGREG 26
231 230
232/* Additional PTRACE requests implemented on PowerPC. */ 231/* (new) PTRACE requests using the same numbers as x86 and the same
232 * argument ordering. Additionally, they support more registers too
233 */
234#define PTRACE_GETREGS 12
235#define PTRACE_SETREGS 13
236#define PTRACE_GETFPREGS 14
237#define PTRACE_SETFPREGS 15
238#define PTRACE_GETREGS64 22
239#define PTRACE_SETREGS64 23
240
241/* (old) PTRACE requests with inverted arguments */
233#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ 242#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */
234#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ 243#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */
235#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ 244#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */