]>
Commit | Line | Data |
---|---|---|
5076de82 | 1 | /* Definitions to make GDB run on a mips box under 4.3bsd. |
4c7edd73 ILT |
2 | Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995 |
3 | Free Software Foundation, Inc. | |
5076de82 FF |
4 | Contributed by Per Bothner ([email protected]) at U.Wisconsin |
5 | and by Alessandro Forin ([email protected]) at CMU.. | |
6 | ||
7 | This file is part of GDB. | |
8 | ||
9 | This program is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
11 | the Free Software Foundation; either version 2 of the License, or | |
12 | (at your option) any later version. | |
13 | ||
14 | This program is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License | |
20 | along with this program; if not, write to the Free Software | |
21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
22 | ||
05e9e188 | 23 | #include <bfd.h> |
5076de82 FF |
24 | #include "coff/sym.h" /* Needed for PDR below. */ |
25 | #include "coff/symconst.h" | |
26 | ||
27 | #if !defined (TARGET_BYTE_ORDER) | |
28 | #define TARGET_BYTE_ORDER LITTLE_ENDIAN | |
29 | #endif | |
30 | ||
97d3151a ILT |
31 | #if !defined (GDB_TARGET_IS_MIPS64) |
32 | #define GDB_TARGET_IS_MIPS64 0 | |
33 | #endif | |
34 | ||
5076de82 FF |
35 | /* Floating point is IEEE compliant */ |
36 | #define IEEE_FLOAT | |
37 | ||
38 | /* Some MIPS boards are provided both with and without a floating | |
daa4c5f8 ILT |
39 | point coprocessor. The MIPS R4650 chip has only single precision |
40 | floating point. We provide a user settable variable to tell gdb | |
41 | what type of floating point to use. */ | |
42 | ||
43 | enum mips_fpu_type | |
44 | { | |
45 | MIPS_FPU_DOUBLE, /* Full double precision floating point. */ | |
46 | MIPS_FPU_SINGLE, /* Single precision floating point (R4650). */ | |
47 | MIPS_FPU_NONE /* No floating point. */ | |
48 | }; | |
49 | ||
50 | extern enum mips_fpu_type mips_fpu; | |
5076de82 | 51 | |
9f9f94aa SS |
52 | /* The name of the usual type of MIPS processor that is in the target |
53 | system. */ | |
54 | ||
55 | #define DEFAULT_MIPS_TYPE "generic" | |
56 | ||
5076de82 FF |
57 | /* Offset from address of function to start of its code. |
58 | Zero on most machines. */ | |
59 | ||
60 | #define FUNCTION_START_OFFSET 0 | |
61 | ||
62 | /* Advance PC across any function entry prologue instructions | |
63 | to reach some "real" code. */ | |
64 | ||
ee5fb959 JK |
65 | #define SKIP_PROLOGUE(pc) pc = mips_skip_prologue (pc, 0) |
66 | extern CORE_ADDR mips_skip_prologue PARAMS ((CORE_ADDR addr, int lenient)); | |
5076de82 | 67 | |
b5aff268 JK |
68 | /* Return non-zero if PC points to an instruction which will cause a step |
69 | to execute both the instruction at PC and an instruction at PC+4. */ | |
70 | #define STEP_SKIPS_DELAY(pc) (mips_step_skips_delay (pc)) | |
71 | ||
5076de82 FF |
72 | /* Immediately after a function call, return the saved pc. |
73 | Can't always go through the frames for this because on some machines | |
74 | the new frame is not set up until the new function executes | |
75 | some instructions. */ | |
76 | ||
77 | #define SAVED_PC_AFTER_CALL(frame) read_register(RA_REGNUM) | |
78 | ||
79 | /* Are we currently handling a signal */ | |
80 | ||
e03c0cc6 | 81 | extern int in_sigtramp PARAMS ((CORE_ADDR, char *)); |
5076de82 FF |
82 | #define IN_SIGTRAMP(pc, name) in_sigtramp(pc, name) |
83 | ||
5076de82 FF |
84 | /* Stack grows downward. */ |
85 | ||
86 | #define INNER_THAN < | |
87 | ||
88 | #define BIG_ENDIAN 4321 | |
89 | #if TARGET_BYTE_ORDER == BIG_ENDIAN | |
90 | #define BREAKPOINT {0, 0x5, 0, 0xd} | |
91 | #else | |
92 | #define BREAKPOINT {0xd, 0, 0x5, 0} | |
93 | #endif | |
94 | ||
95 | /* Amount PC must be decremented by after a breakpoint. | |
96 | This is often the number of bytes in BREAKPOINT | |
97 | but not always. */ | |
98 | ||
99 | #define DECR_PC_AFTER_BREAK 0 | |
100 | ||
101 | /* Nonzero if instruction at PC is a return instruction. "j ra" on mips. */ | |
102 | ||
103 | #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 4) == 0x3e00008) | |
104 | ||
f4f0d174 JK |
105 | /* Say how long (ordinary) registers are. This is a piece of bogosity |
106 | used in push_word and a few other places; REGISTER_RAW_SIZE is the | |
107 | real way to know how big a register is. */ | |
5076de82 | 108 | |
f4f0d174 | 109 | #define REGISTER_SIZE 4 |
5076de82 | 110 | |
4fbce2fd KH |
111 | /* The size of a register. This is predefined in tm-mips64.h. We |
112 | can't use REGISTER_SIZE because that is used for various other | |
113 | things. */ | |
114 | ||
115 | #ifndef MIPS_REGSIZE | |
116 | #define MIPS_REGSIZE 4 | |
117 | #endif | |
118 | ||
5076de82 FF |
119 | /* Number of machine registers */ |
120 | ||
9f9f94aa | 121 | #define NUM_REGS 90 |
5076de82 FF |
122 | |
123 | /* Initializer for an array of names of registers. | |
124 | There should be NUM_REGS strings in this initializer. */ | |
125 | ||
126 | #define REGISTER_NAMES \ | |
127 | { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \ | |
128 | "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \ | |
129 | "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \ | |
130 | "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra", \ | |
131 | "sr", "lo", "hi", "bad", "cause","pc", \ | |
132 | "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ | |
133 | "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ | |
134 | "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",\ | |
135 | "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",\ | |
9f9f94aa SS |
136 | "fsr", "fir", "fp", "", \ |
137 | "", "", "", "", "", "", "", "", \ | |
138 | "", "", "", "", "", "", "", "", \ | |
5076de82 FF |
139 | } |
140 | ||
141 | /* Register numbers of various important registers. | |
142 | Note that some of these values are "real" register numbers, | |
143 | and correspond to the general registers of the machine, | |
144 | and some are "phony" register numbers which are too large | |
145 | to be actual register numbers as far as the user is concerned | |
146 | but do serve to get the desired values when passed to read_register. */ | |
147 | ||
148 | #define ZERO_REGNUM 0 /* read-only register, always 0 */ | |
138dd57c | 149 | #define V0_REGNUM 2 /* Function integer return value */ |
5076de82 FF |
150 | #define A0_REGNUM 4 /* Loc of first arg during a subr call */ |
151 | #define SP_REGNUM 29 /* Contains address of top of stack */ | |
152 | #define RA_REGNUM 31 /* Contains return address value */ | |
153 | #define PS_REGNUM 32 /* Contains processor status */ | |
154 | #define HI_REGNUM 34 /* Multiple/divide temp */ | |
155 | #define LO_REGNUM 33 /* ... */ | |
156 | #define BADVADDR_REGNUM 35 /* bad vaddr for addressing exception */ | |
157 | #define CAUSE_REGNUM 36 /* describes last exception */ | |
158 | #define PC_REGNUM 37 /* Contains program counter */ | |
159 | #define FP0_REGNUM 38 /* Floating point register 0 (single float) */ | |
160 | #define FCRCS_REGNUM 70 /* FP control/status */ | |
161 | #define FCRIR_REGNUM 71 /* FP implementation/revision */ | |
162 | #define FP_REGNUM 72 /* Pseudo register that contains true address of executing stack frame */ | |
9f9f94aa SS |
163 | #define FIRST_EMBED_REGNUM 74 /* First CP0 register for embedded use */ |
164 | #define PRID_REGNUM 89 /* Processor ID */ | |
165 | #define LAST_EMBED_REGNUM 89 /* Last one */ | |
5076de82 FF |
166 | |
167 | /* Define DO_REGISTERS_INFO() to do machine-specific formatting | |
168 | of register dumps. */ | |
169 | ||
170 | #define DO_REGISTERS_INFO(_regnum, fp) mips_do_registers_info(_regnum, fp) | |
171 | ||
172 | /* Total amount of space needed to store our copies of the machine's | |
173 | register state, the array `registers'. */ | |
9f9f94aa | 174 | |
4fbce2fd | 175 | #define REGISTER_BYTES (NUM_REGS*MIPS_REGSIZE) |
5076de82 FF |
176 | |
177 | /* Index within `registers' of the first byte of the space for | |
178 | register N. */ | |
179 | ||
4fbce2fd | 180 | #define REGISTER_BYTE(N) ((N) * MIPS_REGSIZE) |
5076de82 FF |
181 | |
182 | /* Number of bytes of storage in the actual machine representation | |
4fbce2fd | 183 | for register N. On mips, all regs are the same size. */ |
5076de82 | 184 | |
4fbce2fd | 185 | #define REGISTER_RAW_SIZE(N) MIPS_REGSIZE |
5076de82 FF |
186 | |
187 | /* Number of bytes of storage in the program's representation | |
4fbce2fd | 188 | for register N. On mips, all regs are the same size. */ |
5076de82 | 189 | |
4fbce2fd | 190 | #define REGISTER_VIRTUAL_SIZE(N) MIPS_REGSIZE |
5076de82 FF |
191 | |
192 | /* Largest value REGISTER_RAW_SIZE can have. */ | |
193 | ||
ac8cf67d | 194 | #define MAX_REGISTER_RAW_SIZE 8 |
5076de82 FF |
195 | |
196 | /* Largest value REGISTER_VIRTUAL_SIZE can have. */ | |
197 | ||
ac8cf67d | 198 | #define MAX_REGISTER_VIRTUAL_SIZE 8 |
5076de82 | 199 | |
5076de82 FF |
200 | /* Return the GDB type object for the "standard" data type |
201 | of data in register N. */ | |
202 | ||
031b390a | 203 | #ifndef REGISTER_VIRTUAL_TYPE |
5076de82 FF |
204 | #define REGISTER_VIRTUAL_TYPE(N) \ |
205 | (((N) >= FP0_REGNUM && (N) < FP0_REGNUM+32) \ | |
031b390a KH |
206 | ? builtin_type_float : builtin_type_int) |
207 | #endif | |
5076de82 | 208 | |
ac8cf67d PS |
209 | #if HOST_BYTE_ORDER == BIG_ENDIAN |
210 | /* All mips targets store doubles in a register pair with the least | |
211 | significant register in the lower numbered register. | |
212 | If the host is big endian, double register values need conversion between | |
213 | memory and register formats. */ | |
214 | ||
215 | #define REGISTER_CONVERT_TO_TYPE(n, type, buffer) \ | |
216 | do {if ((n) >= FP0_REGNUM && (n) < FP0_REGNUM + 32 && \ | |
217 | TYPE_CODE(type) == TYPE_CODE_FLT && TYPE_LENGTH(type) == 8) { \ | |
218 | char __temp[4]; \ | |
219 | memcpy (__temp, ((char *)(buffer))+4, 4); \ | |
220 | memcpy (((char *)(buffer))+4, (buffer), 4); \ | |
221 | memcpy (((char *)(buffer)), __temp, 4); }} while (0) | |
222 | ||
223 | #define REGISTER_CONVERT_FROM_TYPE(n, type, buffer) \ | |
224 | do {if ((n) >= FP0_REGNUM && (n) < FP0_REGNUM + 32 && \ | |
225 | TYPE_CODE(type) == TYPE_CODE_FLT && TYPE_LENGTH(type) == 8) { \ | |
226 | char __temp[4]; \ | |
227 | memcpy (__temp, ((char *)(buffer))+4, 4); \ | |
228 | memcpy (((char *)(buffer))+4, (buffer), 4); \ | |
229 | memcpy (((char *)(buffer)), __temp, 4); }} while (0) | |
230 | #endif | |
231 | ||
5076de82 | 232 | /* Store the address of the place in which to copy the structure the |
0c28fe8d | 233 | subroutine will return. Handled by mips_push_arguments. */ |
5076de82 | 234 | |
0c28fe8d | 235 | #define STORE_STRUCT_RETURN(addr, sp) /**/ |
5076de82 FF |
236 | |
237 | /* Extract from an array REGBUF containing the (raw) register state | |
238 | a function return value of type TYPE, and copy that, in virtual format, | |
239 | into VALBUF. XXX floats */ | |
240 | ||
241 | #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ | |
ac8cf67d | 242 | mips_extract_return_value(TYPE, REGBUF, VALBUF) |
5076de82 FF |
243 | |
244 | /* Write into appropriate registers a function return value | |
245 | of type TYPE, given in virtual format. */ | |
246 | ||
247 | #define STORE_RETURN_VALUE(TYPE,VALBUF) \ | |
ac8cf67d | 248 | mips_store_return_value(TYPE, VALBUF) |
5076de82 FF |
249 | |
250 | /* Extract from an array REGBUF containing the (raw) register state | |
251 | the address in which a function should return its structure value, | |
252 | as a CORE_ADDR (or an expression that can be used as one). */ | |
138dd57c JK |
253 | /* The address is passed in a0 upon entry to the function, but when |
254 | the function exits, the compiler has copied the value to v0. This | |
e8239c2f JK |
255 | convention is specified by the System V ABI, so I think we can rely |
256 | on it. */ | |
5076de82 | 257 | |
138dd57c JK |
258 | #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ |
259 | (extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \ | |
260 | REGISTER_RAW_SIZE (V0_REGNUM))) | |
5076de82 FF |
261 | |
262 | /* Structures are returned by ref in extra arg0 */ | |
263 | #define USE_STRUCT_CONVENTION(gcc_p, type) 1 | |
264 | ||
265 | \f | |
266 | /* Describe the pointer in each stack frame to the previous stack frame | |
267 | (its caller). */ | |
268 | ||
269 | /* FRAME_CHAIN takes a frame's nominal address | |
270 | and produces the frame's chain-pointer. */ | |
271 | ||
669caa9c | 272 | #define FRAME_CHAIN(thisframe) (CORE_ADDR) mips_frame_chain (thisframe) |
5076de82 FF |
273 | |
274 | /* Define other aspects of the stack frame. */ | |
275 | ||
276 | ||
277 | /* A macro that tells us whether the function invocation represented | |
278 | by FI does not have a frame on the stack associated with it. If it | |
279 | does not, FRAMELESS is set to 1, else 0. */ | |
280 | /* We handle this differently for mips, and maybe we should not */ | |
281 | ||
282 | #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) {(FRAMELESS) = 0;} | |
283 | ||
284 | /* Saved Pc. */ | |
285 | ||
286 | #define FRAME_SAVED_PC(FRAME) (mips_frame_saved_pc(FRAME)) | |
287 | ||
288 | #define FRAME_ARGS_ADDRESS(fi) (fi)->frame | |
289 | ||
290 | #define FRAME_LOCALS_ADDRESS(fi) (fi)->frame | |
291 | ||
292 | /* Return number of args passed to a frame. | |
293 | Can return -1, meaning no way to tell. */ | |
294 | ||
295 | #define FRAME_NUM_ARGS(num, fi) (num = mips_frame_num_args(fi)) | |
296 | ||
297 | /* Return number of bytes at start of arglist that are not really args. */ | |
298 | ||
299 | #define FRAME_ARGS_SKIP 0 | |
300 | ||
301 | /* Put here the code to store, into a struct frame_saved_regs, | |
302 | the addresses of the saved registers of frame described by FRAME_INFO. | |
303 | This includes special registers such as pc and fp saved in special | |
304 | ways in the stack frame. sp is even more special: | |
305 | the address we return for it IS the sp for the next frame. */ | |
306 | ||
14d79562 JK |
307 | #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ |
308 | do { \ | |
309 | if ((frame_info)->saved_regs == NULL) \ | |
310 | mips_find_saved_regs (frame_info); \ | |
311 | (frame_saved_regs) = *(frame_info)->saved_regs; \ | |
312 | (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame; \ | |
313 | } while (0) | |
5076de82 FF |
314 | |
315 | \f | |
316 | /* Things needed for making the inferior call functions. */ | |
317 | ||
318 | /* Stack has strict alignment. However, use PUSH_ARGUMENTS | |
319 | to take care of it. */ | |
320 | /*#define STACK_ALIGN(addr) (((addr)+3)&~3)*/ | |
321 | ||
322 | #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ | |
323 | sp = mips_push_arguments(nargs, args, sp, struct_return, struct_addr) | |
324 | ||
325 | /* Push an empty stack frame, to record the current PC, etc. */ | |
326 | ||
327 | #define PUSH_DUMMY_FRAME mips_push_dummy_frame() | |
328 | ||
329 | /* Discard from the stack the innermost frame, restoring all registers. */ | |
330 | ||
331 | #define POP_FRAME mips_pop_frame() | |
332 | ||
333 | #define MK_OP(op,rs,rt,offset) (((op)<<26)|((rs)<<21)|((rt)<<16)|(offset)) | |
4fbce2fd KH |
334 | #ifndef OP_LDFPR |
335 | #define OP_LDFPR 061 /* lwc1 */ | |
336 | #endif | |
337 | #ifndef OP_LDGPR | |
338 | #define OP_LDGPR 043 /* lw */ | |
339 | #endif | |
5076de82 FF |
340 | #define CALL_DUMMY_SIZE (16*4) |
341 | #define Dest_Reg 2 | |
342 | #define CALL_DUMMY {\ | |
343 | MK_OP(0,RA_REGNUM,0,8), /* jr $ra # Fake ABOUT_TO_RETURN ...*/\ | |
344 | 0, /* nop # ... to stop raw backtrace*/\ | |
345 | 0x27bd0000, /* addu sp,?0 # Pseudo prologue */\ | |
4fbce2fd KH |
346 | /* Start here; reload FP regs, then GP regs: */\ |
347 | MK_OP(OP_LDFPR,SP_REGNUM,12,0 ), /* l[wd]c1 $f12,0(sp) */\ | |
348 | MK_OP(OP_LDFPR,SP_REGNUM,13, MIPS_REGSIZE), /* l[wd]c1 $f13,{4,8}(sp) */\ | |
349 | MK_OP(OP_LDFPR,SP_REGNUM,14,2*MIPS_REGSIZE), /* l[wd]c1 $f14,{8,16}(sp) */\ | |
350 | MK_OP(OP_LDFPR,SP_REGNUM,15,3*MIPS_REGSIZE), /* l[wd]c1 $f15,{12,24}(sp) */\ | |
351 | MK_OP(OP_LDGPR,SP_REGNUM, 4,0 ), /* l[wd] $r4,0(sp) */\ | |
352 | MK_OP(OP_LDGPR,SP_REGNUM, 5, MIPS_REGSIZE), /* l[wd] $r5,{4,8}(sp) */\ | |
353 | MK_OP(OP_LDGPR,SP_REGNUM, 6,2*MIPS_REGSIZE), /* l[wd] $r6,{8,16}(sp) */\ | |
354 | MK_OP(OP_LDGPR,SP_REGNUM, 7,3*MIPS_REGSIZE), /* l[wd] $r7,{12,24}(sp) */\ | |
5076de82 FF |
355 | (017<<26)| (Dest_Reg << 16), /* lui $r31,<target upper 16 bits>*/\ |
356 | MK_OP(13,Dest_Reg,Dest_Reg,0), /* ori $r31,$r31,<lower 16 bits>*/ \ | |
357 | (Dest_Reg<<21) | (31<<11) | 9, /* jalr $r31 */\ | |
4fbce2fd | 358 | MK_OP(OP_LDGPR,SP_REGNUM, 7,3*MIPS_REGSIZE), /* l[wd] $r7,{12,24}(sp) */\ |
5076de82 FF |
359 | 0x5000d, /* bpt */\ |
360 | } | |
361 | ||
362 | #define CALL_DUMMY_START_OFFSET 12 | |
363 | ||
f0d2557c PS |
364 | #define CALL_DUMMY_BREAKPOINT_OFFSET (CALL_DUMMY_START_OFFSET + (12 * 4)) |
365 | ||
5076de82 FF |
366 | /* Insert the specified number of args and function address |
367 | into a call sequence of the above form stored at DUMMYNAME. */ | |
368 | ||
08447510 PS |
369 | /* For big endian mips machines we need to switch the order of the |
370 | words with a floating-point value (it was already coerced to a double | |
371 | by mips_push_arguments). */ | |
ac8cf67d | 372 | #define FIX_CALL_DUMMY(dummyname, start_sp, fun, nargs, args, rettype, gcc_p) \ |
97d3151a ILT |
373 | do \ |
374 | { \ | |
375 | store_unsigned_integer \ | |
376 | (dummyname + 11 * 4, 4, \ | |
377 | (extract_unsigned_integer (dummyname + 11 * 4, 4) \ | |
378 | | (((fun) >> 16) & 0xffff))); \ | |
379 | store_unsigned_integer \ | |
380 | (dummyname + 12 * 4, 4, \ | |
381 | (extract_unsigned_integer (dummyname + 12 * 4, 4) \ | |
382 | | ((fun) & 0xffff))); \ | |
daa4c5f8 | 383 | if (mips_fpu == MIPS_FPU_NONE) \ |
97d3151a ILT |
384 | { \ |
385 | store_unsigned_integer (dummyname + 3 * 4, 4, \ | |
386 | (unsigned LONGEST) 0); \ | |
387 | store_unsigned_integer (dummyname + 4 * 4, 4, \ | |
388 | (unsigned LONGEST) 0); \ | |
389 | store_unsigned_integer (dummyname + 5 * 4, 4, \ | |
390 | (unsigned LONGEST) 0); \ | |
391 | store_unsigned_integer (dummyname + 6 * 4, 4, \ | |
392 | (unsigned LONGEST) 0); \ | |
393 | } \ | |
daa4c5f8 ILT |
394 | else if (mips_fpu == MIPS_FPU_SINGLE) \ |
395 | { \ | |
396 | /* This isn't right. mips_push_arguments will call \ | |
397 | value_arg_coerce, which will convert all float arguments \ | |
398 | to doubles. If the function prototype is float, though, \ | |
399 | it will be expecting a float argument in a float \ | |
400 | register. */ \ | |
401 | store_unsigned_integer (dummyname + 4 * 4, 4, \ | |
402 | (unsigned LONGEST) 0); \ | |
403 | store_unsigned_integer (dummyname + 6 * 4, 4, \ | |
404 | (unsigned LONGEST) 0); \ | |
405 | } \ | |
97d3151a ILT |
406 | else if (TARGET_BYTE_ORDER == BIG_ENDIAN \ |
407 | && ! GDB_TARGET_IS_MIPS64) \ | |
408 | { \ | |
409 | if (nargs > 0 \ | |
410 | && TYPE_CODE (VALUE_TYPE (args[0])) == TYPE_CODE_FLT) \ | |
411 | { \ | |
412 | if (TYPE_LENGTH (VALUE_TYPE (args[0])) > 8) \ | |
413 | error ("floating point value too large to pass to function");\ | |
414 | store_unsigned_integer \ | |
415 | (dummyname + 3 * 4, 4, MK_OP (OP_LDFPR, SP_REGNUM, 12, 4));\ | |
416 | store_unsigned_integer \ | |
417 | (dummyname + 4 * 4, 4, MK_OP (OP_LDFPR, SP_REGNUM, 13, 0));\ | |
418 | } \ | |
419 | if (nargs > 1 \ | |
420 | && TYPE_CODE (VALUE_TYPE (args[1])) == TYPE_CODE_FLT) \ | |
421 | { \ | |
422 | if (TYPE_LENGTH (VALUE_TYPE (args[1])) > 8) \ | |
423 | error ("floating point value too large to pass to function");\ | |
424 | store_unsigned_integer \ | |
425 | (dummyname + 5 * 4, 4, MK_OP (OP_LDFPR, SP_REGNUM, 14, 12));\ | |
426 | store_unsigned_integer \ | |
427 | (dummyname + 6 * 4, 4, MK_OP (OP_LDFPR, SP_REGNUM, 15, 8));\ | |
428 | } \ | |
429 | } \ | |
ac8cf67d | 430 | } \ |
5076de82 FF |
431 | while (0) |
432 | ||
433 | /* There's a mess in stack frame creation. See comments in blockframe.c | |
434 | near reference to INIT_FRAME_PC_FIRST. */ | |
435 | ||
436 | #define INIT_FRAME_PC(fromleaf, prev) /* nada */ | |
437 | ||
438 | #define INIT_FRAME_PC_FIRST(fromleaf, prev) \ | |
439 | (prev)->pc = ((fromleaf) ? SAVED_PC_AFTER_CALL ((prev)->next) : \ | |
440 | (prev)->next ? FRAME_SAVED_PC ((prev)->next) : read_pc ()); | |
441 | ||
442 | /* Special symbol found in blocks associated with routines. We can hang | |
443 | mips_extra_func_info_t's off of this. */ | |
444 | ||
445 | #define MIPS_EFI_SYMBOL_NAME "__GDB_EFI_INFO__" | |
446 | ||
447 | /* Specific information about a procedure. | |
448 | This overlays the MIPS's PDR records, | |
449 | mipsread.c (ab)uses this to save memory */ | |
450 | ||
451 | typedef struct mips_extra_func_info { | |
452 | long numargs; /* number of args to procedure (was iopt) */ | |
453 | PDR pdr; /* Procedure descriptor record */ | |
454 | } *mips_extra_func_info_t; | |
455 | ||
456 | #define EXTRA_FRAME_INFO \ | |
457 | mips_extra_func_info_t proc_desc; \ | |
458 | int num_args;\ | |
459 | struct frame_saved_regs *saved_regs; | |
460 | ||
461 | #define INIT_EXTRA_FRAME_INFO(fromleaf, fci) init_extra_frame_info(fci) | |
462 | ||
463 | #define PRINT_EXTRA_FRAME_INFO(fi) \ | |
464 | { \ | |
465 | if (fi && fi->proc_desc && fi->proc_desc->pdr.framereg < NUM_REGS) \ | |
466 | printf_filtered (" frame pointer is at %s+%d\n", \ | |
467 | reg_names[fi->proc_desc->pdr.framereg], \ | |
468 | fi->proc_desc->pdr.frameoffset); \ | |
469 | } | |
470 | ||
4df6dcd1 JK |
471 | /* It takes two values to specify a frame on the MIPS. |
472 | ||
473 | In fact, the *PC* is the primary value that sets up a frame. The | |
474 | PC is looked up to see what function it's in; symbol information | |
475 | from that function tells us which register is the frame pointer | |
476 | base, and what offset from there is the "virtual frame pointer". | |
477 | (This is usually an offset from SP.) On most non-MIPS machines, | |
478 | the primary value is the SP, and the PC, if needed, disambiguates | |
479 | multiple functions with the same SP. But on the MIPS we can't do | |
480 | that since the PC is not stored in the same part of the frame every | |
481 | time. This does not seem to be a very clever way to set up frames, | |
482 | but there is nothing we can do about that). */ | |
5076de82 FF |
483 | |
484 | #define SETUP_ARBITRARY_FRAME(argc, argv) setup_arbitrary_frame (argc, argv) | |
5076de82 FF |
485 | extern struct frame_info *setup_arbitrary_frame PARAMS ((int, CORE_ADDR *)); |
486 | ||
01422144 PS |
487 | /* Convert a dbx stab register number (from `r' declaration) to a gdb REGNUM */ |
488 | ||
489 | #define STAB_REG_TO_REGNUM(num) ((num) < 32 ? (num) : (num)+FP0_REGNUM-38) | |
8b15c480 PS |
490 | |
491 | /* Convert a ecoff register number to a gdb REGNUM */ | |
492 | ||
493 | #define ECOFF_REG_TO_REGNUM(num) ((num) < 32 ? (num) : (num)+FP0_REGNUM-32) |