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