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.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
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.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
21 /* Symmetry version by Jay Vosburgh (uunet!sequent!fubar) */
23 /* This machine doesn't have the siginterrupt call. */
24 #define NO_SIGINTERRUPT
26 #define HAVE_WAIT_STRUCT
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 */
33 #define HOST_BYTE_ORDER LITTLE_ENDIAN
35 /* Get rid of any system-imposed stack limit if possible. */
37 #define SET_STACK_LIMIT_HUGE
39 /* This is the amount to subtract from u.u_ar0
40 to get the offset in the core file of the register values. */
42 #define KERNEL_U_ADDR (0x80000000 - (UPAGES * NBPG))
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>). */
50 #define REGISTER_U_ADDR(addr, blockend, regno) \
51 { struct user foo; /* needed for finding fpu regs */ \
54 addr = blockend + EAX * sizeof(int); break; \
56 addr = blockend + EDX * sizeof(int); break; \
58 addr = blockend + ECX * sizeof(int); break; \
61 ((int)&foo.u_fpusave.fpu_stack[0][0] - (int)&foo); \
65 ((int) &foo.u_fpusave.fpu_stack[1][0] - (int)&foo); \
68 addr = blockend + EBX * sizeof(int); break; \
70 addr = blockend + ESI * sizeof(int); break; \
72 addr = blockend + EDI * sizeof(int); break; \
75 ((int) &foo.u_fpusave.fpu_stack[2][0] - (int)&foo); \
79 ((int) &foo.u_fpusave.fpu_stack[3][0] - (int)&foo); \
81 case 10: /* st(4) */ \
83 ((int) &foo.u_fpusave.fpu_stack[4][0] - (int)&foo); \
85 case 11: /* st(5) */ \
87 ((int) &foo.u_fpusave.fpu_stack[5][0] - (int)&foo); \
89 case 12: /* st(6) */ \
91 ((int) &foo.u_fpusave.fpu_stack[6][0] - (int)&foo); \
93 case 13: /* st(7) */ \
95 ((int) &foo.u_fpusave.fpu_stack[7][0] - (int)&foo); \
98 addr = blockend + ESP * sizeof(int); break; \
100 addr = blockend + EBP * sizeof(int); break; \
102 addr = blockend + EIP * sizeof(int); break; \
104 addr = blockend + FLAGS * sizeof(int); break; \
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 */ \
137 ((int) &foo.u_fpasave.fpa_regs[(regno)-18] - (int)&foo); \
141 /* Compensate for lack of `vprintf' function. */
143 #define MISSING_VPRINTF
145 /* Override copies of {fetch,store}_inferior_registers in infptrace.c. */
147 #define FETCH_INFERIOR_REGISTERS
149 /* We must fetch all the regs before storing, since we store all at once. */
151 #define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES)
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. */
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}
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. */
172 #define INIT_STACK(beg, end) \
173 { asm (".globl end"); \
174 asm ("movl $ end, %esp"); \
175 asm ("movl %ebp, $0"); }
177 /* Push the frame pointer register on the stack. */
178 #define PUSH_FRAME_PTR \
181 /* Copy the top-of-stack to the frame pointer register. */
182 #define POP_FRAME_PTR \
183 asm ("movl (%esp), %ebp");
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. */
190 #define PUSH_REGISTERS \
193 { asm("pushl %eax"); \
196 asm("pushl %st(0)"); \
197 asm("pushl %st(1)"); \
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)"); \
210 asm("pushl %eflags"); \
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"); \
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. */
248 #define POP_REGISTERS \