OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [config/] [i386/] [tm-symmetry.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.