/* Describe the pointer in each stack frame to the previous stack frame
(its caller). */
-/* FRAME_CHAIN takes a frame's nominal address
- and produces the frame's chain-pointer.
-
- However, if FRAME_CHAIN_VALID returns zero,
- it means the given frame is the outermost one and has no caller. */
-
-/* In the case of the 68000, the frame's nominal address
+/* FRAME_CHAIN takes a frame's nominal address and produces the frame's
+ chain-pointer.
+ In the case of the 68000, the frame's nominal address
is the address of a 4-byte word containing the calling frame's address. */
#define FRAME_CHAIN(thisframe) \
- (outside_startup_file ((thisframe)->pc) ? \
+ (!inside_entry_file ((thisframe)->pc) ? \
read_memory_integer ((thisframe)->frame, 4) :\
0)
-#if defined (FRAME_CHAIN_VALID_ALTERNATE)
-
-/* Use the alternate method of avoiding running up off the end of
- the frame chain or following frames back into the startup code.
- See the comments in blockframe.c */
-
-#define FRAME_CHAIN_VALID(chain, thisframe) \
- (chain != 0 \
- && !(inside_main_scope ((thisframe)->pc)) \
- && !(inside_entry_scope ((thisframe)->pc)))
-
-#else
-
-#define FRAME_CHAIN_VALID(chain, thisframe) \
- (chain != 0 && outside_startup_file (FRAME_SAVED_PC (thisframe)))
-
-#endif /* FRAME_CHAIN_VALID_ALTERNATE */
-
/* Define other aspects of the stack frame. */
/* A macro that tells us whether the function invocation represented
for (regnum = 15; regnum >= 0; regnum--, regmask >>= 1) \
if (regmask & 1) \
(frame_saved_regs).regs[regnum] = (next_addr -= 4); } \
- else if (0x2f00 == 0xfff0 & read_memory_integer (pc, 2)) \
+ else if (0x2f00 == (0xfff0 & read_memory_integer (pc, 2))) \
{ regnum = 0xf & read_memory_integer (pc, 2); pc += 2; \
(frame_saved_regs).regs[regnum] = (next_addr -= 4); } \
/* clrw -(sp); movw ccr,-(sp) may follow. */ \
#endif /* HAVE_68881 */
/* Insert the specified number of args and function address
- into a call sequence of the above form stored at DUMMYNAME. */
+ into a call sequence of the above form stored at DUMMYNAME.
+ We use the BFD routines to store a big-endian value of known size. */
#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
-{ *(int *)((char *) dummyname + CALL_DUMMY_START_OFFSET + 2) = fun; \
- *(int *)((char *) dummyname + CALL_DUMMY_START_OFFSET + 8) = nargs * 4; }
+{ _do_putb32 (fun, (char *) dummyname + CALL_DUMMY_START_OFFSET + 2); \
+ _do_putb32 (nargs*4, (char *) dummyname + CALL_DUMMY_START_OFFSET + 8); }
/* Push an empty stack frame, to record the current PC, etc. */
extern void m68k_push_dummy_frame PARAMS ((void));
+extern void m68k_pop_frame PARAMS ((void));
+
/* Discard from the stack the innermost frame, restoring all registers. */
#define POP_FRAME { m68k_pop_frame (); }
-extern void m68k_pop_frame PARAMS ((void));
-
+/* Offset from SP to first arg on stack at first instruction of a function */
+#define SP_ARG0 (1 * 4)