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