Update FSF address.
[deliverable/binutils-gdb.git] / gdb / config / i386 / tm-symmetry.h
CommitLineData
5076de82
FF
1/* Target machine definitions for GDB on a Sequent Symmetry under dynix 3.0,
2 with Weitek 1167 and i387 support.
8a19fe21
PS
3 Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994
4 Free Software Foundation, Inc.
56eec3c7 5 Symmetry version by Jay Vosburgh (fubar@sequent.com).
5076de82
FF
6
7This file is part of GDB.
8
9This program is free software; you can redistribute it and/or modify
10it under the terms of the GNU General Public License as published by
11the Free Software Foundation; either version 2 of the License, or
12(at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
6c9638b4 21Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
5076de82
FF
22
23/* I don't know if this will work for cross-debugging, even if you do get
24 a copy of the right include file. */
25#include <machine/reg.h>
5076de82 26
56eec3c7 27#define START_INFERIOR_TRAPS_EXPECTED 2
5076de82
FF
28
29/* Amount PC must be decremented by after a breakpoint.
30 This is often the number of bytes in BREAKPOINT
31 but not always. */
32
33#define DECR_PC_AFTER_BREAK 0
34
56eec3c7
JK
35#include "i386/tm-i386v.h"
36
5076de82 37#if 0
388f4919
PS
38/* --- this code can't be used unless we know we are running native,
39 since it uses host specific ptrace calls. */
5076de82
FF
40/* code for 80387 fpu. Functions are from i386-dep.c, copied into
41 * symm-dep.c.
42 */
43#define FLOAT_INFO { i386_float_info(); }
44#endif
45
5076de82 46/* Number of machine registers */
56eec3c7 47#undef NUM_REGS
5076de82
FF
48#define NUM_REGS 49
49
50/* Initializer for an array of names of registers.
51 There should be NUM_REGS strings in this initializer. */
52
53/* Symmetry registers are in this weird order to match the register
54 numbers in the symbol table entries. If you change the order,
55 things will probably break mysteriously for no apparent reason.
56 Also note that the st(0)...st(7) 387 registers are represented as
57 st0...st7. */
58
56eec3c7 59#undef REGISTER_NAMES
5076de82
FF
60#define REGISTER_NAMES { "eax", "edx", "ecx", "st0", "st1", \
61 "ebx", "esi", "edi", "st2", "st3", \
62 "st4", "st5", "st6", "st7", "esp", \
63 "ebp", "eip", "eflags", "fp1", "fp2", \
64 "fp3", "fp4", "fp5", "fp6", "fp7", \
65 "fp8", "fp9", "fp10", "fp11", "fp12", \
66 "fp13", "fp14", "fp15", "fp16", "fp17", \
67 "fp18", "fp19", "fp20", "fp21", "fp22", \
68 "fp23", "fp24", "fp25", "fp26", "fp27", \
69 "fp28", "fp29", "fp30", "fp31" }
70
71/* Register numbers of various important registers.
72 Note that some of these values are "real" register numbers,
73 and correspond to the general registers of the machine,
74 and some are "phony" register numbers which are too large
75 to be actual register numbers as far as the user is concerned
76 but do serve to get the desired values when passed to read_register. */
77
56eec3c7
JK
78#define EAX_REGNUM 0
79#define EDX_REGNUM 1
80#define ECX_REGNUM 2
81#define ST0_REGNUM 3
82#define ST1_REGNUM 4
83#define EBX_REGNUM 5
84#define ESI_REGNUM 6
85#define EDI_REGNUM 7
86#define ST2_REGNUM 8
87#define ST3_REGNUM 9
88
89#define ST4_REGNUM 10
90#define ST5_REGNUM 11
91#define ST6_REGNUM 12
92#define ST7_REGNUM 13
93
5076de82 94#define FP1_REGNUM 18 /* first 1167 register */
56eec3c7
JK
95/* Get %fp2 - %fp31 by addition, since they are contiguous */
96
97#undef SP_REGNUM
82a2edfb
JK
98#define SP_REGNUM 14 /* esp--Contains address of top of stack */
99#define ESP_REGNUM 14
56eec3c7 100#undef FP_REGNUM
82a2edfb
JK
101#define FP_REGNUM 15 /* ebp--Contains address of executing stack frame */
102#define EBP_REGNUM 15
56eec3c7 103#undef PC_REGNUM
82a2edfb
JK
104#define PC_REGNUM 16 /* eip--Contains program counter */
105#define EIP_REGNUM 16
56eec3c7 106#undef PS_REGNUM
82a2edfb
JK
107#define PS_REGNUM 17 /* eflags--Contains processor status */
108#define EFLAGS_REGNUM 17
5076de82 109
8a19fe21
PS
110/*
111 * Following macro translates i386 opcode register numbers to Symmetry
112 * register numbers. This is used by i386_frame_find_saved_regs.
113 *
114 * %eax %ecx %edx %ebx %esp %ebp %esi %edi
115 * i386 0 1 2 3 4 5 6 7
116 * Symmetry 0 2 1 5 14 15 6 7
117 *
118 */
119#define I386_REGNO_TO_SYMMETRY(n) \
120((n)==0?0 :(n)==1?2 :(n)==2?1 :(n)==3?5 :(n)==4?14 :(n)==5?15 :(n))
56eec3c7
JK
121
122/* The magic numbers below are offsets into u_ar0 in the user struct.
123 * They live in <machine/reg.h>. Gdb calls this macro with blockend
124 * holding u.u_ar0 - KERNEL_U_ADDR. Only the registers listed are
125 * saved in the u area (along with a few others that aren't useful
126 * here. See <machine/reg.h>).
127 */
128
129#define REGISTER_U_ADDR(addr, blockend, regno) \
130{ struct user foo; /* needed for finding fpu regs */ \
131switch (regno) { \
132 case 0: \
133 addr = blockend + EAX * sizeof(int); break; \
134 case 1: \
135 addr = blockend + EDX * sizeof(int); break; \
136 case 2: \
137 addr = blockend + ECX * sizeof(int); break; \
138 case 3: /* st(0) */ \
8a19fe21 139 addr = ((int)&foo.u_fpusave.fpu_stack[0][0] - (int)&foo); \
56eec3c7
JK
140 break; \
141 case 4: /* st(1) */ \
8a19fe21 142 addr = ((int) &foo.u_fpusave.fpu_stack[1][0] - (int)&foo); \
56eec3c7
JK
143 break; \
144 case 5: \
145 addr = blockend + EBX * sizeof(int); break; \
146 case 6: \
147 addr = blockend + ESI * sizeof(int); break; \
148 case 7: \
149 addr = blockend + EDI * sizeof(int); break; \
150 case 8: /* st(2) */ \
8a19fe21 151 addr = ((int) &foo.u_fpusave.fpu_stack[2][0] - (int)&foo); \
56eec3c7
JK
152 break; \
153 case 9: /* st(3) */ \
8a19fe21 154 addr = ((int) &foo.u_fpusave.fpu_stack[3][0] - (int)&foo); \
56eec3c7
JK
155 break; \
156 case 10: /* st(4) */ \
8a19fe21 157 addr = ((int) &foo.u_fpusave.fpu_stack[4][0] - (int)&foo); \
56eec3c7
JK
158 break; \
159 case 11: /* st(5) */ \
8a19fe21 160 addr = ((int) &foo.u_fpusave.fpu_stack[5][0] - (int)&foo); \
56eec3c7
JK
161 break; \
162 case 12: /* st(6) */ \
8a19fe21 163 addr = ((int) &foo.u_fpusave.fpu_stack[6][0] - (int)&foo); \
56eec3c7
JK
164 break; \
165 case 13: /* st(7) */ \
8a19fe21 166 addr = ((int) &foo.u_fpusave.fpu_stack[7][0] - (int)&foo); \
56eec3c7
JK
167 break; \
168 case 14: \
169 addr = blockend + ESP * sizeof(int); break; \
170 case 15: \
171 addr = blockend + EBP * sizeof(int); break; \
172 case 16: \
173 addr = blockend + EIP * sizeof(int); break; \
174 case 17: \
175 addr = blockend + FLAGS * sizeof(int); break; \
176 case 18: /* fp1 */ \
177 case 19: /* fp2 */ \
178 case 20: /* fp3 */ \
179 case 21: /* fp4 */ \
180 case 22: /* fp5 */ \
181 case 23: /* fp6 */ \
182 case 24: /* fp7 */ \
183 case 25: /* fp8 */ \
184 case 26: /* fp9 */ \
185 case 27: /* fp10 */ \
186 case 28: /* fp11 */ \
187 case 29: /* fp12 */ \
188 case 30: /* fp13 */ \
189 case 31: /* fp14 */ \
190 case 32: /* fp15 */ \
191 case 33: /* fp16 */ \
192 case 34: /* fp17 */ \
193 case 35: /* fp18 */ \
194 case 36: /* fp19 */ \
195 case 37: /* fp20 */ \
196 case 38: /* fp21 */ \
197 case 39: /* fp22 */ \
198 case 40: /* fp23 */ \
199 case 41: /* fp24 */ \
200 case 42: /* fp25 */ \
201 case 43: /* fp26 */ \
202 case 44: /* fp27 */ \
203 case 45: /* fp28 */ \
204 case 46: /* fp29 */ \
205 case 47: /* fp30 */ \
206 case 48: /* fp31 */ \
8a19fe21 207 addr = ((int) &foo.u_fpasave.fpa_regs[(regno)-18] - (int)&foo); \
82a2edfb
JK
208 } \
209}
82a2edfb 210
5076de82
FF
211/* Total amount of space needed to store our copies of the machine's
212 register state, the array `registers'. */
213/* 10 i386 registers, 8 i387 registers, and 31 Weitek 1167 registers */
56eec3c7 214#undef REGISTER_BYTES
5076de82
FF
215#define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4))
216
217/* Index within `registers' of the first byte of the space for
218 register N. */
219
56eec3c7 220#undef REGISTER_BYTE
5076de82
FF
221#define REGISTER_BYTE(N) \
222((N < 3) ? (N * 4) : \
223(N < 5) ? (((N - 2) * 10) + 2) : \
224(N < 8) ? (((N - 5) * 4) + 32) : \
225(N < 14) ? (((N - 8) * 10) + 44) : \
226 (((N - 14) * 4) + 104))
227
228/* Number of bytes of storage in the actual machine representation
229 * for register N. All registers are 4 bytes, except 387 st(0) - st(7),
230 * which are 80 bits each.
231 */
232
56eec3c7 233#undef REGISTER_RAW_SIZE
5076de82
FF
234#define REGISTER_RAW_SIZE(N) \
235((N < 3) ? 4 : \
236(N < 5) ? 10 : \
237(N < 8) ? 4 : \
238(N < 14) ? 10 : \
239 4)
240
5076de82
FF
241/* Largest value REGISTER_RAW_SIZE can have. */
242
56eec3c7 243#undef MAX_REGISTER_RAW_SIZE
5076de82
FF
244#define MAX_REGISTER_RAW_SIZE 10
245
5076de82
FF
246/* Nonzero if register N requires conversion
247 from raw format to virtual format. */
248
56eec3c7 249#undef REGISTER_CONVERTIBLE
5076de82
FF
250#define REGISTER_CONVERTIBLE(N) \
251((N < 3) ? 0 : \
252(N < 5) ? 1 : \
253(N < 8) ? 0 : \
254(N < 14) ? 1 : \
255 0)
256
8a19fe21
PS
257#include "floatformat.h"
258
ad09cb2b
PS
259/* Convert data from raw format for register REGNUM in buffer FROM
260 to virtual format with type TYPE in buffer TO. */
5076de82 261
56eec3c7 262#undef REGISTER_CONVERT_TO_VIRTUAL
ad09cb2b
PS
263#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
264{ \
265 double val; \
8a19fe21 266 floatformat_to_double (&floatformat_i387_ext, (FROM), &val); \
ad09cb2b
PS
267 store_floating ((TO), TYPE_LENGTH (TYPE), val); \
268}
5076de82 269
ad09cb2b
PS
270/* Convert data from virtual format with type TYPE in buffer FROM
271 to raw format for register REGNUM in buffer TO. */
5076de82 272
56eec3c7 273#undef REGISTER_CONVERT_TO_RAW
ad09cb2b
PS
274#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
275{ \
276 double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
8a19fe21 277 floatformat_from_double (&floatformat_i387_ext, &val, (TO)); \
ad09cb2b 278}
5076de82
FF
279
280/* Return the GDB type object for the "standard" data type
281 of data in register N. */
282
56eec3c7 283#undef REGISTER_VIRTUAL_TYPE
5076de82
FF
284#define REGISTER_VIRTUAL_TYPE(N) \
285((N < 3) ? builtin_type_int : \
286(N < 5) ? builtin_type_double : \
287(N < 8) ? builtin_type_int : \
288(N < 14) ? builtin_type_double : \
289 builtin_type_int)
290
5076de82 291/* Store the address of the place in which to copy the structure the
8a19fe21
PS
292 subroutine will return. This is called from call_function.
293 Native cc passes the address in eax, gcc (up to version 2.5.8)
294 passes it on the stack. gcc should be fixed in future versions to
295 adopt native cc conventions. */
5076de82 296
56eec3c7 297#undef STORE_STRUCT_RETURN
8a19fe21 298#define STORE_STRUCT_RETURN(ADDR, SP) write_register(0, (ADDR))
5076de82
FF
299
300/* Extract from an array REGBUF containing the (raw) register state
301 a function return value of type TYPE, and copy that, in virtual format,
302 into VALBUF. */
303
56eec3c7 304#undef EXTRACT_RETURN_VALUE
5076de82
FF
305#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
306 symmetry_extract_return_value(TYPE, REGBUF, VALBUF)
307
5076de82 308\f
5076de82
FF
309extern void
310print_387_control_word PARAMS ((unsigned int));
311
312extern void
313print_387_status_word PARAMS ((unsigned int));
8a19fe21
PS
314
315/* The following redefines make backtracing through sigtramp work.
316 They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp
317 from the sigcontext structure which is pushed by the kernel on the
318 user stack, along with a pointer to it. */
319
320#define IN_SIGTRAMP(pc, name) ((name) && STREQ ("_sigcode", name))
321
322/* Offset to saved PC in sigcontext, from <signal.h>. */
323#define SIGCONTEXT_PC_OFFSET 16
324
325/* FRAME_CHAIN takes a frame's nominal address and produces the frame's
326 chain-pointer.
327 In the case of the i386, the frame's nominal address
328 is the address of a 4-byte word containing the calling frame's address. */
329#undef FRAME_CHAIN
330#define FRAME_CHAIN(thisframe) \
331 (thisframe->signal_handler_caller \
332 ? thisframe->frame \
333 : (!inside_entry_file ((thisframe)->pc) \
334 ? read_memory_integer ((thisframe)->frame, 4) \
335 : 0))
336
337/* A macro that tells us whether the function invocation represented
338 by FI does not have a frame on the stack associated with it. If it
339 does not, FRAMELESS is set to 1, else 0. */
340#undef FRAMELESS_FUNCTION_INVOCATION
341#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
342 do { \
343 if ((FI)->signal_handler_caller) \
344 (FRAMELESS) = 0; \
345 else \
346 (FRAMELESS) = frameless_look_for_prologue(FI); \
347 } while (0)
348
349/* Saved Pc. Get it from sigcontext if within sigtramp. */
350
351#undef FRAME_SAVED_PC
352#define FRAME_SAVED_PC(FRAME) \
353 (((FRAME)->signal_handler_caller \
354 ? sigtramp_saved_pc (FRAME) \
355 : read_memory_integer ((FRAME)->frame + 4, 4)) \
356 )
This page took 0.144479 seconds and 4 git commands to generate.