]>
Commit | Line | Data |
---|---|---|
dd3b648e RP |
1 | /* Definitions to make GDB run on a Sequent Symmetry under dynix 3.0, |
2 | with Weitek 1167 and i387 support. | |
3 | Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc. | |
4 | ||
5 | This file is part of GDB. | |
6 | ||
99a7de40 | 7 | This program is free software; you can redistribute it and/or modify |
dd3b648e | 8 | it under the terms of the GNU General Public License as published by |
99a7de40 JG |
9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | |
dd3b648e | 11 | |
99a7de40 | 12 | This program is distributed in the hope that it will be useful, |
dd3b648e RP |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
99a7de40 JG |
18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
dd3b648e RP |
20 | |
21 | /* Symmetry version by Jay Vosburgh (uunet!sequent!fubar) */ | |
22 | ||
23 | /* This machine doesn't have the siginterrupt call. */ | |
24 | #define NO_SIGINTERRUPT | |
25 | ||
26 | #define HAVE_WAIT_STRUCT | |
27 | ||
28 | /* XPT_DEBUG doesn't work yet under Dynix 3.0.12, but UNDEBUG does... */ | |
29 | /* #define PTRACE_ATTACH XPT_DEBUG | |
30 | #define PTRACE_DETACH XPT_UNDEBUG | |
31 | #define ATTACH_DETACH */ | |
32 | ||
33 | #define HOST_BYTE_ORDER LITTLE_ENDIAN | |
34 | ||
35 | /* Get rid of any system-imposed stack limit if possible. */ | |
36 | ||
37 | #define SET_STACK_LIMIT_HUGE | |
38 | ||
39 | /* This is the amount to subtract from u.u_ar0 | |
40 | to get the offset in the core file of the register values. */ | |
41 | ||
42 | #define KERNEL_U_ADDR (0x80000000 - (UPAGES * NBPG)) | |
43 | ||
df6335e1 JG |
44 | /* The magic numbers below are offsets into u_ar0 in the user struct. |
45 | They live in <machine/reg.h>. Gdb calls this macro with blockend | |
46 | holding u.u_ar0 - KERNEL_U_ADDR. Only the registers listed are | |
47 | saved in the u area (along with a few others that aren't useful | |
48 | here. See <machine/reg.h>). */ | |
49 | ||
50 | #define REGISTER_U_ADDR(addr, blockend, regno) \ | |
51 | { struct user foo; /* needed for finding fpu regs */ \ | |
52 | switch (regno) { \ | |
53 | case 0: \ | |
54 | addr = blockend + EAX * sizeof(int); break; \ | |
55 | case 1: \ | |
56 | addr = blockend + EDX * sizeof(int); break; \ | |
57 | case 2: \ | |
58 | addr = blockend + ECX * sizeof(int); break; \ | |
59 | case 3: /* st(0) */ \ | |
60 | addr = blockend - \ | |
61 | ((int)&foo.u_fpusave.fpu_stack[0][0] - (int)&foo); \ | |
62 | break; \ | |
63 | case 4: /* st(1) */ \ | |
64 | addr = blockend - \ | |
65 | ((int) &foo.u_fpusave.fpu_stack[1][0] - (int)&foo); \ | |
66 | break; \ | |
67 | case 5: \ | |
68 | addr = blockend + EBX * sizeof(int); break; \ | |
69 | case 6: \ | |
70 | addr = blockend + ESI * sizeof(int); break; \ | |
71 | case 7: \ | |
72 | addr = blockend + EDI * sizeof(int); break; \ | |
73 | case 8: /* st(2) */ \ | |
74 | addr = blockend - \ | |
75 | ((int) &foo.u_fpusave.fpu_stack[2][0] - (int)&foo); \ | |
76 | break; \ | |
77 | case 9: /* st(3) */ \ | |
78 | addr = blockend - \ | |
79 | ((int) &foo.u_fpusave.fpu_stack[3][0] - (int)&foo); \ | |
80 | break; \ | |
81 | case 10: /* st(4) */ \ | |
82 | addr = blockend - \ | |
83 | ((int) &foo.u_fpusave.fpu_stack[4][0] - (int)&foo); \ | |
84 | break; \ | |
85 | case 11: /* st(5) */ \ | |
86 | addr = blockend - \ | |
87 | ((int) &foo.u_fpusave.fpu_stack[5][0] - (int)&foo); \ | |
88 | break; \ | |
89 | case 12: /* st(6) */ \ | |
90 | addr = blockend - \ | |
91 | ((int) &foo.u_fpusave.fpu_stack[6][0] - (int)&foo); \ | |
92 | break; \ | |
93 | case 13: /* st(7) */ \ | |
94 | addr = blockend - \ | |
95 | ((int) &foo.u_fpusave.fpu_stack[7][0] - (int)&foo); \ | |
96 | break; \ | |
97 | case 14: \ | |
98 | addr = blockend + ESP * sizeof(int); break; \ | |
99 | case 15: \ | |
100 | addr = blockend + EBP * sizeof(int); break; \ | |
101 | case 16: \ | |
102 | addr = blockend + EIP * sizeof(int); break; \ | |
103 | case 17: \ | |
104 | addr = blockend + FLAGS * sizeof(int); break; \ | |
105 | case 18: /* fp1 */ \ | |
106 | case 19: /* fp2 */ \ | |
107 | case 20: /* fp3 */ \ | |
108 | case 21: /* fp4 */ \ | |
109 | case 22: /* fp5 */ \ | |
110 | case 23: /* fp6 */ \ | |
111 | case 24: /* fp7 */ \ | |
112 | case 25: /* fp8 */ \ | |
113 | case 26: /* fp9 */ \ | |
114 | case 27: /* fp10 */ \ | |
115 | case 28: /* fp11 */ \ | |
116 | case 29: /* fp12 */ \ | |
117 | case 30: /* fp13 */ \ | |
118 | case 31: /* fp14 */ \ | |
119 | case 32: /* fp15 */ \ | |
120 | case 33: /* fp16 */ \ | |
121 | case 34: /* fp17 */ \ | |
122 | case 35: /* fp18 */ \ | |
123 | case 36: /* fp19 */ \ | |
124 | case 37: /* fp20 */ \ | |
125 | case 38: /* fp21 */ \ | |
126 | case 39: /* fp22 */ \ | |
127 | case 40: /* fp23 */ \ | |
128 | case 41: /* fp24 */ \ | |
129 | case 42: /* fp25 */ \ | |
130 | case 43: /* fp26 */ \ | |
131 | case 44: /* fp27 */ \ | |
132 | case 45: /* fp28 */ \ | |
133 | case 46: /* fp29 */ \ | |
134 | case 47: /* fp30 */ \ | |
135 | case 48: /* fp31 */ \ | |
136 | addr = blockend - \ | |
137 | ((int) &foo.u_fpasave.fpa_regs[(regno)-18] - (int)&foo); \ | |
138 | } \ | |
139 | } | |
140 | ||
dd3b648e RP |
141 | /* Compensate for lack of `vprintf' function. */ |
142 | ||
143 | #define MISSING_VPRINTF | |
144 | ||
145 | /* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ | |
146 | ||
147 | #define FETCH_INFERIOR_REGISTERS | |
148 | ||
149 | /* We must fetch all the regs before storing, since we store all at once. */ | |
150 | ||
151 | #define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES) | |
152 | \f | |
153 | /* Interface definitions for kernel debugger KDB. */ | |
154 | /* This doesn't work... */ | |
155 | /* Map machine fault codes into signal numbers. | |
156 | First subtract 0, divide by 4, then index in a table. | |
157 | Faults for which the entry in this table is 0 | |
158 | are not handled by KDB; the program's own trap handler | |
159 | gets to handle then. */ | |
160 | ||
161 | #define FAULT_CODE_ORIGIN 0 | |
162 | #define FAULT_CODE_UNITS 4 | |
163 | #define FAULT_TABLE \ | |
164 | { 0, SIGKILL, SIGSEGV, 0, 0, 0, 0, 0, \ | |
165 | 0, 0, SIGTRAP, SIGTRAP, 0, 0, 0, 0, \ | |
166 | 0, 0, 0, 0, 0, 0, 0, 0} | |
167 | ||
168 | /* Start running with a stack stretching from BEG to END. | |
169 | BEG and END should be symbols meaningful to the assembler. | |
170 | This is used only for kdb. */ | |
171 | ||
172 | #define INIT_STACK(beg, end) \ | |
173 | { asm (".globl end"); \ | |
174 | asm ("movl $ end, %esp"); \ | |
175 | asm ("movl %ebp, $0"); } | |
176 | ||
177 | /* Push the frame pointer register on the stack. */ | |
178 | #define PUSH_FRAME_PTR \ | |
179 | asm ("pushl %ebp"); | |
180 | ||
181 | /* Copy the top-of-stack to the frame pointer register. */ | |
182 | #define POP_FRAME_PTR \ | |
183 | asm ("movl (%esp), %ebp"); | |
184 | ||
185 | /* After KDB is entered by a fault, push all registers | |
186 | that GDB thinks about (all NUM_REGS of them), | |
187 | so that they appear in order of ascending GDB register number. | |
188 | The fault code will be on the stack beyond the last register. */ | |
189 | ||
190 | #define PUSH_REGISTERS \ | |
191 | { asm("pushad"); } | |
192 | /* | |
193 | { asm("pushl %eax"); \ | |
194 | asm("pushl %edx"); \ | |
195 | asm("pushl %ecx"); \ | |
196 | asm("pushl %st(0)"); \ | |
197 | asm("pushl %st(1)"); \ | |
198 | asm("pushl %ebx"); \ | |
199 | asm("pushl %esi"); \ | |
200 | asm("pushl %edi"); \ | |
201 | asm("pushl %st(2)"); \ | |
202 | asm("pushl %st(3)"); \ | |
203 | asm("pushl %st(4)"); \ | |
204 | asm("pushl %st(5)"); \ | |
205 | asm("pushl %st(6)"); \ | |
206 | asm("pushl %st(7)"); \ | |
207 | asm("pushl %esp"); \ | |
208 | asm("pushl %ebp"); \ | |
209 | asm("pushl %eip"); \ | |
210 | asm("pushl %eflags"); \ | |
211 | asm("pushl %fp1"); \ | |
212 | asm("pushl %fp2"); \ | |
213 | asm("pushl %fp3"); \ | |
214 | asm("pushl %fp4"); \ | |
215 | asm("pushl %fp5"); \ | |
216 | asm("pushl %fp6"); \ | |
217 | asm("pushl %fp7"); \ | |
218 | asm("pushl %fp8"); \ | |
219 | asm("pushl %fp9"); \ | |
220 | asm("pushl %fp10"); \ | |
221 | asm("pushl %fp11"); \ | |
222 | asm("pushl %fp12"); \ | |
223 | asm("pushl %fp13"); \ | |
224 | asm("pushl %fp14"); \ | |
225 | asm("pushl %fp15"); \ | |
226 | asm("pushl %fp16"); \ | |
227 | asm("pushl %fp17"); \ | |
228 | asm("pushl %fp18"); \ | |
229 | asm("pushl %fp19"); \ | |
230 | asm("pushl %fp20"); \ | |
231 | asm("pushl %fp21"); \ | |
232 | asm("pushl %fp22"); \ | |
233 | asm("pushl %fp23"); \ | |
234 | asm("pushl %fp24"); \ | |
235 | asm("pushl %fp25"); \ | |
236 | asm("pushl %fp26"); \ | |
237 | asm("pushl %fp27"); \ | |
238 | asm("pushl %fp28"); \ | |
239 | asm("pushl %fp29"); \ | |
240 | asm("pushl %fp30"); \ | |
241 | asm("pushl %fp31"); \ | |
242 | } | |
243 | */ | |
244 | /* Assuming the registers (including processor status) have been | |
245 | pushed on the stack in order of ascending GDB register number, | |
246 | restore them and return to the address in the saved PC register. */ | |
247 | ||
248 | #define POP_REGISTERS \ | |
249 | { asm ("popad"); } |