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();
36 #endif /* _SEQUENT_ */
38 #define START_INFERIOR_TRAPS_EXPECTED 2
40 /* Amount PC must be decremented by after a breakpoint.
41 This is often the number of bytes in BREAKPOINT
44 #define DECR_PC_AFTER_BREAK 0
46 #include "i386/tm-i386v.h"
48 /* Nonzero if instruction at PC is a return instruction. */
49 /* For Symmetry, this is really the 'leave' instruction, which */
50 /* is right before the ret */
53 #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0xc9)
56 --- this code can
't be used unless we know we are running native,
57 since it uses host specific ptrace calls.
58 /* code for 80387 fpu. Functions are from i386-dep.c, copied into
61 #define FLOAT_INFO { i386_float_info(); }
64 /* Number of machine registers */
68 /* Initializer for an array of names of registers.
69 There should be NUM_REGS strings in this initializer. */
71 /* Symmetry registers are in this weird order to match the register
72 numbers in the symbol table entries. If you change the order,
73 things will probably break mysteriously for no apparent reason.
74 Also note that the st(0)...st(7) 387 registers are represented as
78 #define REGISTER_NAMES { "eax", "edx", "ecx", "st0", "st1", \
79 "ebx", "esi", "edi", "st2", "st3", \
80 "st4", "st5", "st6", "st7", "esp", \
81 "ebp", "eip", "eflags", "fp1", "fp2", \
82 "fp3", "fp4", "fp5", "fp6", "fp7", \
83 "fp8", "fp9", "fp10", "fp11", "fp12", \
84 "fp13", "fp14", "fp15", "fp16", "fp17", \
85 "fp18", "fp19", "fp20", "fp21", "fp22", \
86 "fp23", "fp24", "fp25", "fp26", "fp27", \
87 "fp28", "fp29", "fp30", "fp31" }
89 /* Register numbers of various important registers.
90 Note that some of these values are "real" register numbers,
91 and correspond to the general registers of the machine,
92 and some are "phony" register numbers which are too large
93 to be actual register numbers as far as the user is concerned
94 but do serve to get the desired values when passed to read_register. */
107 #define ST4_REGNUM 10
108 #define ST5_REGNUM 11
109 #define ST6_REGNUM 12
110 #define ST7_REGNUM 13
112 #define FP1_REGNUM 18 /* first 1167 register */
113 /* Get %fp2 - %fp31 by addition, since they are contiguous */
116 #define SP_REGNUM 14 /* Contains address of top of stack */
118 #define FP_REGNUM 15 /* Contains address of executing stack frame */
120 #define PC_REGNUM 16 /* Contains program counter */
122 #define PS_REGNUM 17 /* Contains processor status */
125 /* dynix, not ptx. For ptx, see register_addr in symm-tdep.c */
127 /* The magic numbers below are offsets into u_ar0 in the user struct.
128 * They live in <machine/reg.h>. Gdb calls this macro with blockend
129 * holding u.u_ar0 - KERNEL_U_ADDR. Only the registers listed are
130 * saved in the u area (along with a few others that aren't useful
131 * here
. See
<machine
/reg
.h
>).
134 #define REGISTER_U_ADDR(addr, blockend, regno) \
135 { struct user foo; /* needed for finding fpu regs */ \
138 addr = blockend + EAX * sizeof(int); break; \
140 addr = blockend + EDX * sizeof(int); break; \
142 addr = blockend + ECX * sizeof(int); break; \
143 case 3: /* st(0) */ \
145 ((int)&foo.u_fpusave.fpu_stack[0][0] - (int)&foo); \
147 case 4: /* st(1) */ \
149 ((int) &foo.u_fpusave.fpu_stack[1][0] - (int)&foo); \
152 addr = blockend + EBX * sizeof(int); break; \
154 addr = blockend + ESI * sizeof(int); break; \
156 addr = blockend + EDI * sizeof(int); break; \
157 case 8: /* st(2) */ \
159 ((int) &foo.u_fpusave.fpu_stack[2][0] - (int)&foo); \
161 case 9: /* st(3) */ \
163 ((int) &foo.u_fpusave.fpu_stack[3][0] - (int)&foo); \
165 case 10: /* st(4) */ \
167 ((int) &foo.u_fpusave.fpu_stack[4][0] - (int)&foo); \
169 case 11: /* st(5) */ \
171 ((int) &foo.u_fpusave.fpu_stack[5][0] - (int)&foo); \
173 case 12: /* st(6) */ \
175 ((int) &foo.u_fpusave.fpu_stack[6][0] - (int)&foo); \
177 case 13: /* st(7) */ \
179 ((int) &foo.u_fpusave.fpu_stack[7][0] - (int)&foo); \
182 addr = blockend + ESP * sizeof(int); break; \
184 addr = blockend + EBP * sizeof(int); break; \
186 addr = blockend + EIP * sizeof(int); break; \
188 addr = blockend + FLAGS * sizeof(int); break; \
198 case 27: /* fp10 */ \
199 case 28: /* fp11 */ \
200 case 29: /* fp12 */ \
201 case 30: /* fp13 */ \
202 case 31: /* fp14 */ \
203 case 32: /* fp15 */ \
204 case 33: /* fp16 */ \
205 case 34: /* fp17 */ \
206 case 35: /* fp18 */ \
207 case 36: /* fp19 */ \
208 case 37: /* fp20 */ \
209 case 38: /* fp21 */ \
210 case 39: /* fp22 */ \
211 case 40: /* fp23 */ \
212 case 41: /* fp24 */ \
213 case 42: /* fp25 */ \
214 case 43: /* fp26 */ \
215 case 44: /* fp27 */ \
216 case 45: /* fp28 */ \
217 case 46: /* fp29 */ \
218 case 47: /* fp30 */ \
219 case 48: /* fp31 */ \
221 ((int) &foo.u_fpasave.fpa_regs[(regno)-18] - (int)&foo); \
224 #endif /* _SEQUENT_ */
226 /* Total amount of space needed to store our copies of the machine's
227 register state, the array `registers'. */
228 /* 10 i386 registers, 8 i387 registers, and 31 Weitek 1167 registers */
229 #undef REGISTER_BYTES
230 #define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4))
232 /* Index within `registers' of the first byte of the space for
236 #define REGISTER_BYTE(N) \
237 ((N < 3) ? (N * 4) : \
238 (N < 5) ? (((N - 2) * 10) + 2) : \
239 (N < 8) ? (((N - 5) * 4) + 32) : \
240 (N < 14) ? (((N - 8) * 10) + 44) : \
241 (((N - 14) * 4) + 104))
243 /* Number of bytes of storage in the actual machine representation
244 * for register N. All registers are 4 bytes, except 387 st(0) - st(7),
245 * which are 80 bits each.
248 #undef REGISTER_RAW_SIZE
249 #define REGISTER_RAW_SIZE(N) \
256 /* Largest value REGISTER_RAW_SIZE can have. */
258 #undef MAX_REGISTER_RAW_SIZE
259 #define MAX_REGISTER_RAW_SIZE 10
261 /* Nonzero if register N requires conversion
262 from raw format to virtual format. */
264 #undef REGISTER_CONVERTIBLE
265 #define REGISTER_CONVERTIBLE(N) \
272 /* Convert data from raw format for register REGNUM in buffer FROM
273 to virtual format with type TYPE in buffer TO. */
275 #undef REGISTER_CONVERT_TO_VIRTUAL
276 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
279 i387_to_double ((FROM), (char *)&val); \
280 store_floating ((TO), TYPE_LENGTH (TYPE), val); \
283 i387_to_double
PARAMS ((char *, char *));
285 /* Convert data from virtual format with type TYPE in buffer FROM
286 to raw format for register REGNUM in buffer TO. */
288 #undef REGISTER_CONVERT_TO_RAW
289 #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
291 double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
292 double_to_i387((char *)&val, (TO))) \
295 double_to_i387
PARAMS ((char *, char *));
297 /* Return the GDB type object for the "standard" data type
298 of data in register N. */
300 #undef REGISTER_VIRTUAL_TYPE
301 #define REGISTER_VIRTUAL_TYPE(N) \
302 ((N < 3) ? builtin_type_int : \
303 (N < 5) ? builtin_type_double : \
304 (N < 8) ? builtin_type_int : \
305 (N < 14) ? builtin_type_double : \
308 /* from m-i386.h (now known as tm-i386v.h). */
309 /* Store the address of the place in which to copy the structure the
310 subroutine will return. This is called from call_function. FIXME:
311 Why is it writing register 0? Is the symmetry different from tm-i386v.h,
312 or is it some sort of artifact? FIXME. */
314 #undef STORE_STRUCT_RETURN
315 #define STORE_STRUCT_RETURN(ADDR, SP) \
316 { (SP) -= sizeof (ADDR); \
317 write_memory ((SP), &(ADDR), sizeof (ADDR)); \
318 write_register(0, (ADDR)); }
320 /* Extract from an array REGBUF containing the (raw) register state
321 a function return value of type TYPE, and copy that, in virtual format,
324 #undef EXTRACT_RETURN_VALUE
325 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
326 symmetry_extract_return_value(TYPE, REGBUF, VALBUF)
329 /* Things needed for making the inferior call functions. FIXME: Merge
330 this with the main 386 stuff. */
332 #define PUSH_DUMMY_FRAME \
333 { CORE_ADDR sp = read_register (SP_REGNUM); \
335 sp = push_word (sp, read_register (PC_REGNUM)); \
336 sp = push_word (sp, read_register (FP_REGNUM)); \
337 write_register (FP_REGNUM, sp); \
338 for (regnum = 0; regnum < NUM_REGS; regnum++) \
339 sp = push_word (sp, read_register (regnum)); \
340 write_register (SP_REGNUM, sp); \
345 FRAME frame = get_current_frame (); \
348 struct frame_saved_regs fsr; \
349 struct frame_info *fi; \
350 fi = get_frame_info (frame); \
352 get_frame_saved_regs (fi, &fsr); \
353 for (regnum = 0; regnum < NUM_REGS; regnum++) { \
355 adr = fsr.regs[regnum]; \
357 write_register (regnum, read_memory_integer (adr, 4)); \
359 write_register (FP_REGNUM, read_memory_integer (fp, 4)); \
360 write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); \
361 write_register (SP_REGNUM, fp + 8); \
362 flush_cached_frames (); \
363 set_current_frame ( create_new_frame (read_register (FP_REGNUM), \
367 /* from i386-dep.c, worked better than my original... */
368 /* This sequence of words is the instructions
369 * call (32-bit offset)
374 #define CALL_DUMMY { 0x223344e8, 0xcc11 }
376 #define CALL_DUMMY_LENGTH 8
378 #define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy */
380 /* Insert the specified number of args and function address
381 into a call sequence of the above form stored at DUMMYNAME. */
383 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
385 int from, to, delta, loc; \
386 loc = (int)(read_register (SP_REGNUM) - CALL_DUMMY_LENGTH); \
390 *(int *)((char *)(dummyname) + 1) = delta; \
394 print_387_control_word
PARAMS ((unsigned int));
397 print_387_status_word
PARAMS ((unsigned int));
This page took 0.036295 seconds and 4 git commands to generate.