Remove locally duplicated code for calling functions in the inferior. The
[deliverable/binutils-gdb.git] / gdb / tm-68k.h
1 /* Parameters for execution on a 68000 series machine.
2 Copyright (C) 1986, 1987, 1989, 1990 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
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.
10
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.
15
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 /* Generic 68000 stuff, to be included by other tm-*.h files.
21 Define HAVE_68881 if that is the case. */
22
23 #if defined (HAVE_68881)
24 #define IEEE_FLOAT 1
25 #endif
26
27 /* Define the bit, byte, and word ordering of the machine. */
28 #define TARGET_BYTE_ORDER BIG_ENDIAN
29
30 /* Offset from address of function to start of its code.
31 Zero on most machines. */
32
33 #define FUNCTION_START_OFFSET 0
34
35 /* Advance PC across any function entry prologue instructions
36 to reach some "real" code. */
37
38 #define SKIP_PROLOGUE(pc) \
39 { register int op = read_memory_integer (pc, 2); \
40 if (op == 0047126) \
41 pc += 4; /* Skip link #word */ \
42 else if (op == 0044016) \
43 pc += 6; /* Skip link #long */ \
44 /* Not sure why branches are here. */ \
45 /* From m-isi.h, m-altos.h */ \
46 else if (op == 0060000) \
47 pc += 4; /* Skip bra #word */ \
48 else if (op == 00600377) \
49 pc += 6; /* skip bra #long */ \
50 else if ((op & 0177400) == 0060000) \
51 pc += 2; /* skip bra #char */ \
52 }
53
54 /* Immediately after a function call, return the saved pc.
55 Can't always go through the frames for this because on some machines
56 the new frame is not set up until the new function executes
57 some instructions. */
58
59 #define SAVED_PC_AFTER_CALL(frame) \
60 read_memory_integer (read_register (SP_REGNUM), 4)
61
62 /* Stack grows downward. */
63
64 #define INNER_THAN <
65
66 /* Sequence of bytes for breakpoint instruction.
67 This is a TRAP instruction. The last 4 bits (0xf below) is the
68 vector. Systems which don't use 0xf should define BPT_VECTOR
69 themselves before including this file. */
70
71 #if !defined BPT_VECTOR
72 #define BPT_VECTOR 0xf
73 #endif
74
75 #if !defined (BREAKPOINT)
76 #define BREAKPOINT {0x4e, (0x40 | BPT_VECTOR)}
77 #endif
78
79 /* If your kernel resets the pc after the trap happens you may need to
80 define this before including this file. */
81
82 #if !defined (DECR_PC_AFTER_BREAK)
83 #define DECR_PC_AFTER_BREAK 2
84 #endif
85
86 /* Nonzero if instruction at PC is a return instruction. */
87 /* Allow any of the return instructions, including a trapv and a return
88 from interupt. */
89
90 #define ABOUT_TO_RETURN(pc) ((read_memory_integer (pc, 2) & ~0x3) == 0x4e74)
91
92 /* Return 1 if P points to an invalid floating point value. */
93
94 #define INVALID_FLOAT(p, len) 0 /* Just a first guess; not checked */
95
96 /* Say how long registers are. */
97
98 #define REGISTER_TYPE long
99
100 #if defined (HAVE_68881)
101 # if defined (GDB_TARGET_IS_SUN3)
102 /* Sun3 status includes fpflags, which shows whether the FPU has been used
103 by the process, and whether the FPU was done with an instruction or
104 was interrupted in the middle of a long instruction. See
105 <machine/reg.h>. */
106 /* a&d, pc,sr, fp, fpstat, fpflags */
107 # define NUM_REGS 31
108 # define REGISTER_BYTES (16*4 + 8 + 8*12 + 3*4 + 4)
109 # else /* Not sun3. */
110 # define NUM_REGS 29
111 # define REGISTER_BYTES (16*4 + 8 + 8*12 + 3*4)
112 # endif /* Not sun3. */
113 #else /* No 68881. */
114 # define NUM_REGS 18
115 # define REGISTER_BYTES (16*4 + 8)
116 #endif /* No 68881. */
117
118 /* Index within `registers' of the first byte of the space for
119 register N. */
120
121 #if defined (HAVE_68881)
122 #define REGISTER_BYTE(N) \
123 ((N) >= FPC_REGNUM ? (((N) - FPC_REGNUM) * 4) + 168 \
124 : (N) >= FP0_REGNUM ? (((N) - FP0_REGNUM) * 12) + 72 \
125 : (N) * 4)
126
127 /* Number of bytes of storage in the actual machine representation
128 for register N. On the 68000, all regs are 4 bytes
129 except the floating point regs which are 12 bytes. */
130 /* Note that the unsigned cast here forces the result of the
131 subtraction to very high positive values if N < FP0_REGNUM */
132
133 #define REGISTER_RAW_SIZE(N) (((unsigned)(N) - FP0_REGNUM) < 8 ? 12 : 4)
134
135 /* Number of bytes of storage in the program's representation
136 for register N. On the 68000, all regs are 4 bytes
137 except the floating point regs which are 8-byte doubles. */
138
139 #define REGISTER_VIRTUAL_SIZE(N) (((unsigned)(N) - FP0_REGNUM) < 8 ? 8 : 4)
140
141 /* Largest value REGISTER_RAW_SIZE can have. */
142
143 #define MAX_REGISTER_RAW_SIZE 12
144
145 /* Largest value REGISTER_VIRTUAL_SIZE can have. */
146
147 #define MAX_REGISTER_VIRTUAL_SIZE 8
148
149 /* Nonzero if register N requires conversion
150 from raw format to virtual format. */
151
152 #define REGISTER_CONVERTIBLE(N) (((unsigned)(N) - FP0_REGNUM) < 8)
153
154 /* Put the declaration out here because if it's in the macros, PCC
155 will complain. */
156 extern struct ext_format ext_format_68881;
157
158 /* Convert data from raw format for register REGNUM
159 to virtual format for register REGNUM. */
160
161 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
162 { \
163 if ((REGNUM) >= FP0_REGNUM && (REGNUM) < FPC_REGNUM) \
164 ieee_extended_to_double (&ext_format_68881, (FROM), (double *)(TO)); \
165 else \
166 bcopy ((FROM), (TO), 4); \
167 }
168
169 /* Convert data from virtual format for register REGNUM
170 to raw format for register REGNUM. */
171
172 #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
173 { \
174 if ((REGNUM) >= FP0_REGNUM && (REGNUM) < FPC_REGNUM) \
175 double_to_ieee_extended (&ext_format_68881, (double *)(FROM), (TO)); \
176 else \
177 bcopy ((FROM), (TO), 4); \
178 }
179
180 /* Return the GDB type object for the "standard" data type
181 of data in register N. */
182 /* Note, for registers which contain addresses return
183 pointer to void, not pointer to char, because we don't
184 want to attempt to print the string after printing the address. */
185 #define REGISTER_VIRTUAL_TYPE(N) \
186 (((unsigned)(N) - FP0_REGNUM) < 8 ? builtin_type_double : \
187 (N) == PC_REGNUM || (N) == FP_REGNUM || (N) == SP_REGNUM ? \
188 lookup_pointer_type (builtin_type_void) : builtin_type_int)
189
190 #else /* no 68881. */
191 /* Index within `registers' of the first byte of the space for
192 register N. */
193
194 #define REGISTER_BYTE(N) ((N) * 4)
195
196 /* Number of bytes of storage in the actual machine representation
197 for register N. On the 68000, all regs are 4 bytes. */
198
199 #define REGISTER_RAW_SIZE(N) 4
200
201 /* Number of bytes of storage in the program's representation
202 for register N. On the 68000, all regs are 4 bytes. */
203
204 #define REGISTER_VIRTUAL_SIZE(N) 4
205
206 /* Largest value REGISTER_RAW_SIZE can have. */
207
208 #define MAX_REGISTER_RAW_SIZE 4
209
210 /* Largest value REGISTER_VIRTUAL_SIZE can have. */
211
212 #define MAX_REGISTER_VIRTUAL_SIZE 4
213
214 /* Nonzero if register N requires conversion
215 from raw format to virtual format. */
216
217 #define REGISTER_CONVERTIBLE(N) 0
218
219 /* Convert data from raw format for register REGNUM
220 to virtual format for register REGNUM. */
221
222 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) bcopy ((FROM), (TO), 4);
223
224 /* Convert data from virtual format for register REGNUM
225 to raw format for register REGNUM. */
226
227 #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) bcopy ((FROM), (TO), 4);
228
229 /* Return the GDB type object for the "standard" data type
230 of data in register N. */
231
232 #define REGISTER_VIRTUAL_TYPE(N) builtin_type_int
233
234 #endif /* No 68881. */
235
236 /* Initializer for an array of names of registers.
237 Entries beyond the first NUM_REGS are ignored. */
238
239 #define REGISTER_NAMES \
240 {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \
241 "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp", \
242 "ps", "pc", \
243 "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7", \
244 "fpcontrol", "fpstatus", "fpiaddr", "fpcode", "fpflags" }
245
246 /* Register numbers of various important registers.
247 Note that some of these values are "real" register numbers,
248 and correspond to the general registers of the machine,
249 and some are "phony" register numbers which are too large
250 to be actual register numbers as far as the user is concerned
251 but do serve to get the desired values when passed to read_register. */
252
253 #define A1_REGNUM 9
254 #define FP_REGNUM 14 /* Contains address of executing stack frame */
255 #define SP_REGNUM 15 /* Contains address of top of stack */
256 #define PS_REGNUM 16 /* Contains processor status */
257 #define PC_REGNUM 17 /* Contains program counter */
258 #if defined (HAVE_68881)
259 #define FP0_REGNUM 18 /* Floating point register 0 */
260 #define FPC_REGNUM 26 /* 68881 control register */
261 #define FPS_REGNUM 27 /* 68881 status register */
262 #define FPI_REGNUM 28 /* 68881 iaddr register */
263 #endif /* 68881. */
264
265 /* Store the address of the place in which to copy the structure the
266 subroutine will return. This is called from call_function. */
267
268 #define STORE_STRUCT_RETURN(ADDR, SP) \
269 { write_register (A1_REGNUM, (ADDR)); }
270
271 /* Extract from an array REGBUF containing the (raw) register state
272 a function return value of type TYPE, and copy that, in virtual format,
273 into VALBUF. This is assuming that floating point values are returned
274 as doubles in d0/d1. */
275
276 #if !defined (EXTRACT_RETURN_VALUE)
277 #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
278 bcopy (REGBUF, VALBUF, TYPE_LENGTH (TYPE))
279 #endif
280
281 /* Write into appropriate registers a function return value
282 of type TYPE, given in virtual format. Assumes floats are passed
283 in d0/d1. */
284
285 #if !defined (STORE_RETURN_VALUE)
286 #define STORE_RETURN_VALUE(TYPE,VALBUF) \
287 write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
288 #endif
289
290 /* Extract from an array REGBUF containing the (raw) register state
291 the address in which a function should return its structure value,
292 as a CORE_ADDR (or an expression that can be used as one). */
293
294 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF))
295 \f
296 /* Describe the pointer in each stack frame to the previous stack frame
297 (its caller). */
298
299 /* FRAME_CHAIN takes a frame's nominal address
300 and produces the frame's chain-pointer.
301
302 FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address
303 and produces the nominal address of the caller frame.
304
305 However, if FRAME_CHAIN_VALID returns zero,
306 it means the given frame is the outermost one and has no caller.
307 In that case, FRAME_CHAIN_COMBINE is not used. */
308
309 /* In the case of the 68000, the frame's nominal address
310 is the address of a 4-byte word containing the calling frame's address. */
311
312 #define FRAME_CHAIN(thisframe) \
313 (outside_startup_file ((thisframe)->pc) ? \
314 read_memory_integer ((thisframe)->frame, 4) :\
315 0)
316
317 #if defined (FRAME_CHAIN_VALID_ALTERNATE)
318
319 /* Use the alternate method of avoiding running up off the end of
320 the frame chain or following frames back into the startup code.
321 See the comments in blockframe.c */
322
323 #define FRAME_CHAIN_VALID(chain, thisframe) \
324 (chain != 0 \
325 && !(inside_main_scope ((thisframe)->pc)) \
326 && !(inside_entry_scope ((thisframe)->pc)))
327
328 #else
329
330 #define FRAME_CHAIN_VALID(chain, thisframe) \
331 (chain != 0 && outside_startup_file (FRAME_SAVED_PC (thisframe)))
332
333 #endif /* FRAME_CHAIN_VALID_ALTERNATE */
334
335 #define FRAME_CHAIN_COMBINE(chain, thisframe) (chain)
336
337 /* Define other aspects of the stack frame. */
338
339 /* A macro that tells us whether the function invocation represented
340 by FI does not have a frame on the stack associated with it. If it
341 does not, FRAMELESS is set to 1, else 0. */
342 #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
343 (FRAMELESS) = frameless_look_for_prologue(FI)
344
345 #define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4))
346
347 #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
348
349 #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
350
351 /* Set VAL to the number of args passed to frame described by FI.
352 Can set VAL to -1, meaning no way to tell. */
353
354 /* We can't tell how many args there are
355 now that the C compiler delays popping them. */
356 #if !defined (FRAME_NUM_ARGS)
357 #define FRAME_NUM_ARGS(val,fi) (val = -1)
358 #endif
359
360 /* Return number of bytes at start of arglist that are not really args. */
361
362 #define FRAME_ARGS_SKIP 8
363
364 /* Put here the code to store, into a struct frame_saved_regs,
365 the addresses of the saved registers of frame described by FRAME_INFO.
366 This includes special registers such as pc and fp saved in special
367 ways in the stack frame. sp is even more special:
368 the address we return for it IS the sp for the next frame. */
369
370 #if !defined (FRAME_FIND_SAVED_REGS)
371 #if defined (HAVE_68881)
372 #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
373 { register int regnum; \
374 register int regmask; \
375 register CORE_ADDR next_addr; \
376 register CORE_ADDR pc; \
377 int nextinsn; \
378 bzero (&frame_saved_regs, sizeof frame_saved_regs); \
379 if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 8*12 - 4 \
380 && (frame_info)->pc <= (frame_info)->frame) \
381 { next_addr = (frame_info)->frame; \
382 pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 8*12 - 4; }\
383 else \
384 { pc = get_pc_function_start ((frame_info)->pc); \
385 /* Verify we have a link a6 instruction next; \
386 if not we lose. If we win, find the address above the saved \
387 regs using the amount of storage from the link instruction. */\
388 if (044016 == read_memory_integer (pc, 2)) \
389 next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 4), pc+=4; \
390 else if (047126 == read_memory_integer (pc, 2)) \
391 next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 2), pc+=2; \
392 else goto lose; \
393 /* If have an addal #-n, sp next, adjust next_addr. */ \
394 if ((0177777 & read_memory_integer (pc, 2)) == 0157774) \
395 next_addr += read_memory_integer (pc += 2, 4), pc += 4; \
396 } \
397 /* next should be a moveml to (sp) or -(sp) or a movl r,-(sp) */ \
398 regmask = read_memory_integer (pc + 2, 2); \
399 /* But before that can come an fmovem. Check for it. */ \
400 nextinsn = 0xffff & read_memory_integer (pc, 2); \
401 if (0xf227 == nextinsn \
402 && (regmask & 0xff00) == 0xe000) \
403 { pc += 4; /* Regmask's low bit is for register fp7, the first pushed */ \
404 for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--, regmask >>= 1) \
405 if (regmask & 1) \
406 (frame_saved_regs).regs[regnum] = (next_addr -= 12); \
407 regmask = read_memory_integer (pc + 2, 2); } \
408 if (0044327 == read_memory_integer (pc, 2)) \
409 { pc += 4; /* Regmask's low bit is for register 0, the first written */ \
410 for (regnum = 0; regnum < 16; regnum++, regmask >>= 1) \
411 if (regmask & 1) \
412 (frame_saved_regs).regs[regnum] = (next_addr += 4) - 4; } \
413 else if (0044347 == read_memory_integer (pc, 2)) \
414 { pc += 4; /* Regmask's low bit is for register 15, the first pushed */ \
415 for (regnum = 15; regnum >= 0; regnum--, regmask >>= 1) \
416 if (regmask & 1) \
417 (frame_saved_regs).regs[regnum] = (next_addr -= 4); } \
418 else if (0x2f00 == (0xfff0 & read_memory_integer (pc, 2))) \
419 { regnum = 0xf & read_memory_integer (pc, 2); pc += 2; \
420 (frame_saved_regs).regs[regnum] = (next_addr -= 4); } \
421 /* fmovemx to index of sp may follow. */ \
422 regmask = read_memory_integer (pc + 2, 2); \
423 nextinsn = 0xffff & read_memory_integer (pc, 2); \
424 if (0xf236 == nextinsn \
425 && (regmask & 0xff00) == 0xf000) \
426 { pc += 10; /* Regmask's low bit is for register fp0, the first written */ \
427 for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--, regmask >>= 1) \
428 if (regmask & 1) \
429 (frame_saved_regs).regs[regnum] = (next_addr += 12) - 12; \
430 regmask = read_memory_integer (pc + 2, 2); } \
431 /* clrw -(sp); movw ccr,-(sp) may follow. */ \
432 if (0x426742e7 == read_memory_integer (pc, 4)) \
433 (frame_saved_regs).regs[PS_REGNUM] = (next_addr -= 4); \
434 lose: ; \
435 (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame + 8; \
436 (frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame; \
437 (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 4; \
438 }
439 #else /* no 68881. */
440 #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
441 { register int regnum; \
442 register int regmask; \
443 register CORE_ADDR next_addr; \
444 register CORE_ADDR pc; \
445 bzero (&frame_saved_regs, sizeof frame_saved_regs); \
446 if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 4 \
447 && (frame_info)->pc <= (frame_info)->frame) \
448 { next_addr = (frame_info)->frame; \
449 pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 4; }\
450 else \
451 { pc = get_pc_function_start ((frame_info)->pc); \
452 /* Verify we have a link a6 instruction next; \
453 if not we lose. If we win, find the address above the saved \
454 regs using the amount of storage from the link instruction. */\
455 if (044016 == read_memory_integer (pc, 2)) \
456 next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 4), pc+=4; \
457 else if (047126 == read_memory_integer (pc, 2)) \
458 next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 2), pc+=2; \
459 else goto lose; \
460 /* If have an addal #-n, sp next, adjust next_addr. */ \
461 if ((0177777 & read_memory_integer (pc, 2)) == 0157774) \
462 next_addr += read_memory_integer (pc += 2, 4), pc += 4; \
463 } \
464 /* next should be a moveml to (sp) or -(sp) or a movl r,-(sp) */ \
465 regmask = read_memory_integer (pc + 2, 2); \
466 if (0044327 == read_memory_integer (pc, 2)) \
467 { pc += 4; /* Regmask's low bit is for register 0, the first written */ \
468 for (regnum = 0; regnum < 16; regnum++, regmask >>= 1) \
469 if (regmask & 1) \
470 (frame_saved_regs).regs[regnum] = (next_addr += 4) - 4; } \
471 else if (0044347 == read_memory_integer (pc, 2)) \
472 { pc += 4; /* Regmask's low bit is for register 15, the first pushed */ \
473 for (regnum = 15; regnum >= 0; regnum--, regmask >>= 1) \
474 if (regmask & 1) \
475 (frame_saved_regs).regs[regnum] = (next_addr -= 4); } \
476 else if (0x2f00 == 0xfff0 & read_memory_integer (pc, 2)) \
477 { regnum = 0xf & read_memory_integer (pc, 2); pc += 2; \
478 (frame_saved_regs).regs[regnum] = (next_addr -= 4); } \
479 /* clrw -(sp); movw ccr,-(sp) may follow. */ \
480 if (0x426742e7 == read_memory_integer (pc, 4)) \
481 (frame_saved_regs).regs[PS_REGNUM] = (next_addr -= 4); \
482 lose: ; \
483 (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame + 8; \
484 (frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame; \
485 (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 4; \
486 }
487 #endif /* no 68881. */
488 #endif /* no FIND_FRAME_SAVED_REGS. */
489
490 \f
491 /* Things needed for making the inferior call functions.
492 It seems like every m68k based machine has almost identical definitions
493 in the individual machine's configuration files. Most other cpu types
494 (mips, i386, etc) have routines in their *-tdep.c files to handle this
495 for most configurations. The m68k family should be able to do this as
496 well. These macros can still be overridden when necessary. */
497
498 /* The CALL_DUMMY macro is the sequence of instructions, as disassembled
499 by gdb itself:
500
501 fmovemx fp0-fp7,sp@- 0xf227 0xe0ff
502 moveml d0-a5,sp@- 0x48e7 0xfffc
503 clrw sp@- 0x4267
504 movew ccr,sp@- 0x42e7
505
506 /..* The arguments are pushed at this point by GDB;
507 no code is needed in the dummy for this.
508 The CALL_DUMMY_START_OFFSET gives the position of
509 the following jsr instruction. *../
510
511 jsr @#0x32323232 0x4eb9 0x3232 0x3232
512 addal #0x69696969,sp 0xdffc 0x6969 0x6969
513 trap #<your BPT_VECTOR number here> 0x4e4?
514 nop 0x4e71
515
516 Note this is CALL_DUMMY_LENGTH bytes (28 for the above example).
517 We actually start executing at the jsr, since the pushing of the
518 registers is done by PUSH_DUMMY_FRAME. If this were real code,
519 the arguments for the function called by the jsr would be pushed
520 between the moveml and the jsr, and we could allow it to execute through.
521 But the arguments have to be pushed by GDB after the PUSH_DUMMY_FRAME is
522 done, and we cannot allow the moveml to push the registers again lest
523 they be taken for the arguments. */
524
525 #if defined (HAVE_68881)
526
527 #define CALL_DUMMY {0xf227e0ff, 0x48e7fffc, 0x426742e7, 0x4eb93232, 0x3232dffc, 0x69696969, (0x4e404e71 | (BPT_VECTOR << 16))}
528 #define CALL_DUMMY_LENGTH 28 /* Size of CALL_DUMMY */
529 #define CALL_DUMMY_START_OFFSET 12 /* Offset to jsr instruction*/
530
531 #else
532
533 #define CALL_DUMMY {0x48e7fffc, 0x426742e7, 0x4eb93232, 0x3232dffc, 0x69696969, (0x4e404e71 | (BPT_VECTOR << 16))}
534 #define CALL_DUMMY_LENGTH 24 /* Size of CALL_DUMMY */
535 #define CALL_DUMMY_START_OFFSET 8 /* Offset to jsr instruction*/
536
537 #endif /* HAVE_68881 */
538
539 /* Insert the specified number of args and function address
540 into a call sequence of the above form stored at DUMMYNAME. */
541
542 #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
543 { *(int *)((char *) dummyname + CALL_DUMMY_START_OFFSET + 2) = fun; \
544 *(int *)((char *) dummyname + CALL_DUMMY_START_OFFSET + 8) = nargs * 4; }
545
546 /* Push an empty stack frame, to record the current PC, etc. */
547
548 #define PUSH_DUMMY_FRAME { m68k_push_dummy_frame (); }
549
550 /* Discard from the stack the innermost frame, restoring all registers. */
551
552 #define POP_FRAME { m68k_pop_frame (); }
553
This page took 0.041386 seconds and 5 git commands to generate.