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