]>
Commit | Line | Data |
---|---|---|
c906108c SS |
1 | /* OBSOLETE /* Parameters for targeting on a Gould NP1, for GDB, the GNU debugger. */ |
2 | /* OBSOLETE Copyright 1986, 1987, 1989, 1991, 1993 Free Software Foundation, Inc. */ | |
3 | /* OBSOLETE */ | |
4 | /* OBSOLETE This file is part of GDB. */ | |
5 | /* OBSOLETE */ | |
6 | /* OBSOLETE This program is free software; you can redistribute it and/or modify */ | |
7 | /* OBSOLETE it under the terms of the GNU General Public License as published by */ | |
8 | /* OBSOLETE the Free Software Foundation; either version 2 of the License, or */ | |
9 | /* OBSOLETE (at your option) any later version. */ | |
10 | /* OBSOLETE */ | |
11 | /* OBSOLETE This program is distributed in the hope that it will be useful, */ | |
12 | /* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */ | |
13 | /* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | |
14 | /* OBSOLETE GNU General Public License for more details. */ | |
15 | /* OBSOLETE */ | |
16 | /* OBSOLETE You should have received a copy of the GNU General Public License */ | |
17 | /* OBSOLETE along with this program; if not, write to the Free Software */ | |
18 | /* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *x/ */ | |
19 | /* OBSOLETE */ | |
20 | /* OBSOLETE #define GOULD_NPL */ | |
21 | /* OBSOLETE */ | |
22 | /* OBSOLETE #define TARGET_BYTE_ORDER BIG_ENDIAN */ | |
23 | /* OBSOLETE */ | |
24 | /* OBSOLETE /* N_ENTRY appears in libraries on Gould machines. */ | |
25 | /* OBSOLETE Don't know what 0xa4 is; it's mentioned in stab.h */ | |
26 | /* OBSOLETE but only in the sdb symbol list. *x/ */ | |
27 | /* OBSOLETE #define IGNORE_SYMBOL(type) (type == N_ENTRY || type == 0xa4) */ | |
28 | /* OBSOLETE */ | |
29 | /* OBSOLETE /* We don't want the extra gnu symbols on the machine; */ | |
30 | /* OBSOLETE they will interfere with the shared segment symbols. *x/ */ | |
31 | /* OBSOLETE #define NO_GNU_STABS */ | |
32 | /* OBSOLETE */ | |
33 | /* OBSOLETE /* Macro for text-offset and data info (in NPL a.out format). *x/ */ | |
c5aa993b JM |
34 | /* OBSOLETE #define TEXTINFO \ */ |
35 | /* OBSOLETE text_offset = N_TXTOFF (exec_coffhdr, exec_aouthdr); \ */ | |
c906108c SS |
36 | /* OBSOLETE exec_data_offset = N_TXTOFF (exec_coffhdr, exec_aouthdr)\ */ |
37 | /* OBSOLETE + exec_aouthdr.a_text */ | |
38 | /* OBSOLETE */ | |
39 | /* OBSOLETE /* Macro for number of symbol table entries *x/ */ | |
c5aa993b JM |
40 | /* OBSOLETE #define NUMBER_OF_SYMBOLS \ */ |
41 | /* OBSOLETE (coffhdr.f_nsyms) */ | |
c906108c SS |
42 | /* OBSOLETE */ |
43 | /* OBSOLETE /* Macro for file-offset of symbol table (in NPL a.out format). *x/ */ | |
c5aa993b JM |
44 | /* OBSOLETE #define SYMBOL_TABLE_OFFSET \ */ |
45 | /* OBSOLETE N_SYMOFF (coffhdr) */ | |
c906108c SS |
46 | /* OBSOLETE */ |
47 | /* OBSOLETE /* Macro for file-offset of string table (in NPL a.out format). *x/ */ | |
c5aa993b JM |
48 | /* OBSOLETE #define STRING_TABLE_OFFSET \ */ |
49 | /* OBSOLETE (N_STROFF (coffhdr)) */ | |
c906108c SS |
50 | /* OBSOLETE */ |
51 | /* OBSOLETE /* Macro to store the length of the string table data in INTO. *x/ */ | |
c5aa993b JM |
52 | /* OBSOLETE #define READ_STRING_TABLE_SIZE(INTO) \ */ |
53 | /* OBSOLETE { INTO = hdr.a_stsize; } */ | |
c906108c SS |
54 | /* OBSOLETE */ |
55 | /* OBSOLETE /* Macro to declare variables to hold the file's header data. *x/ */ | |
c5aa993b JM |
56 | /* OBSOLETE #define DECLARE_FILE_HEADERS struct exec hdr; \ */ |
57 | /* OBSOLETE FILHDR coffhdr */ | |
c906108c SS |
58 | /* OBSOLETE */ |
59 | /* OBSOLETE /* Macro to read the header data from descriptor DESC and validate it. */ | |
60 | /* OBSOLETE NAME is the file name, for error messages. *x/ */ | |
c5aa993b JM |
61 | /* OBSOLETE #define READ_FILE_HEADERS(DESC, NAME) \ */ |
62 | /* OBSOLETE { val = myread (DESC, &coffhdr, sizeof coffhdr); \ */ | |
63 | /* OBSOLETE if (val < 0) \ */ | |
64 | /* OBSOLETE perror_with_name (NAME); \ */ | |
65 | /* OBSOLETE val = myread (DESC, &hdr, sizeof hdr); \ */ | |
66 | /* OBSOLETE if (val < 0) \ */ | |
67 | /* OBSOLETE perror_with_name (NAME); \ */ | |
68 | /* OBSOLETE if (coffhdr.f_magic != GNP1MAGIC) \ */ | |
69 | /* OBSOLETE error ("File \"%s\" not in coff executable format.", NAME); \ */ | |
70 | /* OBSOLETE if (N_BADMAG (hdr)) \ */ | |
c906108c SS |
71 | /* OBSOLETE error ("File \"%s\" not in executable format.", NAME); } */ |
72 | /* OBSOLETE */ | |
73 | /* OBSOLETE /* Define COFF and other symbolic names needed on NP1 *x/ */ | |
c5aa993b JM |
74 | /* OBSOLETE #define NS32GMAGIC GNP1MAGIC */ |
75 | /* OBSOLETE #define NS32SMAGIC GPNMAGIC */ | |
c906108c SS |
76 | /* OBSOLETE */ |
77 | /* OBSOLETE /* Address of blocks in N_LBRAC and N_RBRAC symbols are absolute addresses, */ | |
78 | /* OBSOLETE not relative to start of source address. *x/ */ | |
79 | /* OBSOLETE #define BLOCK_ADDRESS_ABSOLUTE */ | |
80 | /* OBSOLETE */ | |
81 | /* OBSOLETE /* Offset from address of function to start of its code. */ | |
82 | /* OBSOLETE Zero on most machines. *x/ */ | |
c5aa993b | 83 | /* OBSOLETE #define FUNCTION_START_OFFSET 8 */ |
c906108c SS |
84 | /* OBSOLETE */ |
85 | /* OBSOLETE /* Advance PC across any function entry prologue instructions */ | |
86 | /* OBSOLETE to reach some "real" code. One NPL we can have one two startup */ | |
87 | /* OBSOLETE sequences depending on the size of the local stack: */ | |
88 | /* OBSOLETE */ | |
89 | /* OBSOLETE Either: */ | |
90 | /* OBSOLETE "suabr b2, #" */ | |
91 | /* OBSOLETE of */ | |
92 | /* OBSOLETE "lil r4, #", "suabr b2, #(r4)" */ | |
93 | /* OBSOLETE */ | |
94 | /* OBSOLETE "lwbr b6, #", "stw r1, 8(b2)" */ | |
95 | /* OBSOLETE Optional "stwbr b3, c(b2)" */ | |
96 | /* OBSOLETE Optional "trr r2,r7" (Gould first argument register passing) */ | |
97 | /* OBSOLETE or */ | |
98 | /* OBSOLETE Optional "stw r2,8(b3)" (Gould first argument register passing) */ | |
99 | /* OBSOLETE *x/ */ | |
c5aa993b JM |
100 | /* OBSOLETE #define SKIP_PROLOGUE(pc) { \ */ |
101 | /* OBSOLETE register int op = read_memory_integer ((pc), 4); \ */ | |
102 | /* OBSOLETE if ((op & 0xffff0000) == 0xFA0B0000) { \ */ | |
103 | /* OBSOLETE pc += 4; \ */ | |
104 | /* OBSOLETE op = read_memory_integer ((pc), 4); \ */ | |
105 | /* OBSOLETE if ((op & 0xffff0000) == 0x59400000) { \ */ | |
106 | /* OBSOLETE pc += 4; \ */ | |
107 | /* OBSOLETE op = read_memory_integer ((pc), 4); \ */ | |
108 | /* OBSOLETE if ((op & 0xffff0000) == 0x5F000000) { \ */ | |
109 | /* OBSOLETE pc += 4; \ */ | |
110 | /* OBSOLETE op = read_memory_integer ((pc), 4); \ */ | |
111 | /* OBSOLETE if (op == 0xD4820008) { \ */ | |
112 | /* OBSOLETE pc += 4; \ */ | |
113 | /* OBSOLETE op = read_memory_integer ((pc), 4); \ */ | |
114 | /* OBSOLETE if (op == 0x5582000C) { \ */ | |
115 | /* OBSOLETE pc += 4; \ */ | |
116 | /* OBSOLETE op = read_memory_integer ((pc), 2); \ */ | |
117 | /* OBSOLETE if (op == 0x2fa0) { \ */ | |
118 | /* OBSOLETE pc += 2; \ */ | |
119 | /* OBSOLETE } else { \ */ | |
120 | /* OBSOLETE op = read_memory_integer ((pc), 4); \ */ | |
121 | /* OBSOLETE if (op == 0xd5030008) { \ */ | |
122 | /* OBSOLETE pc += 4; \ */ | |
123 | /* OBSOLETE } \ */ | |
124 | /* OBSOLETE } \ */ | |
125 | /* OBSOLETE } else { \ */ | |
126 | /* OBSOLETE op = read_memory_integer ((pc), 2); \ */ | |
127 | /* OBSOLETE if (op == 0x2fa0) { \ */ | |
128 | /* OBSOLETE pc += 2; \ */ | |
129 | /* OBSOLETE } \ */ | |
130 | /* OBSOLETE } \ */ | |
131 | /* OBSOLETE } \ */ | |
132 | /* OBSOLETE } \ */ | |
133 | /* OBSOLETE } \ */ | |
134 | /* OBSOLETE } \ */ | |
135 | /* OBSOLETE if ((op & 0xffff0000) == 0x59000000) { \ */ | |
136 | /* OBSOLETE pc += 4; \ */ | |
137 | /* OBSOLETE op = read_memory_integer ((pc), 4); \ */ | |
138 | /* OBSOLETE if ((op & 0xffff0000) == 0x5F000000) { \ */ | |
139 | /* OBSOLETE pc += 4; \ */ | |
140 | /* OBSOLETE op = read_memory_integer ((pc), 4); \ */ | |
141 | /* OBSOLETE if (op == 0xD4820008) { \ */ | |
142 | /* OBSOLETE pc += 4; \ */ | |
143 | /* OBSOLETE op = read_memory_integer ((pc), 4); \ */ | |
144 | /* OBSOLETE if (op == 0x5582000C) { \ */ | |
145 | /* OBSOLETE pc += 4; \ */ | |
146 | /* OBSOLETE op = read_memory_integer ((pc), 2); \ */ | |
147 | /* OBSOLETE if (op == 0x2fa0) { \ */ | |
148 | /* OBSOLETE pc += 2; \ */ | |
149 | /* OBSOLETE } else { \ */ | |
150 | /* OBSOLETE op = read_memory_integer ((pc), 4); \ */ | |
151 | /* OBSOLETE if (op == 0xd5030008) { \ */ | |
152 | /* OBSOLETE pc += 4; \ */ | |
153 | /* OBSOLETE } \ */ | |
154 | /* OBSOLETE } \ */ | |
155 | /* OBSOLETE } else { \ */ | |
156 | /* OBSOLETE op = read_memory_integer ((pc), 2); \ */ | |
157 | /* OBSOLETE if (op == 0x2fa0) { \ */ | |
158 | /* OBSOLETE pc += 2; \ */ | |
159 | /* OBSOLETE } \ */ | |
160 | /* OBSOLETE } \ */ | |
161 | /* OBSOLETE } \ */ | |
162 | /* OBSOLETE } \ */ | |
163 | /* OBSOLETE } \ */ | |
c906108c SS |
164 | /* OBSOLETE } */ |
165 | /* OBSOLETE */ | |
166 | /* OBSOLETE /* Immediately after a function call, return the saved pc. */ | |
167 | /* OBSOLETE Can't go through the frames for this because on some machines */ | |
168 | /* OBSOLETE the new frame is not set up until the new function executes */ | |
169 | /* OBSOLETE some instructions. True on NPL! Return address is in R1. */ | |
170 | /* OBSOLETE The true return address is REALLY 4 past that location! *x/ */ | |
171 | /* OBSOLETE #define SAVED_PC_AFTER_CALL(frame) \ */ | |
c5aa993b | 172 | /* OBSOLETE (read_register(R1_REGNUM) + 4) */ |
c906108c SS |
173 | /* OBSOLETE */ |
174 | /* OBSOLETE /* Address of end of stack space. *x/ */ | |
c5aa993b | 175 | /* OBSOLETE #define STACK_END_ADDR 0x7fffc000 */ |
c906108c SS |
176 | /* OBSOLETE */ |
177 | /* OBSOLETE /* Stack grows downward. *x/ */ | |
178 | /* OBSOLETE #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) */ | |
179 | /* OBSOLETE */ | |
180 | /* OBSOLETE /* Sequence of bytes for breakpoint instruction. */ | |
181 | /* OBSOLETE This is padded out to the size of a machine word. When it was just */ | |
182 | /* OBSOLETE {0x28, 0x09} it gave problems if hit breakpoint on returning from a */ | |
183 | /* OBSOLETE function call. *x/ */ | |
c5aa993b | 184 | /* OBSOLETE #define BREAKPOINT {0x28, 0x09, 0x0, 0x0} */ |
c906108c SS |
185 | /* OBSOLETE */ |
186 | /* OBSOLETE /* Amount PC must be decremented by after a breakpoint. */ | |
187 | /* OBSOLETE This is often the number of bytes in BREAKPOINT */ | |
188 | /* OBSOLETE but not always. *x/ */ | |
c5aa993b | 189 | /* OBSOLETE #define DECR_PC_AFTER_BREAK 2 */ |
c906108c SS |
190 | /* OBSOLETE */ |
191 | /* OBSOLETE /* Return 1 if P points to an invalid floating point value. *x/ */ | |
c5aa993b | 192 | /* OBSOLETE #define INVALID_FLOAT(p, len) ((*(short *)p & 0xff80) == 0x8000) */ |
c906108c SS |
193 | /* OBSOLETE */ |
194 | /* OBSOLETE /* Say how long (ordinary) registers are. This is a piece of bogosity */ | |
195 | /* OBSOLETE used in push_word and a few other places; REGISTER_RAW_SIZE is the */ | |
196 | /* OBSOLETE real way to know how big a register is. *x/ */ | |
197 | /* OBSOLETE */ | |
198 | /* OBSOLETE #define REGISTER_SIZE 4 */ | |
199 | /* OBSOLETE */ | |
200 | /* OBSOLETE /* Size of bytes of vector register (NP1 only), 32 elements * sizeof(int) *x/ */ | |
c5aa993b | 201 | /* OBSOLETE #define VR_SIZE 128 */ |
c906108c SS |
202 | /* OBSOLETE */ |
203 | /* OBSOLETE /* Number of machine registers *x/ */ | |
c5aa993b JM |
204 | /* OBSOLETE #define NUM_REGS 27 */ |
205 | /* OBSOLETE #define NUM_GEN_REGS 16 */ | |
206 | /* OBSOLETE #define NUM_CPU_REGS 4 */ | |
207 | /* OBSOLETE #define NUM_VECTOR_REGS 7 */ | |
c906108c SS |
208 | /* OBSOLETE */ |
209 | /* OBSOLETE /* Initializer for an array of names of registers. */ | |
210 | /* OBSOLETE There should be NUM_REGS strings in this initializer. *x/ */ | |
211 | /* OBSOLETE #define REGISTER_NAMES { \ */ | |
212 | /* OBSOLETE "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ */ | |
213 | /* OBSOLETE "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", \ */ | |
214 | /* OBSOLETE "sp", "ps", "pc", "ve", \ */ | |
215 | /* OBSOLETE "v1", "v2", "v3", "v4", "v5", "v6", "v7", \ */ | |
216 | /* OBSOLETE } */ | |
217 | /* OBSOLETE */ | |
218 | /* OBSOLETE /* Register numbers of various important registers. */ | |
219 | /* OBSOLETE Note that some of these values are "real" register numbers, */ | |
220 | /* OBSOLETE and correspond to the general registers of the machine, */ | |
221 | /* OBSOLETE and some are "phony" register numbers which are too large */ | |
222 | /* OBSOLETE to be actual register numbers as far as the user is concerned */ | |
223 | /* OBSOLETE but do serve to get the desired values when passed to read_register. *x/ */ | |
c5aa993b JM |
224 | /* OBSOLETE #define R1_REGNUM 1 /* Gr1 => return address of caller *x/ */ |
225 | /* OBSOLETE #define R2_REGNUM 2 /* Gr2 => return value from function *x/ */ | |
226 | /* OBSOLETE #define R4_REGNUM 4 /* Gr4 => register save area *x/ */ | |
227 | /* OBSOLETE #define R5_REGNUM 5 /* Gr5 => register save area *x/ */ | |
228 | /* OBSOLETE #define R6_REGNUM 6 /* Gr6 => register save area *x/ */ | |
229 | /* OBSOLETE #define R7_REGNUM 7 /* Gr7 => register save area *x/ */ | |
230 | /* OBSOLETE #define B1_REGNUM 9 /* Br1 => start of this code routine *x/ */ | |
231 | /* OBSOLETE #define SP_REGNUM 10 /* Br2 == (sp) *x/ */ | |
232 | /* OBSOLETE #define AP_REGNUM 11 /* Br3 == (ap) *x/ */ | |
233 | /* OBSOLETE #define FP_REGNUM 16 /* A copy of Br2 saved in trap *x/ */ | |
234 | /* OBSOLETE #define PS_REGNUM 17 /* Contains processor status *x/ */ | |
235 | /* OBSOLETE #define PC_REGNUM 18 /* Contains program counter *x/ */ | |
236 | /* OBSOLETE #define VE_REGNUM 19 /* Vector end (user setup) register *x/ */ | |
237 | /* OBSOLETE #define V1_REGNUM 20 /* First vector register *x/ */ | |
238 | /* OBSOLETE #define V7_REGNUM 26 /* First vector register *x/ */ | |
c906108c SS |
239 | /* OBSOLETE */ |
240 | /* OBSOLETE /* Total amount of space needed to store our copies of the machine's */ | |
241 | /* OBSOLETE register state, the array `registers'. *x/ */ | |
242 | /* OBSOLETE #define REGISTER_BYTES \ */ | |
c5aa993b | 243 | /* OBSOLETE (NUM_GEN_REGS*4 + NUM_VECTOR_REGS*VR_SIZE + NUM_CPU_REGS*4) */ |
c906108c SS |
244 | /* OBSOLETE */ |
245 | /* OBSOLETE /* Index within `registers' of the first byte of the space for */ | |
246 | /* OBSOLETE register N. *x/ */ | |
247 | /* OBSOLETE #define REGISTER_BYTE(N) \ */ | |
c5aa993b | 248 | /* OBSOLETE (((N) < V1_REGNUM) ? ((N) * 4) : (((N) - V1_REGNUM) * VR_SIZE) + 80) */ |
c906108c SS |
249 | /* OBSOLETE */ |
250 | /* OBSOLETE /* Number of bytes of storage in the actual machine representation */ | |
251 | /* OBSOLETE for register N. On the NP1, all normal regs are 4 bytes, but */ | |
252 | /* OBSOLETE the vector registers are VR_SIZE*4 bytes long. *x/ */ | |
253 | /* OBSOLETE #define REGISTER_RAW_SIZE(N) \ */ | |
c5aa993b | 254 | /* OBSOLETE (((N) < V1_REGNUM) ? 4 : VR_SIZE) */ |
c906108c SS |
255 | /* OBSOLETE */ |
256 | /* OBSOLETE /* Number of bytes of storage in the program's representation */ | |
257 | /* OBSOLETE for register N. On the NP1, all regs are 4 bytes. *x/ */ | |
258 | /* OBSOLETE #define REGISTER_VIRTUAL_SIZE(N) \ */ | |
c5aa993b | 259 | /* OBSOLETE (((N) < V1_REGNUM) ? 4 : VR_SIZE) */ |
c906108c SS |
260 | /* OBSOLETE */ |
261 | /* OBSOLETE /* Largest value REGISTER_RAW_SIZE can have. *x/ */ | |
c5aa993b | 262 | /* OBSOLETE #define MAX_REGISTER_RAW_SIZE VR_SIZE */ |
c906108c SS |
263 | /* OBSOLETE */ |
264 | /* OBSOLETE /* Largest value REGISTER_VIRTUAL_SIZE can have. *x/ */ | |
c5aa993b | 265 | /* OBSOLETE #define MAX_REGISTER_VIRTUAL_SIZE VR_SIZE */ |
c906108c SS |
266 | /* OBSOLETE */ |
267 | /* OBSOLETE /* Return the GDB type object for the "standard" data type */ | |
268 | /* OBSOLETE of data in register N. *x/ */ | |
c5aa993b | 269 | /* OBSOLETE #define REGISTER_VIRTUAL_TYPE(N) \ */ |
c906108c SS |
270 | /* OBSOLETE ((N) > VE_REGNUM ? builtin_type_np1_vector : builtin_type_int) */ |
271 | /* OBSOLETE extern struct type *builtin_type_np1_vector; */ | |
272 | /* OBSOLETE */ | |
273 | /* OBSOLETE /* Store the address of the place in which to copy the structure the */ | |
274 | /* OBSOLETE subroutine will return. This is called from call_function. */ | |
275 | /* OBSOLETE */ | |
276 | /* OBSOLETE On this machine this is a no-op, because gcc isn't used on it */ | |
277 | /* OBSOLETE yet. So this calling convention is not used. *x/ */ | |
278 | /* OBSOLETE */ | |
279 | /* OBSOLETE #define STORE_STRUCT_RETURN(ADDR, SP) push_word(SP + 8, ADDR) */ | |
280 | /* OBSOLETE */ | |
281 | /* OBSOLETE /* Extract from an arrary REGBUF containing the (raw) register state */ | |
282 | /* OBSOLETE a function return value of type TYPE, and copy that, in virtual format, */ | |
283 | /* OBSOLETE into VALBUF. *x/ */ | |
284 | /* OBSOLETE */ | |
285 | /* OBSOLETE #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ */ | |
c5aa993b | 286 | /* OBSOLETE memcpy (VALBUF, ((int *)(REGBUF)) + 2, TYPE_LENGTH (TYPE)) */ |
c906108c SS |
287 | /* OBSOLETE */ |
288 | /* OBSOLETE /* Write into appropriate registers a function return value */ | |
289 | /* OBSOLETE of type TYPE, given in virtual format. *x/ */ | |
290 | /* OBSOLETE */ | |
291 | /* OBSOLETE #define STORE_RETURN_VALUE(TYPE,VALBUF) \ */ | |
c5aa993b JM |
292 | /* OBSOLETE write_register_bytes (REGISTER_BYTE (R2_REGNUM), VALBUF, \ */ |
293 | /* OBSOLETE TYPE_LENGTH (TYPE)) */ | |
c906108c SS |
294 | /* OBSOLETE */ |
295 | /* OBSOLETE /* Extract from an array REGBUF containing the (raw) register state */ | |
296 | /* OBSOLETE the address in which a function should return its structure value, */ | |
297 | /* OBSOLETE as a CORE_ADDR (or an expression that can be used as one). *x/ */ | |
298 | /* OBSOLETE */ | |
299 | /* OBSOLETE #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*((int *)(REGBUF) + 2)) */ | |
300 | /* OBSOLETE */ | |
301 | /* OBSOLETE /* Both gcc and cc return small structs in registers (i.e. in GDB */ | |
302 | /* OBSOLETE terminology, small structs don't use the struct return convention). *x/ */ | |
303 | /* OBSOLETE extern use_struct_convention_fn gould_use_struct_convention; */ | |
304 | /* OBSOLETE #define USE_STRUCT_CONVENTION(gcc_p, type) gould_use_struct_convention (gcc_p, type) */ | |
305 | /* OBSOLETE \f */ | |
306 | /* OBSOLETE /* Describe the pointer in each stack frame to the previous stack frame */ | |
307 | /* OBSOLETE (its caller). *x/ */ | |
308 | /* OBSOLETE */ | |
309 | /* OBSOLETE /* FRAME_CHAIN takes a frame's nominal address */ | |
310 | /* OBSOLETE and produces the frame's chain-pointer. */ | |
311 | /* OBSOLETE */ | |
312 | /* OBSOLETE However, if FRAME_CHAIN_VALID returns zero, */ | |
313 | /* OBSOLETE it means the given frame is the outermost one and has no caller. *x/ */ | |
314 | /* OBSOLETE */ | |
315 | /* OBSOLETE /* In the case of the NPL, the frame's norminal address is Br2 and the */ | |
316 | /* OBSOLETE previous routines frame is up the stack X bytes, where X is the */ | |
317 | /* OBSOLETE value stored in the code function header xA(Br1). *x/ */ | |
c5aa993b | 318 | /* OBSOLETE #define FRAME_CHAIN(thisframe) (findframe(thisframe)) */ |
c906108c SS |
319 | /* OBSOLETE */ |
320 | /* OBSOLETE extern int gould_frame_chain_valid PARAMS ((CORE_ADDR, struct frame_info *)); */ | |
321 | /* OBSOLETE #define FRAME_CHAIN_VALID(chain, thisframe) gould_frame_chain_valid (chain, thisframe) */ | |
322 | /* OBSOLETE */ | |
323 | /* OBSOLETE /* Define other aspects of the stack frame on NPL. *x/ */ | |
324 | /* OBSOLETE #define FRAME_SAVED_PC(FRAME) \ */ | |
c5aa993b | 325 | /* OBSOLETE (read_memory_integer ((FRAME)->frame + 8, 4)) */ |
c906108c SS |
326 | /* OBSOLETE */ |
327 | /* OBSOLETE #define FRAME_ARGS_ADDRESS(fi) \ */ | |
c5aa993b JM |
328 | /* OBSOLETE ((fi)->next ? \ */ |
329 | /* OBSOLETE read_memory_integer ((fi)->frame + 12, 4) : \ */ | |
330 | /* OBSOLETE read_register (AP_REGNUM)) */ | |
c906108c | 331 | /* OBSOLETE */ |
c5aa993b | 332 | /* OBSOLETE #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) */ |
c906108c SS |
333 | /* OBSOLETE */ |
334 | /* OBSOLETE /* Set VAL to the number of args passed to frame described by FI. */ | |
335 | /* OBSOLETE Can set VAL to -1, meaning no way to tell. *x/ */ | |
336 | /* OBSOLETE */ | |
337 | /* OBSOLETE /* We can check the stab info to see how */ | |
338 | /* OBSOLETE many arg we have. No info in stack will tell us *x/ */ | |
c5aa993b | 339 | /* OBSOLETE #define FRAME_NUM_ARGS(fi) (findarg(fi)) */ |
c906108c SS |
340 | /* OBSOLETE */ |
341 | /* OBSOLETE /* Return number of bytes at start of arglist that are not really args. *x/ */ | |
c5aa993b | 342 | /* OBSOLETE #define FRAME_ARGS_SKIP 8 */ |
c906108c SS |
343 | /* OBSOLETE */ |
344 | /* OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, */ | |
345 | /* OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. */ | |
346 | /* OBSOLETE This includes special registers such as pc and fp saved in special */ | |
347 | /* OBSOLETE ways in the stack frame. sp is even more special: */ | |
348 | /* OBSOLETE the address we return for it IS the sp for the next frame. *x/ */ | |
349 | /* OBSOLETE */ | |
c5aa993b | 350 | /* OBSOLETE #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ */ |
c906108c | 351 | /* OBSOLETE { \ */ |
c5aa993b | 352 | /* OBSOLETE memset (&frame_saved_regs, '\0', sizeof frame_saved_regs); \ */ |
c906108c | 353 | /* OBSOLETE (frame_saved_regs).regs[SP_REGNUM] = framechain (frame_info); \ */ |
c5aa993b JM |
354 | /* OBSOLETE (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 8; \ */ |
355 | /* OBSOLETE (frame_saved_regs).regs[R4_REGNUM] = (frame_info)->frame + 0x30; \ */ | |
356 | /* OBSOLETE (frame_saved_regs).regs[R5_REGNUM] = (frame_info)->frame + 0x34; \ */ | |
357 | /* OBSOLETE (frame_saved_regs).regs[R6_REGNUM] = (frame_info)->frame + 0x38; \ */ | |
358 | /* OBSOLETE (frame_saved_regs).regs[R7_REGNUM] = (frame_info)->frame + 0x3C; \ */ | |
c906108c SS |
359 | /* OBSOLETE } */ |
360 | /* OBSOLETE \f */ | |
361 | /* OBSOLETE /* Things needed for making the inferior call functions. *x/ */ | |
362 | /* OBSOLETE */ | |
c5aa993b JM |
363 | /* OBSOLETE #define CALL_DUMMY_LOCATION BEFORE_TEXT_END */ |
364 | /* OBSOLETE #define NEED_TEXT_START_END 1 */ | |
c906108c SS |
365 | /* OBSOLETE */ |
366 | /* OBSOLETE /* Push an empty stack frame, to record the current PC, etc. *x/ */ | |
367 | /* OBSOLETE */ | |
368 | /* OBSOLETE #define PUSH_DUMMY_FRAME \ */ | |
369 | /* OBSOLETE { register CORE_ADDR sp = read_register (SP_REGNUM); \ */ | |
370 | /* OBSOLETE register int regnum; \ */ | |
371 | /* OBSOLETE for (regnum = 0; regnum < FP_REGNUM; regnum++) \ */ | |
372 | /* OBSOLETE sp = push_word (sp, read_register (regnum)); \ */ | |
373 | /* OBSOLETE sp = push_word (sp, read_register (PS_REGNUM)); \ */ | |
374 | /* OBSOLETE sp = push_word (sp, read_register (PC_REGNUM)); \ */ | |
375 | /* OBSOLETE write_register (SP_REGNUM, sp);} */ | |
376 | /* OBSOLETE */ | |
377 | /* OBSOLETE /* Discard from the stack the innermost frame, */ | |
378 | /* OBSOLETE restoring all saved registers. *x/ */ | |
379 | /* OBSOLETE /* FIXME: Should be using {store,extract}_unsigned_integer. *x/ */ | |
380 | /* OBSOLETE */ | |
381 | /* OBSOLETE #define POP_FRAME \ */ | |
382 | /* OBSOLETE { CORE_ADDR sp = read_register(SP_REGNUM); \ */ | |
383 | /* OBSOLETE ULONGEST reg; \ */ | |
384 | /* OBSOLETE int regnum; \ */ | |
385 | /* OBSOLETE for(regnum = 0;regnum < FP_REGNUM;regnum++){ \ */ | |
386 | /* OBSOLETE sp-=REGISTER_SIZE; \ */ | |
387 | /* OBSOLETE read_memory(sp,®,REGISTER_SIZE); \ */ | |
388 | /* OBSOLETE write_register(regnum,reg);} \ */ | |
389 | /* OBSOLETE sp-=REGISTER_SIZE; \ */ | |
390 | /* OBSOLETE read_memory(sp,®,REGISTER_SIZE); \ */ | |
391 | /* OBSOLETE write_register(PS_REGNUM,reg); \ */ | |
392 | /* OBSOLETE sp-=REGISTER_SIZE; \ */ | |
393 | /* OBSOLETE read_memory(sp,®,REGISTER_SIZE); \ */ | |
394 | /* OBSOLETE write_register(PC_REGNUM,reg);} */ | |
395 | /* OBSOLETE */ | |
396 | /* OBSOLETE /* MJD - Size of dummy frame pushed onto stack by PUSH_DUMMY_FRAME *x/ */ | |
397 | /* OBSOLETE */ | |
398 | /* OBSOLETE #define DUMMY_FRAME_SIZE (0x48) */ | |
399 | /* OBSOLETE */ | |
400 | /* OBSOLETE /* MJD - The sequence of words in the instructions is */ | |
401 | /* OBSOLETE halt */ | |
402 | /* OBSOLETE halt */ | |
403 | /* OBSOLETE halt */ | |
404 | /* OBSOLETE halt */ | |
405 | /* OBSOLETE subr b2,stack size,0 grab stack space for dummy call */ | |
406 | /* OBSOLETE labr b3,x0(b2),0 set AP_REGNUM to point at arguments */ | |
407 | /* OBSOLETE lw r2,x8(b3),0 load r2 with first argument */ | |
408 | /* OBSOLETE lwbr b1,arguments size(b2),0 load address of function to be called */ | |
409 | /* OBSOLETE brlnk r1,x8(b1),0 call function */ | |
410 | /* OBSOLETE halt */ | |
411 | /* OBSOLETE halt */ | |
412 | /* OBSOLETE labr b2,stack size(b2),0 give back stack */ | |
413 | /* OBSOLETE break break */ | |
414 | /* OBSOLETE *x/ */ | |
415 | /* OBSOLETE */ | |
416 | /* OBSOLETE #define CALL_DUMMY {0x00000000, \ */ | |
c5aa993b JM |
417 | /* OBSOLETE 0x00000000, \ */ |
418 | /* OBSOLETE 0x59000000, \ */ | |
419 | /* OBSOLETE 0x598a0000, \ */ | |
420 | /* OBSOLETE 0xb5030008, \ */ | |
421 | /* OBSOLETE 0x5c820000, \ */ | |
422 | /* OBSOLETE 0x44810008, \ */ | |
423 | /* OBSOLETE 0x00000000, \ */ | |
424 | /* OBSOLETE 0x590a0000, \ */ | |
425 | /* OBSOLETE 0x28090000 } */ | |
c906108c SS |
426 | /* OBSOLETE */ |
427 | /* OBSOLETE #define CALL_DUMMY_LENGTH 40 */ | |
428 | /* OBSOLETE */ | |
429 | /* OBSOLETE #define CALL_DUMMY_START_OFFSET 8 */ | |
430 | /* OBSOLETE */ | |
431 | /* OBSOLETE #define CALL_DUMMY_STACK_ADJUST 8 */ | |
432 | /* OBSOLETE */ | |
433 | /* OBSOLETE /* MJD - Fixup CALL_DUMMY for the specific function call. */ | |
434 | /* OBSOLETE OK heres the problems */ | |
435 | /* OBSOLETE 1) On a trap there are two copies of the stack pointer, one in SP_REGNUM */ | |
436 | /* OBSOLETE which is read/write and one in FP_REGNUM which is only read. It seems */ | |
437 | /* OBSOLETE that when restarting the GOULD NP1 uses FP_REGNUM's value. */ | |
438 | /* OBSOLETE 2) Loading function address into b1 looks a bit difficult if bigger than */ | |
439 | /* OBSOLETE 0x0000fffc, infact from what I can tell the compiler sets up table of */ | |
440 | /* OBSOLETE function address in base3 through which function calls are referenced. */ | |
441 | /* OBSOLETE */ | |
442 | /* OBSOLETE OK my solutions */ | |
443 | /* OBSOLETE Calculate the size of the dummy stack frame and do adjustments of */ | |
444 | /* OBSOLETE SP_REGNUM in the dummy call. */ | |
445 | /* OBSOLETE Push function address onto the stack and load it in the dummy call */ | |
446 | /* OBSOLETE *x/ */ | |
447 | /* OBSOLETE */ | |
448 | /* OBSOLETE #define FIX_CALL_DUMMY(dummyname, sp, fun, nargs, args, type, gcc_p) \ */ | |
449 | /* OBSOLETE { int i;\ */ | |
450 | /* OBSOLETE int arg_len = 0, total_len;\ */ | |
451 | /* OBSOLETE old_sp = push_word(old_sp,fun);\ */ | |
452 | /* OBSOLETE for(i = nargs - 1;i >= 0;i--)\ */ | |
c5aa993b | 453 | /* OBSOLETE arg_len += TYPE_LENGTH (VALUE_TYPE (value_arg_coerce (args[i])));\ */ |
c906108c | 454 | /* OBSOLETE if(struct_return)\ */ |
c5aa993b | 455 | /* OBSOLETE arg_len += TYPE_LENGTH(value_type);\ */ |
c906108c SS |
456 | /* OBSOLETE total_len = DUMMY_FRAME_SIZE+CALL_DUMMY_STACK_ADJUST+4+arg_len;\ */ |
457 | /* OBSOLETE dummyname[0] += total_len;\ */ | |
458 | /* OBSOLETE dummyname[2] += total_len;\ */ | |
459 | /* OBSOLETE dummyname[5] += arg_len+CALL_DUMMY_STACK_ADJUST;\ */ | |
460 | /* OBSOLETE dummyname[8] += total_len;} */ | |
461 | /* OBSOLETE */ | |
462 | /* OBSOLETE /* MJD - So the stack should end up looking like this */ | |
463 | /* OBSOLETE */ | |
464 | /* OBSOLETE | Normal stack frame | */ | |
465 | /* OBSOLETE | from normal program | */ | |
466 | /* OBSOLETE | flow | */ | |
467 | /* OBSOLETE +---------------------+ <- Final sp - 0x08 - argument size */ | |
468 | /* OBSOLETE | | - 0x4 - dummy_frame_size */ | |
469 | /* OBSOLETE | Pushed dummy frame | */ | |
470 | /* OBSOLETE | b0-b7, r0-r7 | */ | |
471 | /* OBSOLETE | pc and ps | */ | |
472 | /* OBSOLETE | | */ | |
473 | /* OBSOLETE +---------------------+ */ | |
474 | /* OBSOLETE | Function address | */ | |
475 | /* OBSOLETE +---------------------+ <- Final sp - 0x8 - arguments size */ | |
476 | /* OBSOLETE | | */ | |
477 | /* OBSOLETE | | */ | |
478 | /* OBSOLETE | | */ | |
479 | /* OBSOLETE | Arguments to | */ | |
480 | /* OBSOLETE | Function | */ | |
481 | /* OBSOLETE | | */ | |
482 | /* OBSOLETE | | */ | |
483 | /* OBSOLETE | | */ | |
484 | /* OBSOLETE +---------------------+ <- Final sp - 0x8 */ | |
485 | /* OBSOLETE | Dummy_stack_adjust | */ | |
486 | /* OBSOLETE +---------------------+ <- Final sp */ | |
487 | /* OBSOLETE | | */ | |
488 | /* OBSOLETE | where call will | */ | |
489 | /* OBSOLETE | build frame | */ | |
490 | /* OBSOLETE *x/ */ |