OSDN Git Service

Update/correct copyright notices.
[pf3gnuchains/pf3gnuchains3x.git] / gdb / config / i386 / tm-ptx.h
1 /* Target machine definitions for GDB on a Sequent Symmetry under ptx
2    with Weitek 1167 and i387 support.
3    Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 2000
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_PTX_H
25 #define TM_PTX_H 1
26
27 /* I don't know if this will work for cross-debugging, even if you do get
28    a copy of the right include file.  */
29
30 #include <sys/reg.h>
31
32 #ifdef SEQUENT_PTX4
33 #include "i386/tm-i386v4.h"
34 #else /* !SEQUENT_PTX4 */
35 #include "i386/tm-i386v.h"
36 #endif
37
38 /* Number of traps that happen between exec'ing the shell to run an
39    inferior, and when we finally get to the inferior code.  This is 2
40    on most implementations. Here we have to undo what tm-i386v.h gave
41    us and restore the default. */
42
43 #undef START_INFERIOR_TRAPS_EXPECTED
44 #define START_INFERIOR_TRAPS_EXPECTED 2
45
46 /* Amount PC must be decremented by after a breakpoint.  This is often the
47    number of bytes in BREAKPOINT but not always (such as now). */
48
49 #undef DECR_PC_AFTER_BREAK
50 #define DECR_PC_AFTER_BREAK 0
51
52 #if 0
53 -- -this code can 't be used unless we know we are running native,
54 since it uses host specific ptrace calls.
55 /* code for 80387 fpu.  Functions are from i386-dep.c, copied into
56  * symm-dep.c.
57  */
58 #define FLOAT_INFO { i386_float_info(); }
59 #endif
60
61 /* Number of machine registers */
62
63 #undef  NUM_REGS
64 #define NUM_REGS 49
65
66 /* Initializer for an array of names of registers.  There should be at least
67    NUM_REGS strings in this initializer.  Any excess ones are simply ignored.
68    The order of the first 8 registers must match the compiler's numbering
69    scheme (which is the same as the 386 scheme) and also regmap in the various
70    *-nat.c files. */
71
72 #undef  REGISTER_NAMES
73 #define REGISTER_NAMES { "eax",  "ecx",    "edx",  "ebx",  \
74                          "esp",  "ebp",    "esi",  "edi",  \
75                          "eip",  "eflags", "st0",  "st1",  \
76                          "st2",  "st3",    "st4",  "st5",  \
77                          "st6",  "st7",    "fp1",  "fp2",  \
78                          "fp3",  "fp4",    "fp5",  "fp6",  \
79                          "fp7",  "fp8",    "fp9",  "fp10", \
80                          "fp11", "fp12",   "fp13", "fp14", \
81                          "fp15", "fp16",   "fp17", "fp18", \
82                          "fp19", "fp20",   "fp21", "fp22", \
83                          "fp23", "fp24",   "fp25", "fp26", \
84                          "fp27", "fp28",   "fp29", "fp30", \
85                          "fp31" }
86
87 /* Register numbers of various important registers.
88    Note that some of these values are "real" register numbers,
89    and correspond to the general registers of the machine,
90    and some are "phony" register numbers which are too large
91    to be actual register numbers as far as the user is concerned
92    but do serve to get the desired values when passed to read_register.  */
93
94 #define EAX_REGNUM      0
95 #define ECX_REGNUM      1
96 #define EDX_REGNUM      2
97 #define EBX_REGNUM      3
98
99 #define ESP_REGNUM      4
100 #define EBP_REGNUM      5
101
102 #define ESI_REGNUM      6
103 #define EDI_REGNUM      7
104
105 #define EIP_REGNUM      8
106 #define EFLAGS_REGNUM   9
107
108 #define ST0_REGNUM      10
109 #define ST1_REGNUM      11
110 #define ST2_REGNUM      12
111 #define ST3_REGNUM      13
112
113 #define ST4_REGNUM      14
114 #define ST5_REGNUM      15
115 #define ST6_REGNUM      16
116 #define ST7_REGNUM      17
117
118 #define FP1_REGNUM 18           /* first 1167 register */
119 /* Get %fp2 - %fp31 by addition, since they are contiguous */
120
121 #undef  SP_REGNUM
122 #define SP_REGNUM ESP_REGNUM    /* Contains address of top of stack */
123 #undef  FP_REGNUM
124 #define FP_REGNUM EBP_REGNUM    /* Contains address of executing stack frame */
125 #undef  PC_REGNUM
126 #define PC_REGNUM EIP_REGNUM    /* Contains program counter */
127 #undef  PS_REGNUM
128 #define PS_REGNUM EFLAGS_REGNUM /* Contains processor status */
129
130 /*
131  * For ptx, this is a little bit bizarre, since the register block
132  * is below the u area in memory.  This means that blockend here ends
133  * up being negative (for the call from coredep.c) since the value in
134  * u.u_ar0 will be less than KERNEL_U_ADDR (and coredep.c passes us
135  * u.u_ar0 - KERNEL_U_ADDR in blockend).  Since we also define
136  * FETCH_INFERIOR_REGISTERS (and supply our own functions for that),
137  * the core file case will be the only use of this function.
138  */
139
140 #define REGISTER_U_ADDR(addr, blockend, regno) \
141 { (addr) = ptx_register_u_addr((blockend), (regno)); }
142
143 extern int ptx_register_u_addr (int, int);
144
145 /* Total amount of space needed to store our copies of the machine's
146    register state, the array `registers'.  10 i*86 registers, 8 i387
147    registers, and 31 Weitek 1167 registers */
148
149 #undef  REGISTER_BYTES
150 #define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4))
151
152 /* Index within `registers' of the first byte of the space for register N. */
153
154 #undef  REGISTER_BYTE
155 #define REGISTER_BYTE(N)                \
156 (((N) < ST0_REGNUM) ? ((N) * 4) : \
157  ((N) < FP1_REGNUM) ? (40 + (((N) - ST0_REGNUM) * 10)) : \
158  (40 + 80 + (((N) - FP1_REGNUM) * 4)))
159
160 /* Number of bytes of storage in the actual machine representation for
161    register N.  All registers are 4 bytes, except 387 st(0) - st(7),
162    which are 80 bits each. */
163
164 #undef  REGISTER_RAW_SIZE
165 #define REGISTER_RAW_SIZE(N) \
166 (((N) < ST0_REGNUM) ? 4 : \
167  ((N) < FP1_REGNUM) ? 10 : \
168  4)
169
170 /* Largest value REGISTER_RAW_SIZE can have.  */
171
172 #undef  MAX_REGISTER_RAW_SIZE
173 #define MAX_REGISTER_RAW_SIZE 10
174
175 /* Nonzero if register N requires conversion
176    from raw format to virtual format.  */
177
178 #undef REGISTER_CONVERTIBLE
179 #define REGISTER_CONVERTIBLE(N) \
180 ((N < ST0_REGNUM) ? 0 : \
181  (N < FP1_REGNUM) ? 1 : \
182  0)
183
184 /* Convert data from raw format for register REGNUM
185    to virtual format for register REGNUM.  */
186 extern const struct floatformat floatformat_i387_ext;   /* from floatformat.h */
187
188 #undef REGISTER_CONVERT_TO_VIRTUAL
189 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO)        \
190 ((REGNUM < ST0_REGNUM) ?  (void)memcpy ((TO), (FROM), 4) : \
191  (REGNUM < FP1_REGNUM) ? (void)floatformat_to_double(&floatformat_i387_ext, \
192                                                        (FROM),(TO)) : \
193  (void)memcpy ((TO), (FROM), 4))
194
195 /* Convert data from virtual format for register REGNUM
196    to raw format for register REGNUM.  */
197
198 #undef REGISTER_CONVERT_TO_RAW
199 #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO)    \
200 ((REGNUM < ST0_REGNUM) ?  (void)memcpy ((TO), (FROM), 4) : \
201  (REGNUM < FP1_REGNUM) ? (void)floatformat_from_double(&floatformat_i387_ext, \
202                                                        (FROM),(TO)) : \
203  (void)memcpy ((TO), (FROM), 4))
204
205 /* Return the GDB type object for the "standard" data type
206    of data in register N.  */
207 /*
208  * Note: the 1167 registers (the last line, builtin_type_float) are
209  * generally used in pairs, with each pair being treated as a double.
210  * It it also possible to use them singly as floats.  I'm not sure how
211  * in gdb to treat the register pair pseudo-doubles. -fubar
212  */
213 #undef REGISTER_VIRTUAL_TYPE
214 #define REGISTER_VIRTUAL_TYPE(N) \
215 ((N < ST0_REGNUM) ? builtin_type_int : \
216  (N < FP1_REGNUM) ? builtin_type_double : \
217  builtin_type_float)
218
219 /* Extract from an array REGBUF containing the (raw) register state
220    a function return value of type TYPE, and copy that, in virtual format,
221    into VALBUF.  */
222
223 #undef  EXTRACT_RETURN_VALUE
224 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
225   symmetry_extract_return_value(TYPE, REGBUF, VALBUF)
226
227 /*
228    #undef  FRAME_FIND_SAVED_REGS
229    #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
230    { ptx_frame_find_saved_regs((frame_info), &(frame_saved_regs)); }
231  */
232
233 #endif /* ifndef TM_PTX_H */