1 #ifndef _CRIS_PTRACE_H
2 #define _CRIS_PTRACE_H
3 
4 /* Register numbers in the ptrace system call interface */
5 
6 #define PT_FRAMETYPE 0
7 #define PT_ORIG_R10  1
8 #define PT_R13       2
9 #define PT_R12       3
10 #define PT_R11       4
11 #define PT_R10       5
12 #define PT_R9        6
13 #define PT_R8        7
14 #define PT_R7        8
15 #define PT_R6        9
16 #define PT_R5        10
17 #define PT_R4        11
18 #define PT_R3        12
19 #define PT_R2        13
20 #define PT_R1        14
21 #define PT_R0        15
22 #define PT_MOF       16
23 #define PT_DCCR      17
24 #define PT_SRP       18
25 #define PT_IRP       19    /* This is actually the debugged process' PC */
26 #define PT_CSRINSTR  20    /* CPU Status record remnants -
27 			      valid if frametype == busfault */
28 #define PT_CSRADDR   21
29 #define PT_CSRDATA   22
30 #define PT_USP       23    /* special case - USP is not in the pt_regs */
31 #define PT_MAX       23
32 
33 /* Condition code bit numbers.  The same numbers apply to CCR of course,
34    but we use DCCR everywhere else, so let's try and be consistent.  */
35 #define C_DCCR_BITNR 0
36 #define V_DCCR_BITNR 1
37 #define Z_DCCR_BITNR 2
38 #define N_DCCR_BITNR 3
39 #define X_DCCR_BITNR 4
40 #define I_DCCR_BITNR 5
41 #define B_DCCR_BITNR 6
42 #define M_DCCR_BITNR 7
43 #define U_DCCR_BITNR 8
44 #define P_DCCR_BITNR 9
45 #define F_DCCR_BITNR 10
46 
47 /* Frame types */
48 
49 #define CRIS_FRAME_NORMAL   0 /* normal frame without SBFS stacking */
50 #define CRIS_FRAME_BUSFAULT 1 /* frame stacked using SBFS, need RBF return
51 				 path */
52 
53 /* pt_regs not only specifices the format in the user-struct during
54  * ptrace but is also the frame format used in the kernel prologue/epilogues
55  * themselves
56  */
57 
58 struct pt_regs {
59 	unsigned long frametype;  /* type of stackframe */
60 	unsigned long orig_r10;
61 	/* pushed by movem r13, [sp] in SAVE_ALL, movem pushes backwards */
62 	unsigned long r13;
63 	unsigned long r12;
64 	unsigned long r11;
65 	unsigned long r10;
66 	unsigned long r9;
67 	unsigned long r8;
68 	unsigned long r7;
69 	unsigned long r6;
70 	unsigned long r5;
71 	unsigned long r4;
72 	unsigned long r3;
73 	unsigned long r2;
74 	unsigned long r1;
75 	unsigned long r0;
76 	unsigned long mof;
77 	unsigned long dccr;
78 	unsigned long srp;
79 	unsigned long irp; /* This is actually the debugged process' PC */
80 	unsigned long csrinstr;
81 	unsigned long csraddr;
82 	unsigned long csrdata;
83 };
84 
85 /* switch_stack is the extra stuff pushed onto the stack in _resume (entry.S)
86  * when doing a context-switch. it is used (apart from in resume) when a new
87  * thread is made and we need to make _resume (which is starting it for the
88  * first time) realise what is going on.
89  *
90  * Actually, the use is very close to the thread struct (TSS) in that both the
91  * switch_stack and the TSS are used to keep thread stuff when switching in
92  * _resume.
93  */
94 
95 struct switch_stack {
96 	unsigned long r9;
97 	unsigned long r8;
98 	unsigned long r7;
99 	unsigned long r6;
100 	unsigned long r5;
101 	unsigned long r4;
102 	unsigned long r3;
103 	unsigned long r2;
104 	unsigned long r1;
105 	unsigned long r0;
106 	unsigned long return_ip; /* ip that _resume will return to */
107 };
108 
109 #ifdef __KERNEL__
110 /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
111 #define PTRACE_GETREGS            12
112 #define PTRACE_SETREGS            13
113 
114 /* bit 8 is user-mode flag */
115 #define user_mode(regs) (((regs)->dccr & 0x100) != 0)
116 #define instruction_pointer(regs) ((regs)->irp)
117 extern void show_regs(struct pt_regs *);
118 #endif
119 
120 #endif /* _CRIS_PTRACE_H */
121