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