34e03b1532b586ced53180b509b155084c4412fb
1 /* Target machine definitions for GDB on a Sequent Symmetry under dynix 3.0,
2 with Weitek 1167 and i387 support.
3 Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
4 Symmetry version by Jay Vosburgh (fubar@sequent.com).
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
22 /* I don't know if this will work for cross-debugging, even if you do get
23 a copy of the right include file. */
29 #include <machine/reg.h>
34 #define SDB_REG_TO_REGNUM(value) ptx_coff_regno_to_gdb(value)
35 extern int ptx_coff_regno_to_gdb();
37 #endif /* _SEQUENT_ */
39 #define START_INFERIOR_TRAPS_EXPECTED 2
41 /* Amount PC must be decremented by after a breakpoint.
42 This is often the number of bytes in BREAKPOINT
45 #define DECR_PC_AFTER_BREAK 0
47 #include "i386/tm-i386v.h"
49 /* Nonzero if instruction at PC is a return instruction. */
50 /* For Symmetry, this is really the 'leave' instruction, which */
51 /* is right before the ret */
53 #undef ABOUT_TO_RETURN
54 #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0xc9)
57 /* --- this code can't be used unless we know we are running native,
58 since it uses host specific ptrace calls. */
59 /* code for 80387 fpu. Functions are from i386-dep.c, copied into
62 #define FLOAT_INFO { i386_float_info(); }
65 /* Number of machine registers */
69 /* Initializer for an array of names of registers.
70 There should be NUM_REGS strings in this initializer. */
72 /* Symmetry registers are in this weird order to match the register
73 numbers in the symbol table entries. If you change the order,
74 things will probably break mysteriously for no apparent reason.
75 Also note that the st(0)...st(7) 387 registers are represented as
79 #define REGISTER_NAMES { "eax", "edx", "ecx", "st0", "st1", \
80 "ebx", "esi", "edi", "st2", "st3", \
81 "st4", "st5", "st6", "st7", "esp", \
82 "ebp", "eip", "eflags", "fp1", "fp2", \
83 "fp3", "fp4", "fp5", "fp6", "fp7", \
84 "fp8", "fp9", "fp10", "fp11", "fp12", \
85 "fp13", "fp14", "fp15", "fp16", "fp17", \
86 "fp18", "fp19", "fp20", "fp21", "fp22", \
87 "fp23", "fp24", "fp25", "fp26", "fp27", \
88 "fp28", "fp29", "fp30", "fp31" }
90 /* Register numbers of various important registers.
91 Note that some of these values are "real" register numbers,
92 and correspond to the general registers of the machine,
93 and some are "phony" register numbers which are too large
94 to be actual register numbers as far as the user is concerned
95 but do serve to get the desired values when passed to read_register. */
108 #define ST4_REGNUM 10
109 #define ST5_REGNUM 11
110 #define ST6_REGNUM 12
111 #define ST7_REGNUM 13
113 #define FP1_REGNUM 18 /* first 1167 register */
114 /* Get %fp2 - %fp31 by addition, since they are contiguous */
117 #define SP_REGNUM 14 /* esp--Contains address of top of stack */
118 #define ESP_REGNUM 14
120 #define FP_REGNUM 15 /* ebp--Contains address of executing stack frame */
121 #define EBP_REGNUM 15
123 #define PC_REGNUM 16 /* eip--Contains program counter */
124 #define EIP_REGNUM 16
126 #define PS_REGNUM 17 /* eflags--Contains processor status */
127 #define EFLAGS_REGNUM 17
130 /* dynix, not ptx. For ptx, see register_addr in symm-tdep.c */
132 /* The magic numbers below are offsets into u_ar0 in the user struct.
133 * They live in <machine/reg.h>. Gdb calls this macro with blockend
134 * holding u.u_ar0 - KERNEL_U_ADDR. Only the registers listed are
135 * saved in the u area (along with a few others that aren't useful
136 * here. See <machine/reg.h>).
139 #define REGISTER_U_ADDR(addr, blockend, regno) \
140 { struct user foo; /* needed for finding fpu regs */ \
143 addr = blockend + EAX * sizeof(int); break; \
145 addr = blockend + EDX * sizeof(int); break; \
147 addr = blockend + ECX * sizeof(int); break; \
148 case 3: /* st(0) */ \
150 ((int)&foo.u_fpusave.fpu_stack[0][0] - (int)&foo); \
152 case 4: /* st(1) */ \
154 ((int) &foo.u_fpusave.fpu_stack[1][0] - (int)&foo); \
157 addr = blockend + EBX * sizeof(int); break; \
159 addr = blockend + ESI * sizeof(int); break; \
161 addr = blockend + EDI * sizeof(int); break; \
162 case 8: /* st(2) */ \
164 ((int) &foo.u_fpusave.fpu_stack[2][0] - (int)&foo); \
166 case 9: /* st(3) */ \
168 ((int) &foo.u_fpusave.fpu_stack[3][0] - (int)&foo); \
170 case 10: /* st(4) */ \
172 ((int) &foo.u_fpusave.fpu_stack[4][0] - (int)&foo); \
174 case 11: /* st(5) */ \
176 ((int) &foo.u_fpusave.fpu_stack[5][0] - (int)&foo); \
178 case 12: /* st(6) */ \
180 ((int) &foo.u_fpusave.fpu_stack[6][0] - (int)&foo); \
182 case 13: /* st(7) */ \
184 ((int) &foo.u_fpusave.fpu_stack[7][0] - (int)&foo); \
187 addr = blockend + ESP * sizeof(int); break; \
189 addr = blockend + EBP * sizeof(int); break; \
191 addr = blockend + EIP * sizeof(int); break; \
193 addr = blockend + FLAGS * sizeof(int); break; \
203 case 27: /* fp10 */ \
204 case 28: /* fp11 */ \
205 case 29: /* fp12 */ \
206 case 30: /* fp13 */ \
207 case 31: /* fp14 */ \
208 case 32: /* fp15 */ \
209 case 33: /* fp16 */ \
210 case 34: /* fp17 */ \
211 case 35: /* fp18 */ \
212 case 36: /* fp19 */ \
213 case 37: /* fp20 */ \
214 case 38: /* fp21 */ \
215 case 39: /* fp22 */ \
216 case 40: /* fp23 */ \
217 case 41: /* fp24 */ \
218 case 42: /* fp25 */ \
219 case 43: /* fp26 */ \
220 case 44: /* fp27 */ \
221 case 45: /* fp28 */ \
222 case 46: /* fp29 */ \
223 case 47: /* fp30 */ \
224 case 48: /* fp31 */ \
226 ((int) &foo.u_fpasave.fpa_regs[(regno)-18] - (int)&foo); \
229 #endif /* not _SEQUENT_ */
232 /* ptx. For Dynix, see above */
235 * For ptx, this is a little bit bizarre, since the register block
236 * is below the u area in memory. This means that blockend here ends
237 * up being negative (for the call from coredep.c) since the value in
238 * u.u_ar0 will be less than KERNEL_U_ADDR (and coredep.c passes us
239 * u.u_ar0 - KERNEL_U_ADDR in blockend). Since we also define
240 * FETCH_INFERIOR_REGISTERS (and supply our own functions for that),
241 * the core file case will be the only use of this function.
244 #define REGISTER_U_ADDR(addr, blockend, regno) \
245 { struct user foo; /* needed for finding fpu regs */ \
248 addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (EAX * sizeof(int)); break; \
250 addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (EDX * sizeof(int)); break; \
252 addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (ECX * sizeof(int)); break; \
253 case 3: /* st(0) */ \
254 addr = blockend - KERNEL_U_ADDR + \
255 ((int)&foo.u_fpusave.fpu_stack[0][0] - (int)&foo); \
257 case 4: /* st(1) */ \
258 addr = blockend - KERNEL_U_ADDR + \
259 ((int) &foo.u_fpusave.fpu_stack[1][0] - (int)&foo); \
262 addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (EBX * sizeof(int)); break; \
264 addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (ESI * sizeof(int)); break; \
266 addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (EDI * sizeof(int)); break; \
267 case 8: /* st(2) */ \
268 addr = blockend - KERNEL_U_ADDR + \
269 ((int) &foo.u_fpusave.fpu_stack[2][0] - (int)&foo); \
271 case 9: /* st(3) */ \
272 addr = blockend - KERNEL_U_ADDR + \
273 ((int) &foo.u_fpusave.fpu_stack[3][0] - (int)&foo); \
275 case 10: /* st(4) */ \
276 addr = blockend - KERNEL_U_ADDR + \
277 ((int) &foo.u_fpusave.fpu_stack[4][0] - (int)&foo); \
279 case 11: /* st(5) */ \
280 addr = blockend - KERNEL_U_ADDR + \
281 ((int) &foo.u_fpusave.fpu_stack[5][0] - (int)&foo); \
283 case 12: /* st(6) */ \
284 addr = blockend - KERNEL_U_ADDR + \
285 ((int) &foo.u_fpusave.fpu_stack[6][0] - (int)&foo); \
287 case 13: /* st(7) */ \
288 addr = blockend - KERNEL_U_ADDR + \
289 ((int) &foo.u_fpusave.fpu_stack[7][0] - (int)&foo); \
292 addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (ESP * sizeof(int)); break; \
294 addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (EBP * sizeof(int)); break; \
296 addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (EIP * sizeof(int)); break; \
298 addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (FLAGS * sizeof(int)); break; \
308 case 27: /* fp10 */ \
309 case 28: /* fp11 */ \
310 case 29: /* fp12 */ \
311 case 30: /* fp13 */ \
312 case 31: /* fp14 */ \
313 case 32: /* fp15 */ \
314 case 33: /* fp16 */ \
315 case 34: /* fp17 */ \
316 case 35: /* fp18 */ \
317 case 36: /* fp19 */ \
318 case 37: /* fp20 */ \
319 case 38: /* fp21 */ \
320 case 39: /* fp22 */ \
321 case 40: /* fp23 */ \
322 case 41: /* fp24 */ \
323 case 42: /* fp25 */ \
324 case 43: /* fp26 */ \
325 case 44: /* fp27 */ \
326 case 45: /* fp28 */ \
327 case 46: /* fp29 */ \
328 case 47: /* fp30 */ \
329 case 48: /* fp31 */ \
330 addr = blockend - KERNEL_U_ADDR + \
331 ((int) &foo.u_fpasave.fpa_regs[(regno)-18] - (int)&foo); \
334 #endif /* _SEQUENT_ */
337 #define FRAME_CHAIN(thisframe) ((thisframe)->pc == 0 ? \
338 0 : read_memory_integer((thisframe)->frame, 4))
340 #define FRAME_CHAIN_VALID(chain, thisframe) \
343 #undef FRAME_ARGS_SKIP
344 #define FRAME_ARGS_SKIP 0
346 /* Total amount of space needed to store our copies of the machine's
347 register state, the array `registers'. */
348 /* 10 i386 registers, 8 i387 registers, and 31 Weitek 1167 registers */
349 #undef REGISTER_BYTES
350 #define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4))
352 /* Index within `registers' of the first byte of the space for
356 #define REGISTER_BYTE(N) \
357 ((N < 3) ? (N * 4) : \
358 (N < 5) ? (((N - 2) * 10) + 2) : \
359 (N < 8) ? (((N - 5) * 4) + 32) : \
360 (N < 14) ? (((N - 8) * 10) + 44) : \
361 (((N - 14) * 4) + 104))
363 /* Number of bytes of storage in the actual machine representation
364 * for register N. All registers are 4 bytes, except 387 st(0) - st(7),
365 * which are 80 bits each.
368 #undef REGISTER_RAW_SIZE
369 #define REGISTER_RAW_SIZE(N) \
376 /* Largest value REGISTER_RAW_SIZE can have. */
378 #undef MAX_REGISTER_RAW_SIZE
379 #define MAX_REGISTER_RAW_SIZE 10
381 /* Nonzero if register N requires conversion
382 from raw format to virtual format. */
384 #undef REGISTER_CONVERTIBLE
385 #define REGISTER_CONVERTIBLE(N) \
392 /* Convert data from raw format for register REGNUM in buffer FROM
393 to virtual format with type TYPE in buffer TO. */
395 #undef REGISTER_CONVERT_TO_VIRTUAL
396 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
399 i387_to_double ((FROM), (char *)&val); \
400 store_floating ((TO), TYPE_LENGTH (TYPE), val); \
403 i387_to_double
PARAMS ((char *, char *));
405 /* Convert data from virtual format with type TYPE in buffer FROM
406 to raw format for register REGNUM in buffer TO. */
408 #undef REGISTER_CONVERT_TO_RAW
409 #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
411 double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
412 double_to_i387((char *)&val, (TO)); \
415 double_to_i387
PARAMS ((char *, char *));
417 /* Return the GDB type object for the "standard" data type
418 of data in register N. */
420 #undef REGISTER_VIRTUAL_TYPE
421 #define REGISTER_VIRTUAL_TYPE(N) \
422 ((N < 3) ? builtin_type_int : \
423 (N < 5) ? builtin_type_double : \
424 (N < 8) ? builtin_type_int : \
425 (N < 14) ? builtin_type_double : \
428 /* from m-i386.h (now known as tm-i386v.h). */
429 /* Store the address of the place in which to copy the structure the
430 subroutine will return. This is called from call_function. FIXME:
431 Why is it writing register 0? Is the symmetry different from tm-i386v.h,
432 or is it some sort of artifact? FIXME. */
434 #undef STORE_STRUCT_RETURN
435 #define STORE_STRUCT_RETURN(ADDR, SP) \
436 { (SP) -= sizeof (ADDR); \
437 write_memory ((SP), (char *) &(ADDR), sizeof (ADDR)); \
438 write_register(0, (ADDR)); }
440 /* Extract from an array REGBUF containing the (raw) register state
441 a function return value of type TYPE, and copy that, in virtual format,
444 #undef EXTRACT_RETURN_VALUE
445 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
446 symmetry_extract_return_value(TYPE, REGBUF, VALBUF)
450 print_387_control_word
PARAMS ((unsigned int));
453 print_387_status_word
PARAMS ((unsigned int));
This page took 0.037898 seconds and 3 git commands to generate.