]>
Commit | Line | Data |
---|---|---|
c906108c SS |
1 | /* Parameters for a Sun 386i target machine, for GDB, the GNU debugger. |
2 | Copyright 1986, 1987, 1991, 1992, 1993 Free Software Foundation, Inc. | |
3 | ||
c5aa993b | 4 | This file is part of GDB. |
c906108c | 5 | |
c5aa993b JM |
6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
c906108c | 10 | |
c5aa993b JM |
11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
c906108c | 15 | |
c5aa993b JM |
16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 59 Temple Place - Suite 330, | |
19 | Boston, MA 02111-1307, USA. */ | |
c906108c SS |
20 | |
21 | #if !defined (TM_SUN386_H) | |
22 | #define TM_SUN386_H 1 | |
23 | ||
24 | #include "i386/tm-i386.h" | |
25 | ||
26 | #ifndef sun386 | |
27 | #define sun386 | |
28 | #endif | |
29 | #define GDB_TARGET_IS_SUN386 1 | |
30 | #define SUNOS4 | |
31 | #define USE_MACHINE_REG_H | |
32 | ||
33 | /* Perhaps some day this will work even without the following #define */ | |
34 | #define COFF_ENCAPSULATE | |
35 | ||
36 | #ifdef COFF_ENCAPSULATE | |
37 | /* Avoid conflicts between our include files and <sys/exec.h> | |
38 | (maybe not needed anymore). */ | |
39 | #define _EXEC_ | |
40 | #endif | |
41 | ||
42 | /* sun386 ptrace seems unable to change the frame pointer */ | |
43 | #define PTRACE_FP_BUG | |
44 | ||
45 | /* Address of end of stack space. */ | |
46 | ||
47 | #define STACK_END_ADDR 0xfc000000 | |
48 | ||
49 | /* Number of machine registers */ | |
50 | ||
51 | #undef NUM_REGS | |
52 | #define NUM_REGS 35 | |
53 | ||
54 | /* Initializer for an array of names of registers. There should be NUM_REGS | |
55 | strings in this initializer. The order of the first 8 registers must match | |
56 | the compiler's numbering scheme (which is the same as the 386 scheme) also, | |
57 | this table must match regmap in i386-pinsn.c. */ | |
58 | ||
59 | #undef REGISTER_NAMES | |
60 | #define REGISTER_NAMES { "gs", "fs", "es", "ds", \ | |
61 | "edi", "esi", "ebp", "esp", \ | |
62 | "ebx", "edx", "ecx", "eax", \ | |
63 | "retaddr", "trapnum", "errcode", "ip", \ | |
64 | "cs", "ps", "sp", "ss", \ | |
65 | "fst0", "fst1", "fst2", "fst3", \ | |
66 | "fst4", "fst5", "fst6", "fst7", \ | |
67 | "fctrl", "fstat", "ftag", "fip", \ | |
68 | "fcs", "fopoff", "fopsel" \ | |
69 | } | |
70 | ||
71 | /* Register numbers of various important registers. | |
72 | Note that some of these values are "real" register numbers, | |
73 | and correspond to the general registers of the machine, | |
74 | and some are "phony" register numbers which are too large | |
75 | to be actual register numbers as far as the user is concerned | |
76 | but do serve to get the desired values when passed to read_register. */ | |
77 | ||
78 | #undef FP_REGNUM | |
c5aa993b | 79 | #define FP_REGNUM 6 /* (ebp) Contains address of executing stack frame */ |
c906108c | 80 | #undef SP_REGNUM |
c5aa993b | 81 | #define SP_REGNUM 18 /* (usp) Contains address of top of stack */ |
c906108c | 82 | #undef PS_REGNUM |
c5aa993b | 83 | #define PS_REGNUM 17 /* (ps) Contains processor status */ |
c906108c | 84 | #undef PC_REGNUM |
c5aa993b | 85 | #define PC_REGNUM 15 /* (eip) Contains program counter */ |
c906108c | 86 | #undef FP0_REGNUM |
c5aa993b | 87 | #define FP0_REGNUM 20 /* Floating point register 0 */ |
c906108c | 88 | #undef FPC_REGNUM |
c5aa993b | 89 | #define FPC_REGNUM 28 /* 80387 control register */ |
c906108c SS |
90 | |
91 | /* Total amount of space needed to store our copies of the machine's | |
92 | register state, the array `registers'. */ | |
93 | ||
94 | #undef REGISTER_BYTES | |
95 | #define REGISTER_BYTES (20*4+8*10+7*4) | |
96 | ||
97 | /* Index within `registers' of the first byte of the space for | |
98 | register N. */ | |
99 | ||
100 | #undef REGISTER_BYTE | |
101 | #define REGISTER_BYTE(N) \ | |
102 | ((N) >= FPC_REGNUM ? (((N) - FPC_REGNUM) * 4) + 160 \ | |
103 | : (N) >= FP0_REGNUM ? (((N) - FP0_REGNUM) * 10) + 80 \ | |
104 | : (N) * 4) | |
105 | ||
106 | /* Number of bytes of storage in the actual machine representation | |
107 | for register N. */ | |
108 | ||
109 | #undef REGISTER_RAW_SIZE | |
110 | #define REGISTER_RAW_SIZE(N) (((unsigned)((N) - FP0_REGNUM)) < 8 ? 10 : 4) | |
111 | ||
112 | /* Number of bytes of storage in the program's representation | |
113 | for register N. */ | |
114 | ||
115 | #undef REGISTER_VIRTUAL_SIZE | |
116 | #define REGISTER_VIRTUAL_SIZE(N) (((unsigned)((N) - FP0_REGNUM)) < 8 ? 8 : 4) | |
117 | ||
118 | /* Nonzero if register N requires conversion | |
119 | from raw format to virtual format. */ | |
120 | ||
121 | #undef REGISTER_CONVERTIBLE | |
122 | #define REGISTER_CONVERTIBLE(N) (((unsigned)((N) - FP0_REGNUM)) < 8) | |
123 | ||
124 | /* Convert data from raw format for register REGNUM in buffer FROM | |
125 | to virtual format with type TYPE in buffer TO. */ | |
126 | ||
127 | #undef REGISTER_CONVERT_TO_VIRTUAL | |
128 | #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \ | |
129 | { \ | |
130 | double val; \ | |
131 | i387_to_double ((FROM), (char *)&val); \ | |
132 | store_floating ((TO), TYPE_LENGTH (TYPE), val); \ | |
133 | } | |
134 | extern void | |
135 | i387_to_double PARAMS ((char *, char *)); | |
136 | ||
137 | /* Convert data from virtual format with type TYPE in buffer FROM | |
138 | to raw format for register REGNUM in buffer TO. */ | |
139 | ||
140 | #undef REGISTER_CONVERT_TO_RAW | |
141 | #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \ | |
142 | { \ | |
143 | double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \ | |
144 | double_to_i387((char *)&val, (TO)); \ | |
145 | } | |
146 | extern void | |
147 | double_to_i387 PARAMS ((char *, char *)); | |
148 | ||
149 | /* Return the GDB type object for the "standard" data type | |
150 | of data in register N. */ | |
151 | ||
152 | #undef REGISTER_VIRTUAL_TYPE | |
153 | #define REGISTER_VIRTUAL_TYPE(N) \ | |
154 | (((unsigned)((N) - FP0_REGNUM)) < 8 ? builtin_type_double : builtin_type_int) | |
155 | ||
156 | /* Extract from an array REGBUF containing the (raw) register state | |
157 | a function return value of type TYPE, and copy that, in virtual format, | |
158 | into VALBUF. */ | |
159 | ||
160 | #undef EXTRACT_RETURN_VALUE | |
161 | #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ | |
162 | memcpy (VALBUF, REGBUF + REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 11), TYPE_LENGTH (TYPE)) | |
163 | ||
164 | /* Write into appropriate registers a function return value | |
165 | of type TYPE, given in virtual format. */ | |
166 | ||
167 | #undef STORE_RETURN_VALUE | |
168 | #define STORE_RETURN_VALUE(TYPE,VALBUF) \ | |
169 | write_register_bytes (REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 11), VALBUF, TYPE_LENGTH (TYPE)) | |
170 | ||
171 | /* Describe the pointer in each stack frame to the previous stack frame | |
172 | (its caller). */ | |
173 | ||
174 | /* FRAME_CHAIN takes a frame's nominal address | |
175 | and produces the frame's chain-pointer. */ | |
176 | ||
177 | #undef FRAME_CHAIN | |
178 | #define FRAME_CHAIN(thisframe) \ | |
179 | (!inside_entry_file ((thisframe)->pc) ? \ | |
180 | read_memory_integer ((thisframe)->frame, 4) :\ | |
181 | 0) | |
182 | ||
183 | /* Define other aspects of the stack frame. */ | |
184 | ||
185 | /* A macro that tells us whether the function invocation represented | |
186 | by FI does not have a frame on the stack associated with it. If it | |
187 | does not, FRAMELESS is set to 1, else 0. */ | |
188 | ||
189 | #undef FRAMELESS_FUNCTION_INVOCATION | |
392a587b JM |
190 | #define FRAMELESS_FUNCTION_INVOCATION(FI) \ |
191 | (frameless_look_for_prologue (FI)) | |
c906108c SS |
192 | |
193 | #undef FRAME_SAVED_PC | |
194 | #define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4)) | |
195 | ||
196 | /* Insert the specified number of args and function address | |
197 | into a call sequence of the above form stored at DUMMYNAME. */ | |
198 | ||
199 | #undef FIX_CALL_DUMMY | |
200 | #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ | |
201 | { \ | |
202 | *(int *)((char *)(dummyname) + 1) = (int)(fun) - (pc) - 5; \ | |
203 | } | |
204 | ||
205 | #endif /* !defined (TM_SUN386_H) */ |