Commit | Line | Data |
---|---|---|
c906108c SS |
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). | |
5 | ||
c5aa993b | 6 | This file is part of GDB. |
c906108c | 7 | |
c5aa993b JM |
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. | |
c906108c | 12 | |
c5aa993b JM |
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. | |
c906108c | 17 | |
c5aa993b JM |
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, | |
21 | Boston, MA 02111-1307, USA. */ | |
c906108c SS |
22 | |
23 | #ifndef TM_PTX_H | |
24 | #define TM_PTX_H 1 | |
25 | ||
26 | /* I don't know if this will work for cross-debugging, even if you do get | |
27 | a copy of the right include file. */ | |
28 | ||
29 | #include <sys/reg.h> | |
30 | ||
31 | #ifdef SEQUENT_PTX4 | |
32 | #include "i386/tm-i386v4.h" | |
33 | #else /* !SEQUENT_PTX4 */ | |
34 | #include "i386/tm-i386v.h" | |
35 | #endif | |
36 | ||
37 | /* Number of traps that happen between exec'ing the shell to run an | |
38 | inferior, and when we finally get to the inferior code. This is 2 | |
39 | on most implementations. Here we have to undo what tm-i386v.h gave | |
40 | us and restore the default. */ | |
41 | ||
42 | #undef START_INFERIOR_TRAPS_EXPECTED | |
43 | #define START_INFERIOR_TRAPS_EXPECTED 2 | |
44 | ||
45 | /* Amount PC must be decremented by after a breakpoint. This is often the | |
46 | number of bytes in BREAKPOINT but not always (such as now). */ | |
47 | ||
48 | #undef DECR_PC_AFTER_BREAK | |
49 | #define DECR_PC_AFTER_BREAK 0 | |
50 | ||
51 | #if 0 | |
c5aa993b JM |
52 | -- -this code can 't be used unless we know we are running native, |
53 | since it uses host specific ptrace calls. | |
c906108c SS |
54 | /* code for 80387 fpu. Functions are from i386-dep.c, copied into |
55 | * symm-dep.c. | |
56 | */ | |
57 | #define FLOAT_INFO { i386_float_info(); } | |
58 | #endif | |
59 | ||
60 | /* Number of machine registers */ | |
61 | ||
62 | #undef NUM_REGS | |
63 | #define NUM_REGS 49 | |
64 | ||
65 | /* Initializer for an array of names of registers. There should be at least | |
66 | NUM_REGS strings in this initializer. Any excess ones are simply ignored. | |
67 | The order of the first 8 registers must match the compiler's numbering | |
68 | scheme (which is the same as the 386 scheme) and also regmap in the various | |
69 | *-nat.c files. */ | |
70 | ||
71 | #undef REGISTER_NAMES | |
72 | #define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \ | |
73 | "esp", "ebp", "esi", "edi", \ | |
74 | "eip", "eflags", "st0", "st1", \ | |
75 | "st2", "st3", "st4", "st5", \ | |
76 | "st6", "st7", "fp1", "fp2", \ | |
77 | "fp3", "fp4", "fp5", "fp6", \ | |
78 | "fp7", "fp8", "fp9", "fp10", \ | |
79 | "fp11", "fp12", "fp13", "fp14", \ | |
80 | "fp15", "fp16", "fp17", "fp18", \ | |
81 | "fp19", "fp20", "fp21", "fp22", \ | |
82 | "fp23", "fp24", "fp25", "fp26", \ | |
83 | "fp27", "fp28", "fp29", "fp30", \ | |
84 | "fp31" } | |
85 | ||
86 | /* Register numbers of various important registers. | |
87 | Note that some of these values are "real" register numbers, | |
88 | and correspond to the general registers of the machine, | |
89 | and some are "phony" register numbers which are too large | |
90 | to be actual register numbers as far as the user is concerned | |
91 | but do serve to get the desired values when passed to read_register. */ | |
92 | ||
93 | #define EAX_REGNUM 0 | |
94 | #define ECX_REGNUM 1 | |
95 | #define EDX_REGNUM 2 | |
96 | #define EBX_REGNUM 3 | |
97 | ||
98 | #define ESP_REGNUM 4 | |
99 | #define EBP_REGNUM 5 | |
100 | ||
101 | #define ESI_REGNUM 6 | |
102 | #define EDI_REGNUM 7 | |
103 | ||
104 | #define EIP_REGNUM 8 | |
105 | #define EFLAGS_REGNUM 9 | |
106 | ||
107 | #define ST0_REGNUM 10 | |
108 | #define ST1_REGNUM 11 | |
109 | #define ST2_REGNUM 12 | |
110 | #define ST3_REGNUM 13 | |
111 | ||
112 | #define ST4_REGNUM 14 | |
113 | #define ST5_REGNUM 15 | |
114 | #define ST6_REGNUM 16 | |
115 | #define ST7_REGNUM 17 | |
116 | ||
117 | #define FP1_REGNUM 18 /* first 1167 register */ | |
118 | /* Get %fp2 - %fp31 by addition, since they are contiguous */ | |
119 | ||
120 | #undef SP_REGNUM | |
121 | #define SP_REGNUM ESP_REGNUM /* Contains address of top of stack */ | |
122 | #undef FP_REGNUM | |
123 | #define FP_REGNUM EBP_REGNUM /* Contains address of executing stack frame */ | |
124 | #undef PC_REGNUM | |
125 | #define PC_REGNUM EIP_REGNUM /* Contains program counter */ | |
126 | #undef PS_REGNUM | |
127 | #define PS_REGNUM EFLAGS_REGNUM /* Contains processor status */ | |
128 | ||
129 | /* | |
130 | * For ptx, this is a little bit bizarre, since the register block | |
131 | * is below the u area in memory. This means that blockend here ends | |
132 | * up being negative (for the call from coredep.c) since the value in | |
133 | * u.u_ar0 will be less than KERNEL_U_ADDR (and coredep.c passes us | |
134 | * u.u_ar0 - KERNEL_U_ADDR in blockend). Since we also define | |
135 | * FETCH_INFERIOR_REGISTERS (and supply our own functions for that), | |
136 | * the core file case will be the only use of this function. | |
137 | */ | |
138 | ||
139 | #define REGISTER_U_ADDR(addr, blockend, regno) \ | |
140 | { (addr) = ptx_register_u_addr((blockend), (regno)); } | |
141 | ||
142 | extern int | |
143 | ptx_register_u_addr PARAMS ((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) | |
c5aa993b | 183 | |
c906108c SS |
184 | /* Convert data from raw format for register REGNUM |
185 | to virtual format for register REGNUM. */ | |
c5aa993b | 186 | extern const struct floatformat floatformat_i387_ext; /* from floatformat.h */ |
c906108c SS |
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)) | |
c5aa993b | 194 | |
c906108c SS |
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 | /* | |
c5aa993b JM |
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 | */ | |
c906108c | 232 | |
c5aa993b | 233 | #endif /* ifndef TM_PTX_H */ |