Commit a0987224 authored by Anton Blanchard's avatar Anton Blanchard Committed by Paul Mackerras

[PATCH] ppc64: ptrace cleanups

- Remove the PPC_REG* defines
- Wrap some more stuff with ifdef __KERNEL__
- Add missing PT_TRAP, PT_DAR, PT_DSISR defines
- Add PTRACE_GETEVRREGS/PTRACE_SETEVRREGS, even though we dont use it on
  ppc64 we dont want to allocate them for something else.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 962bca7f
...@@ -25,56 +25,49 @@ ...@@ -25,56 +25,49 @@
*/ */
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#define PPC_REG unsigned long
struct pt_regs { struct pt_regs {
PPC_REG gpr[32]; unsigned long gpr[32];
PPC_REG nip; unsigned long nip;
PPC_REG msr; unsigned long msr;
PPC_REG orig_gpr3; /* Used for restarting system calls */ unsigned long orig_gpr3; /* Used for restarting system calls */
PPC_REG ctr; unsigned long ctr;
PPC_REG link; unsigned long link;
PPC_REG xer; unsigned long xer;
PPC_REG ccr; unsigned long ccr;
PPC_REG softe; /* Soft enabled/disabled */ unsigned long softe; /* Soft enabled/disabled */
PPC_REG trap; /* Reason for being here */ unsigned long trap; /* Reason for being here */
PPC_REG dar; /* Fault registers */ unsigned long dar; /* Fault registers */
PPC_REG dsisr; unsigned long dsisr;
PPC_REG result; /* Result of a system call */ unsigned long result; /* Result of a system call */
}; };
#define PPC_REG_32 unsigned int
struct pt_regs32 { struct pt_regs32 {
PPC_REG_32 gpr[32]; unsigned int gpr[32];
PPC_REG_32 nip; unsigned int nip;
PPC_REG_32 msr; unsigned int msr;
PPC_REG_32 orig_gpr3; /* Used for restarting system calls */ unsigned int orig_gpr3; /* Used for restarting system calls */
PPC_REG_32 ctr; unsigned int ctr;
PPC_REG_32 link; unsigned int link;
PPC_REG_32 xer; unsigned int xer;
PPC_REG_32 ccr; unsigned int ccr;
PPC_REG_32 mq; /* 601 only (not used at present) */ unsigned int mq; /* 601 only (not used at present) */
/* Used on APUS to hold IPL value. */ unsigned int trap; /* Reason for being here */
PPC_REG_32 trap; /* Reason for being here */ unsigned int dar; /* Fault registers */
PPC_REG_32 dar; /* Fault registers */ unsigned int dsisr;
PPC_REG_32 dsisr; unsigned int result; /* Result of a system call */
PPC_REG_32 result; /* Result of a system call */
}; };
#ifdef __KERNEL__
#define instruction_pointer(regs) ((regs)->nip) #define instruction_pointer(regs) ((regs)->nip)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
extern unsigned long profile_pc(struct pt_regs *regs); extern unsigned long profile_pc(struct pt_regs *regs);
#else #else
#define profile_pc(regs) instruction_pointer(regs) #define profile_pc(regs) instruction_pointer(regs)
#endif #endif
#endif /* __ASSEMBLY__ */
#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */
/* Size of dummy stack frame allocated when calling signal handler. */
#define __SIGNAL_FRAMESIZE 128
#define __SIGNAL_FRAMESIZE32 64
#define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1) #define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1)
#define force_successful_syscall_return() \ #define force_successful_syscall_return() \
...@@ -89,6 +82,16 @@ extern unsigned long profile_pc(struct pt_regs *regs); ...@@ -89,6 +82,16 @@ extern unsigned long profile_pc(struct pt_regs *regs);
#define TRAP(regs) ((regs)->trap & ~0xF) #define TRAP(regs) ((regs)->trap & ~0xF)
#define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1) #define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1)
#endif /* __KERNEL__ */
#endif /* __ASSEMBLY__ */
#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */
/* Size of dummy stack frame allocated when calling signal handler. */
#define __SIGNAL_FRAMESIZE 128
#define __SIGNAL_FRAMESIZE32 64
/* /*
* Offsets used by 'ptrace' system call interface. * Offsets used by 'ptrace' system call interface.
*/ */
...@@ -135,17 +138,21 @@ extern unsigned long profile_pc(struct pt_regs *regs); ...@@ -135,17 +138,21 @@ extern unsigned long profile_pc(struct pt_regs *regs);
#define PT_XER 37 #define PT_XER 37
#define PT_CCR 38 #define PT_CCR 38
#define PT_SOFTE 39 #define PT_SOFTE 39
#define PT_TRAP 40
#define PT_DAR 41
#define PT_DSISR 42
#define PT_RESULT 43 #define PT_RESULT 43
#define PT_FPR0 48 #define PT_FPR0 48
/* Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will have /*
* visibility to the asm-ppc/ptrace.h header instead of this one. * Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will
* have visibility to the asm-ppc/ptrace.h header instead of this one.
*/ */
#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ #define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */
#ifdef __KERNEL__ #ifdef __KERNEL__
#define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */ #define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */
#endif #endif
#define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */ #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,17 +180,27 @@ extern unsigned long profile_pc(struct pt_regs *regs);
#define PTRACE_GETVRREGS 18 #define PTRACE_GETVRREGS 18
#define PTRACE_SETVRREGS 19 #define PTRACE_SETVRREGS 19
/* Additional PTRACE requests implemented on PowerPC. */ /*
#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ * While we dont have 64bit book E processors, we need to reserve the
#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ * relevant ptrace calls for 32bit compatibility.
#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ */
#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ #if 0
#define PPC_PTRACE_PEEKTEXT_3264 0x95 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ #define PTRACE_GETEVRREGS 20
#define PPC_PTRACE_PEEKDATA_3264 0x94 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ #define PTRACE_SETEVRREGS 21
#define PPC_PTRACE_POKETEXT_3264 0x93 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */ #endif
#define PPC_PTRACE_POKEDATA_3264 0x92 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */
#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. */
#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. */
/* Additional PTRACE requests implemented on PowerPC. */
#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */
#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */
#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */
#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */
/* Calls to trace a 64bit program from a 32bit program */
#define PPC_PTRACE_PEEKTEXT_3264 0x95
#define PPC_PTRACE_PEEKDATA_3264 0x94
#define PPC_PTRACE_POKETEXT_3264 0x93
#define PPC_PTRACE_POKEDATA_3264 0x92
#define PPC_PTRACE_PEEKUSR_3264 0x91
#define PPC_PTRACE_POKEUSR_3264 0x90
#endif /* _PPC64_PTRACE_H */ #endif /* _PPC64_PTRACE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment