1 |
1275 |
phoenix |
/*
|
2 |
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
3 |
|
|
* License. See the file "COPYING" in the main directory of this archive
|
4 |
|
|
* for more details.
|
5 |
|
|
*
|
6 |
|
|
* Copyright (C) 1995 Andreas Busse
|
7 |
|
|
*/
|
8 |
|
|
#ifndef __ASM_MIPS_GDB_STUB_H
|
9 |
|
|
#define __ASM_MIPS_GDB_STUB_H
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
/*
|
13 |
|
|
* important register numbers
|
14 |
|
|
*/
|
15 |
|
|
|
16 |
|
|
#define REG_EPC 37
|
17 |
|
|
#define REG_FP 72
|
18 |
|
|
#define REG_SP 29
|
19 |
|
|
|
20 |
|
|
/*
|
21 |
|
|
* Stack layout for the GDB exception handler
|
22 |
|
|
* Derived from the stack layout described in asm-mips/stackframe.h
|
23 |
|
|
*
|
24 |
|
|
* The first PTRSIZE*6 bytes are argument save space for C subroutines.
|
25 |
|
|
*/
|
26 |
|
|
#define NUMREGS 90
|
27 |
|
|
|
28 |
|
|
#define GDB_FR_REG0 (PTRSIZE*6) /* 0 */
|
29 |
|
|
#define GDB_FR_REG1 ((GDB_FR_REG0) + 8) /* 1 */
|
30 |
|
|
#define GDB_FR_REG2 ((GDB_FR_REG1) + 8) /* 2 */
|
31 |
|
|
#define GDB_FR_REG3 ((GDB_FR_REG2) + 8) /* 3 */
|
32 |
|
|
#define GDB_FR_REG4 ((GDB_FR_REG3) + 8) /* 4 */
|
33 |
|
|
#define GDB_FR_REG5 ((GDB_FR_REG4) + 8) /* 5 */
|
34 |
|
|
#define GDB_FR_REG6 ((GDB_FR_REG5) + 8) /* 6 */
|
35 |
|
|
#define GDB_FR_REG7 ((GDB_FR_REG6) + 8) /* 7 */
|
36 |
|
|
#define GDB_FR_REG8 ((GDB_FR_REG7) + 8) /* 8 */
|
37 |
|
|
#define GDB_FR_REG9 ((GDB_FR_REG8) + 8) /* 9 */
|
38 |
|
|
#define GDB_FR_REG10 ((GDB_FR_REG9) + 8) /* 10 */
|
39 |
|
|
#define GDB_FR_REG11 ((GDB_FR_REG10) + 8) /* 11 */
|
40 |
|
|
#define GDB_FR_REG12 ((GDB_FR_REG11) + 8) /* 12 */
|
41 |
|
|
#define GDB_FR_REG13 ((GDB_FR_REG12) + 8) /* 13 */
|
42 |
|
|
#define GDB_FR_REG14 ((GDB_FR_REG13) + 8) /* 14 */
|
43 |
|
|
#define GDB_FR_REG15 ((GDB_FR_REG14) + 8) /* 15 */
|
44 |
|
|
#define GDB_FR_REG16 ((GDB_FR_REG15) + 8) /* 16 */
|
45 |
|
|
#define GDB_FR_REG17 ((GDB_FR_REG16) + 8) /* 17 */
|
46 |
|
|
#define GDB_FR_REG18 ((GDB_FR_REG17) + 8) /* 18 */
|
47 |
|
|
#define GDB_FR_REG19 ((GDB_FR_REG18) + 8) /* 19 */
|
48 |
|
|
#define GDB_FR_REG20 ((GDB_FR_REG19) + 8) /* 20 */
|
49 |
|
|
#define GDB_FR_REG21 ((GDB_FR_REG20) + 8) /* 21 */
|
50 |
|
|
#define GDB_FR_REG22 ((GDB_FR_REG21) + 8) /* 22 */
|
51 |
|
|
#define GDB_FR_REG23 ((GDB_FR_REG22) + 8) /* 23 */
|
52 |
|
|
#define GDB_FR_REG24 ((GDB_FR_REG23) + 8) /* 24 */
|
53 |
|
|
#define GDB_FR_REG25 ((GDB_FR_REG24) + 8) /* 25 */
|
54 |
|
|
#define GDB_FR_REG26 ((GDB_FR_REG25) + 8) /* 26 */
|
55 |
|
|
#define GDB_FR_REG27 ((GDB_FR_REG26) + 8) /* 27 */
|
56 |
|
|
#define GDB_FR_REG28 ((GDB_FR_REG27) + 8) /* 28 */
|
57 |
|
|
#define GDB_FR_REG29 ((GDB_FR_REG28) + 8) /* 29 */
|
58 |
|
|
#define GDB_FR_REG30 ((GDB_FR_REG29) + 8) /* 30 */
|
59 |
|
|
#define GDB_FR_REG31 ((GDB_FR_REG30) + 8) /* 31 */
|
60 |
|
|
|
61 |
|
|
/*
|
62 |
|
|
* Saved special registers
|
63 |
|
|
*/
|
64 |
|
|
#define GDB_FR_STATUS ((GDB_FR_REG31) + 8) /* 32 */
|
65 |
|
|
#define GDB_FR_LO ((GDB_FR_STATUS) + 8) /* 33 */
|
66 |
|
|
#define GDB_FR_HI ((GDB_FR_LO) + 8) /* 34 */
|
67 |
|
|
#define GDB_FR_BADVADDR ((GDB_FR_HI) + 8) /* 35 */
|
68 |
|
|
#define GDB_FR_CAUSE ((GDB_FR_BADVADDR) + 8) /* 36 */
|
69 |
|
|
#define GDB_FR_EPC ((GDB_FR_CAUSE) + 8) /* 37 */
|
70 |
|
|
|
71 |
|
|
/*
|
72 |
|
|
* Saved floating point registers
|
73 |
|
|
*/
|
74 |
|
|
#define GDB_FR_FPR0 ((GDB_FR_EPC) + 8) /* 38 */
|
75 |
|
|
#define GDB_FR_FPR1 ((GDB_FR_FPR0) + 8) /* 39 */
|
76 |
|
|
#define GDB_FR_FPR2 ((GDB_FR_FPR1) + 8) /* 40 */
|
77 |
|
|
#define GDB_FR_FPR3 ((GDB_FR_FPR2) + 8) /* 41 */
|
78 |
|
|
#define GDB_FR_FPR4 ((GDB_FR_FPR3) + 8) /* 42 */
|
79 |
|
|
#define GDB_FR_FPR5 ((GDB_FR_FPR4) + 8) /* 43 */
|
80 |
|
|
#define GDB_FR_FPR6 ((GDB_FR_FPR5) + 8) /* 44 */
|
81 |
|
|
#define GDB_FR_FPR7 ((GDB_FR_FPR6) + 8) /* 45 */
|
82 |
|
|
#define GDB_FR_FPR8 ((GDB_FR_FPR7) + 8) /* 46 */
|
83 |
|
|
#define GDB_FR_FPR9 ((GDB_FR_FPR8) + 8) /* 47 */
|
84 |
|
|
#define GDB_FR_FPR10 ((GDB_FR_FPR9) + 8) /* 48 */
|
85 |
|
|
#define GDB_FR_FPR11 ((GDB_FR_FPR10) + 8) /* 49 */
|
86 |
|
|
#define GDB_FR_FPR12 ((GDB_FR_FPR11) + 8) /* 50 */
|
87 |
|
|
#define GDB_FR_FPR13 ((GDB_FR_FPR12) + 8) /* 51 */
|
88 |
|
|
#define GDB_FR_FPR14 ((GDB_FR_FPR13) + 8) /* 52 */
|
89 |
|
|
#define GDB_FR_FPR15 ((GDB_FR_FPR14) + 8) /* 53 */
|
90 |
|
|
#define GDB_FR_FPR16 ((GDB_FR_FPR15) + 8) /* 54 */
|
91 |
|
|
#define GDB_FR_FPR17 ((GDB_FR_FPR16) + 8) /* 55 */
|
92 |
|
|
#define GDB_FR_FPR18 ((GDB_FR_FPR17) + 8) /* 56 */
|
93 |
|
|
#define GDB_FR_FPR19 ((GDB_FR_FPR18) + 8) /* 57 */
|
94 |
|
|
#define GDB_FR_FPR20 ((GDB_FR_FPR19) + 8) /* 58 */
|
95 |
|
|
#define GDB_FR_FPR21 ((GDB_FR_FPR20) + 8) /* 59 */
|
96 |
|
|
#define GDB_FR_FPR22 ((GDB_FR_FPR21) + 8) /* 60 */
|
97 |
|
|
#define GDB_FR_FPR23 ((GDB_FR_FPR22) + 8) /* 61 */
|
98 |
|
|
#define GDB_FR_FPR24 ((GDB_FR_FPR23) + 8) /* 62 */
|
99 |
|
|
#define GDB_FR_FPR25 ((GDB_FR_FPR24) + 8) /* 63 */
|
100 |
|
|
#define GDB_FR_FPR26 ((GDB_FR_FPR25) + 8) /* 64 */
|
101 |
|
|
#define GDB_FR_FPR27 ((GDB_FR_FPR26) + 8) /* 65 */
|
102 |
|
|
#define GDB_FR_FPR28 ((GDB_FR_FPR27) + 8) /* 66 */
|
103 |
|
|
#define GDB_FR_FPR29 ((GDB_FR_FPR28) + 8) /* 67 */
|
104 |
|
|
#define GDB_FR_FPR30 ((GDB_FR_FPR29) + 8) /* 68 */
|
105 |
|
|
#define GDB_FR_FPR31 ((GDB_FR_FPR30) + 8) /* 69 */
|
106 |
|
|
|
107 |
|
|
#define GDB_FR_FSR ((GDB_FR_FPR31) + 8) /* 70 */
|
108 |
|
|
#define GDB_FR_FIR ((GDB_FR_FSR) + 8) /* 71 */
|
109 |
|
|
#define GDB_FR_FRP ((GDB_FR_FIR) + 8) /* 72 */
|
110 |
|
|
|
111 |
|
|
#define GDB_FR_DUMMY ((GDB_FR_FRP) + 8) /* 73, unused ??? */
|
112 |
|
|
|
113 |
|
|
/*
|
114 |
|
|
* Again, CP0 registers
|
115 |
|
|
*/
|
116 |
|
|
#define GDB_FR_CP0_INDEX ((GDB_FR_DUMMY) + 8) /* 74 */
|
117 |
|
|
#define GDB_FR_CP0_RANDOM ((GDB_FR_CP0_INDEX) + 8) /* 75 */
|
118 |
|
|
#define GDB_FR_CP0_ENTRYLO0 ((GDB_FR_CP0_RANDOM) + 8) /* 76 */
|
119 |
|
|
#define GDB_FR_CP0_ENTRYLO1 ((GDB_FR_CP0_ENTRYLO0) + 8) /* 77 */
|
120 |
|
|
#define GDB_FR_CP0_CONTEXT ((GDB_FR_CP0_ENTRYLO1) + 8) /* 78 */
|
121 |
|
|
#define GDB_FR_CP0_PAGEMASK ((GDB_FR_CP0_CONTEXT) + 8) /* 79 */
|
122 |
|
|
#define GDB_FR_CP0_WIRED ((GDB_FR_CP0_PAGEMASK) + 8) /* 80 */
|
123 |
|
|
#define GDB_FR_CP0_REG7 ((GDB_FR_CP0_WIRED) + 8) /* 81 */
|
124 |
|
|
#define GDB_FR_CP0_REG8 ((GDB_FR_CP0_REG7) + 8) /* 82 */
|
125 |
|
|
#define GDB_FR_CP0_REG9 ((GDB_FR_CP0_REG8) + 8) /* 83 */
|
126 |
|
|
#define GDB_FR_CP0_ENTRYHI ((GDB_FR_CP0_REG9) + 8) /* 84 */
|
127 |
|
|
#define GDB_FR_CP0_REG11 ((GDB_FR_CP0_ENTRYHI) + 8) /* 85 */
|
128 |
|
|
#define GDB_FR_CP0_REG12 ((GDB_FR_CP0_REG11) + 8) /* 86 */
|
129 |
|
|
#define GDB_FR_CP0_REG13 ((GDB_FR_CP0_REG12) + 8) /* 87 */
|
130 |
|
|
#define GDB_FR_CP0_REG14 ((GDB_FR_CP0_REG13) + 8) /* 88 */
|
131 |
|
|
#define GDB_FR_CP0_PRID ((GDB_FR_CP0_REG14) + 8) /* 89 */
|
132 |
|
|
|
133 |
|
|
#define GDB_FR_SIZE ((((GDB_FR_CP0_PRID) + 8) + (PTRSIZE-1)) & ~(PTRSIZE-1))
|
134 |
|
|
|
135 |
|
|
#ifndef __ASSEMBLY__
|
136 |
|
|
|
137 |
|
|
/*
|
138 |
|
|
* This is the same as above, but for the high-level
|
139 |
|
|
* part of the GDB stub.
|
140 |
|
|
*/
|
141 |
|
|
|
142 |
|
|
struct gdb_regs {
|
143 |
|
|
/*
|
144 |
|
|
* Pad bytes for argument save space on the stack
|
145 |
|
|
* 24/48 Bytes for 32/64 bit code
|
146 |
|
|
*/
|
147 |
|
|
unsigned long pad0[6];
|
148 |
|
|
|
149 |
|
|
/*
|
150 |
|
|
* saved main processor registers
|
151 |
|
|
*/
|
152 |
|
|
long reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7;
|
153 |
|
|
long reg8, reg9, reg10, reg11, reg12, reg13, reg14, reg15;
|
154 |
|
|
long reg16, reg17, reg18, reg19, reg20, reg21, reg22, reg23;
|
155 |
|
|
long reg24, reg25, reg26, reg27, reg28, reg29, reg30, reg31;
|
156 |
|
|
|
157 |
|
|
/*
|
158 |
|
|
* Saved special registers
|
159 |
|
|
*/
|
160 |
|
|
long cp0_status;
|
161 |
|
|
long lo;
|
162 |
|
|
long hi;
|
163 |
|
|
long cp0_badvaddr;
|
164 |
|
|
long cp0_cause;
|
165 |
|
|
long cp0_epc;
|
166 |
|
|
|
167 |
|
|
/*
|
168 |
|
|
* Saved floating point registers
|
169 |
|
|
*/
|
170 |
|
|
long fpr0, fpr1, fpr2, fpr3, fpr4, fpr5, fpr6, fpr7;
|
171 |
|
|
long fpr8, fpr9, fpr10, fpr11, fpr12, fpr13, fpr14, fpr15;
|
172 |
|
|
long fpr16, fpr17, fpr18, fpr19, fpr20, fpr21, fpr22, fpr23;
|
173 |
|
|
long fpr24, fpr25, fpr26, fpr27, fpr28, fpr29, fpr30, fpr31;
|
174 |
|
|
|
175 |
|
|
long cp1_fsr;
|
176 |
|
|
long cp1_fir;
|
177 |
|
|
|
178 |
|
|
/*
|
179 |
|
|
* Frame pointer
|
180 |
|
|
*/
|
181 |
|
|
long frame_ptr;
|
182 |
|
|
long dummy; /* unused */
|
183 |
|
|
|
184 |
|
|
/*
|
185 |
|
|
* saved cp0 registers
|
186 |
|
|
*/
|
187 |
|
|
long cp0_index;
|
188 |
|
|
long cp0_random;
|
189 |
|
|
long cp0_entrylo0;
|
190 |
|
|
long cp0_entrylo1;
|
191 |
|
|
long cp0_context;
|
192 |
|
|
long cp0_pagemask;
|
193 |
|
|
long cp0_wired;
|
194 |
|
|
long cp0_reg7;
|
195 |
|
|
long cp0_reg8;
|
196 |
|
|
long cp0_reg9;
|
197 |
|
|
long cp0_entryhi;
|
198 |
|
|
long cp0_reg11;
|
199 |
|
|
long cp0_reg12;
|
200 |
|
|
long cp0_reg13;
|
201 |
|
|
long cp0_reg14;
|
202 |
|
|
long cp0_prid;
|
203 |
|
|
};
|
204 |
|
|
|
205 |
|
|
/*
|
206 |
|
|
* Prototypes
|
207 |
|
|
*/
|
208 |
|
|
|
209 |
|
|
void set_debug_traps(void);
|
210 |
|
|
void set_async_breakpoint(unsigned long *epc);
|
211 |
|
|
|
212 |
|
|
#endif /* !__ASSEMBLY__ */
|
213 |
|
|
#endif /* __ASM_MIPS_GDB_STUB_H */
|