/* Parameters for execution on a 68000 series machine.
- Copyright (C) 1986, 1987, 1989, 1990 Free Software Foundation, Inc.
+ Copyright 1986, 1987, 1989, 1990, 1992 Free Software Foundation, Inc.
This file is part of GDB.
#if !defined(SKIP_PROLOGUE)
#define SKIP_PROLOGUE(ip) {(ip) = m68k_skip_prologue(ip);}
-extern CORE_ADDR m68k_skip_prologue ();
+extern CORE_ADDR m68k_skip_prologue PARAMS ((CORE_ADDR ip));
#endif
/* Immediately after a function call, return the saved pc.
/* Put the declaration out here because if it's in the macros, PCC
will complain. */
-extern struct ext_format ext_format_68881;
+extern const struct ext_format ext_format_68881;
/* Convert data from raw format for register REGNUM
to virtual format for register REGNUM. */
if ((REGNUM) >= FP0_REGNUM && (REGNUM) < FPC_REGNUM) \
ieee_extended_to_double (&ext_format_68881, (FROM), (double *)(TO)); \
else \
- bcopy ((FROM), (TO), 4); \
+ memcpy ((TO), (FROM), 4); \
}
/* Convert data from virtual format for register REGNUM
if ((REGNUM) >= FP0_REGNUM && (REGNUM) < FPC_REGNUM) \
double_to_ieee_extended (&ext_format_68881, (double *)(FROM), (TO)); \
else \
- bcopy ((FROM), (TO), 4); \
+ memcpy ((TO), (FROM), 4); \
}
/* Return the GDB type object for the "standard" data type
/* Convert data from raw format for register REGNUM
to virtual format for register REGNUM. */
-#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) bcopy ((FROM), (TO), 4);
+#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) memcpy ((TO), (FROM), 4);
/* Convert data from virtual format for register REGNUM
to raw format for register REGNUM. */
-#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) bcopy ((FROM), (TO), 4);
+#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) memcpy ((TO), (FROM), 4);
/* Return the GDB type object for the "standard" data type
of data in register N. */
#if !defined (EXTRACT_RETURN_VALUE)
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy ((char *)(REGBUF) + \
+ memcpy ((VALBUF), \
+ (char *)(REGBUF) + \
(TYPE_LENGTH(TYPE) >= 4 ? 0 : 4 - TYPE_LENGTH(TYPE)), \
- VALBUF, TYPE_LENGTH(TYPE))
+ TYPE_LENGTH(TYPE))
#endif
/* Write into appropriate registers a function return value
/* 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. */
#define PUSH_DUMMY_FRAME { m68k_push_dummy_frame (); }
+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 (); }
+/* Offset from SP to first arg on stack at first instruction of a function */
+
+#define SP_ARG0 (1 * 4)