1*a47a12beSStefan Roese #ifndef _PPC_PTRACE_H 2*a47a12beSStefan Roese #define _PPC_PTRACE_H 3*a47a12beSStefan Roese 4*a47a12beSStefan Roese /* 5*a47a12beSStefan Roese * This struct defines the way the registers are stored on the 6*a47a12beSStefan Roese * kernel stack during a system call or other kernel entry. 7*a47a12beSStefan Roese * 8*a47a12beSStefan Roese * this should only contain volatile regs 9*a47a12beSStefan Roese * since we can keep non-volatile in the thread_struct 10*a47a12beSStefan Roese * should set this up when only volatiles are saved 11*a47a12beSStefan Roese * by intr code. 12*a47a12beSStefan Roese * 13*a47a12beSStefan Roese * Since this is going on the stack, *CARE MUST BE TAKEN* to insure 14*a47a12beSStefan Roese * that the overall structure is a multiple of 16 bytes in length. 15*a47a12beSStefan Roese * 16*a47a12beSStefan Roese * Note that the offsets of the fields in this struct correspond with 17*a47a12beSStefan Roese * the PT_* values below. This simplifies arch/powerpc/kernel/ptrace.c. 18*a47a12beSStefan Roese */ 19*a47a12beSStefan Roese 20*a47a12beSStefan Roese #include <linux/config.h> 21*a47a12beSStefan Roese 22*a47a12beSStefan Roese #ifndef __ASSEMBLY__ 23*a47a12beSStefan Roese #ifdef CONFIG_PPC64BRIDGE 24*a47a12beSStefan Roese #define PPC_REG unsigned long /*long*/ 25*a47a12beSStefan Roese #else 26*a47a12beSStefan Roese #define PPC_REG unsigned long 27*a47a12beSStefan Roese #endif 28*a47a12beSStefan Roese struct pt_regs { 29*a47a12beSStefan Roese PPC_REG gpr[32]; 30*a47a12beSStefan Roese PPC_REG nip; 31*a47a12beSStefan Roese PPC_REG msr; 32*a47a12beSStefan Roese PPC_REG orig_gpr3; /* Used for restarting system calls */ 33*a47a12beSStefan Roese PPC_REG ctr; 34*a47a12beSStefan Roese PPC_REG link; 35*a47a12beSStefan Roese PPC_REG xer; 36*a47a12beSStefan Roese PPC_REG ccr; 37*a47a12beSStefan Roese PPC_REG mq; /* 601 only (not used at present) */ 38*a47a12beSStefan Roese /* Used on APUS to hold IPL value. */ 39*a47a12beSStefan Roese PPC_REG trap; /* Reason for being here */ 40*a47a12beSStefan Roese PPC_REG dar; /* Fault registers */ 41*a47a12beSStefan Roese PPC_REG dsisr; 42*a47a12beSStefan Roese PPC_REG result; /* Result of a system call */ 43*a47a12beSStefan Roese }; 44*a47a12beSStefan Roese #endif 45*a47a12beSStefan Roese 46*a47a12beSStefan Roese #define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */ 47*a47a12beSStefan Roese 48*a47a12beSStefan Roese /* Size of stack frame allocated when calling signal handler. */ 49*a47a12beSStefan Roese #define __SIGNAL_FRAMESIZE 64 50*a47a12beSStefan Roese 51*a47a12beSStefan Roese #define instruction_pointer(regs) ((regs)->nip) 52*a47a12beSStefan Roese #define user_mode(regs) (((regs)->msr & MSR_PR) != 0) 53*a47a12beSStefan Roese 54*a47a12beSStefan Roese /* 55*a47a12beSStefan Roese * Offsets used by 'ptrace' system call interface. 56*a47a12beSStefan Roese * These can't be changed without breaking binary compatibility 57*a47a12beSStefan Roese * with MkLinux, etc. 58*a47a12beSStefan Roese */ 59*a47a12beSStefan Roese #define PT_R0 0 60*a47a12beSStefan Roese #define PT_R1 1 61*a47a12beSStefan Roese #define PT_R2 2 62*a47a12beSStefan Roese #define PT_R3 3 63*a47a12beSStefan Roese #define PT_R4 4 64*a47a12beSStefan Roese #define PT_R5 5 65*a47a12beSStefan Roese #define PT_R6 6 66*a47a12beSStefan Roese #define PT_R7 7 67*a47a12beSStefan Roese #define PT_R8 8 68*a47a12beSStefan Roese #define PT_R9 9 69*a47a12beSStefan Roese #define PT_R10 10 70*a47a12beSStefan Roese #define PT_R11 11 71*a47a12beSStefan Roese #define PT_R12 12 72*a47a12beSStefan Roese #define PT_R13 13 73*a47a12beSStefan Roese #define PT_R14 14 74*a47a12beSStefan Roese #define PT_R15 15 75*a47a12beSStefan Roese #define PT_R16 16 76*a47a12beSStefan Roese #define PT_R17 17 77*a47a12beSStefan Roese #define PT_R18 18 78*a47a12beSStefan Roese #define PT_R19 19 79*a47a12beSStefan Roese #define PT_R20 20 80*a47a12beSStefan Roese #define PT_R21 21 81*a47a12beSStefan Roese #define PT_R22 22 82*a47a12beSStefan Roese #define PT_R23 23 83*a47a12beSStefan Roese #define PT_R24 24 84*a47a12beSStefan Roese #define PT_R25 25 85*a47a12beSStefan Roese #define PT_R26 26 86*a47a12beSStefan Roese #define PT_R27 27 87*a47a12beSStefan Roese #define PT_R28 28 88*a47a12beSStefan Roese #define PT_R29 29 89*a47a12beSStefan Roese #define PT_R30 30 90*a47a12beSStefan Roese #define PT_R31 31 91*a47a12beSStefan Roese 92*a47a12beSStefan Roese #define PT_NIP 32 93*a47a12beSStefan Roese #define PT_MSR 33 94*a47a12beSStefan Roese #ifdef __KERNEL__ 95*a47a12beSStefan Roese #define PT_ORIG_R3 34 96*a47a12beSStefan Roese #endif 97*a47a12beSStefan Roese #define PT_CTR 35 98*a47a12beSStefan Roese #define PT_LNK 36 99*a47a12beSStefan Roese #define PT_XER 37 100*a47a12beSStefan Roese #define PT_CCR 38 101*a47a12beSStefan Roese #define PT_MQ 39 102*a47a12beSStefan Roese 103*a47a12beSStefan Roese #define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */ 104*a47a12beSStefan Roese #define PT_FPR31 (PT_FPR0 + 2*31) 105*a47a12beSStefan Roese #define PT_FPSCR (PT_FPR0 + 2*32 + 1) 106*a47a12beSStefan Roese 107*a47a12beSStefan Roese #endif 108