-/* Copyright (C) 1986, 1987, 1988, 1989, 1990 Free Software Foundation, Inc.
+/* Target machine description for generic Motorola 88000, for GDB.
+ Copyright 1986, 1987, 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
This file is part of GDB.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-/* This is currently for a 88000 running DGUX. If other 88k ports are
- done, OS-specific stuff should be moved (see tm-68k.h, for example). */
/* g++ support is not yet included. */
-#include "tdesc.h"
-
-#if !defined (DGUX)
-#define DGUX 1
-#endif
-
#define TARGET_BYTE_ORDER BIG_ENDIAN
-#define EXTRA_SYMTAB_INFO int coffsem;
-
-/* This is not a CREATE_INFERIOR_HOOK because it also applies to
- remote debugging. */
-#define START_INFERIOR_HOOK() \
- { \
- extern int safe_to_init_tdesc_context; \
- extern dc_handle_t tdesc_handle; \
- \
- safe_to_init_tdesc_context = 0; \
- if (tdesc_handle) \
- { \
- dc_terminate (tdesc_handle); \
- tdesc_handle = 0; \
- } \
- }
-
-dc_dcontext_t get_prev_context ();
-extern int stack_error;
-
-#define EXTRA_FRAME_INFO dc_dcontext_t frame_context;
-#define INIT_EXTRA_FRAME_INFO(fromleaf, fci) \
- { \
- if (fci->next_frame != NULL) \
- { \
- extern jmp_buf stack_jmp; \
- struct frame_info *next_frame = fci->next; \
- /* The call to get_prev_context */ \
- /* will update current_context for us. */ \
- stack_error = 1; \
- if (!setjmp (stack_jmp)) \
- { \
- fci->frame_context \
- = get_prev_context (next_frame->frame_context); \
- stack_error = 0; \
- } \
- else \
- { \
- stack_error = 0; \
- next_frame->prev = 0; \
- return 0; \
- } \
- if (!fci->frame_context) \
- { \
- next_frame->prev = 0; \
- return 0; \
- } \
- } \
- else \
- { \
- /* We are creating an arbitrary frame */ \
- /* (i.e. we are in create_new_frame). */ \
- extern dc_dcontext_t current_context; \
- \
- fci->frame_context = current_context; \
- } \
- }
-
-#define INIT_FRAME_PC(fromleaf, prev) \
- { \
- prev->pc = dc_location (prev->frame_context); \
- prev->frame = get_frame_base (prev->pc); \
- }
+/* We cache information about saved registers in the frame structure,
+ to save us from having to re-scan function prologues every time
+ a register in a non-current frame is accessed. */
-#define IEEE_FLOAT
+#define EXTRA_FRAME_INFO \
+ struct frame_saved_regs *fsr; \
+ CORE_ADDR locals_pointer; \
+ CORE_ADDR args_pointer;
-/* Text Description (TDESC) is used by m88k to maintain stack & reg info */
+/* Zero the frame_saved_regs pointer when the frame is initialized,
+ so that FRAME_FIND_SAVED_REGS () will know to allocate and
+ initialize a frame_saved_regs struct the first time it is called.
+ Set the arg_pointer to -1, which is not valid; 0 and other values
+ indicate real, cached values. */
-#define TDESC
+#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \
+ init_extra_frame_info (fromleaf, fi)
+extern void init_extra_frame_info ();
+
+#define IEEE_FLOAT
/* Define this if the C compiler puts an underscore at the front
of external names before giving them to the linker. */
#define NAMES_HAVE_UNDERSCORE
-/* Hook for read_relative_register_raw_bytes */
-
-#define READ_RELATIVE_REGISTER_RAW_BYTES
-
/* Offset from address of function to start of its code.
Zero on most machines. */
/* Advance PC across any function entry prologue instructions
to reach some "real" code. */
-#define SKIP_PROLOGUE(frompc) 0
+#define SKIP_PROLOGUE(frompc) \
+ skip_prologue (frompc)
+extern CORE_ADDR skip_prologue ();
/* The m88k kernel aligns all instructions on 4-byte boundaries. The
kernel also uses the least significant two bits for its own hocus
some instructions. */
#define SAVED_PC_AFTER_CALL(frame) \
- (read_register (SRP_REGNUM) & (~3))
-
-/* Address of end of stack space. */
-
-#define STACK_END_ADDR 0xF0000000
-
-/* Stack grows downward. */
-
-#define INNER_THAN <
-
-/* Sequence of bytes for breakpoint instruction. */
-
-/* instruction 0xF000D1FF is 'tb0 0,r0,511'
- If Bit bit 0 of r0 is clear (always true),
- initiate exception processing (trap).
- */
-#define BREAKPOINT {0xF0, 0x00, 0xD1, 0xFF}
-
-/* Address of end of stack space. */
-
-#define STACK_END_ADDR 0xF0000000
+ (ADDR_BITS_REMOVE (read_register (SRP_REGNUM)))
/* Stack grows downward. */
#define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 2) == 0xF800)
/* Return 1 if P points to an invalid floating point value.
- LEN is the length in bytes -- not relevant on the 386. */
+ LEN is the length in bytes. */
#define INVALID_FLOAT(p, len) IEEE_isNAN(p,len)
"fpit",\
"fpsr",\
"fpcr",\
- };
+ }
/* Register numbers of various important registers.
#define SRP_REGNUM 1 /* Contains subroutine return pointer */
#define RV_REGNUM 2 /* Contains simple return values */
#define SRA_REGNUM 12 /* Contains address of struct return values */
-#define FP_REGNUM 30 /* Contains address of executing stack frame */
+#define FP_REGNUM 31 /* Reg fetched to locate frame when pgm stops */
#define SP_REGNUM 31 /* Contains address of top of stack */
#define SXIP_REGNUM 35 /* Contains Shadow Execute Instruction Pointer */
#define SNIP_REGNUM 36 /* Contains Shadow Next Instruction Pointer */
#define SHIFT_INST_REGS
+/* Number of bytes of storage in the actual machine representation
+ for register N. */
+
+#define REGISTER_RAW_SIZE(N) 4
+
/* Total amount of space needed to store our copies of the machine's
register state, the array `registers'. */
-#define REGISTER_BYTES (NUM_REGS * sizeof(REGISTER_TYPE))
+#define REGISTER_BYTES (NUM_REGS * REGISTER_RAW_SIZE(0))
/* Index within `registers' of the first byte of the space for
register N. */
-#define REGISTER_BYTE(N) ((N)*sizeof(REGISTER_TYPE))
-
-/* Number of bytes of storage in the actual machine representation
- for register N. */
-
-#define REGISTER_RAW_SIZE(N) (sizeof(REGISTER_TYPE))
+#define REGISTER_BYTE(N) ((N)*REGISTER_RAW_SIZE(0))
/* Number of bytes of storage in the program's representation
for register N. */
-#define REGISTER_VIRTUAL_SIZE(N) (sizeof(REGISTER_TYPE))
+#define REGISTER_VIRTUAL_SIZE(N) (REGISTER_RAW_SIZE(N))
/* Largest value REGISTER_RAW_SIZE can have. */
-#define MAX_REGISTER_RAW_SIZE (sizeof(REGISTER_TYPE))
+#define MAX_REGISTER_RAW_SIZE (REGISTER_RAW_SIZE(0))
/* Largest value REGISTER_VIRTUAL_SIZE can have.
/* Are FPS1, FPS2, FPR "virtual" regisers? */
-#define MAX_REGISTER_VIRTUAL_SIZE (sizeof(REGISTER_TYPE))
+#define MAX_REGISTER_VIRTUAL_SIZE (REGISTER_RAW_SIZE(0))
/* Nonzero if register N requires conversion
from raw format to virtual format. */
/* 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), (sizeof(REGISTER_TYPE)));}
+#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
+ {bcopy ((FROM), (TO), REGISTER_RAW_SIZE (REGNUM));}
/* 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), (sizeof(REGISTER_TYPE)));}
+#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO)
+ {bcopy ((FROM), (TO), REGISTER_RAW_SIZE (REGNUM));}
/* Return the GDB type object for the "standard" data type
of data in register N. */
of type TYPE, given in virtual format. */
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
- write_register_bytes (2*sizeof(void*), (VALBUF), TYPE_LENGTH (TYPE))
+ write_register_bytes (2*REGISTER_RAW_SIZE(0), (VALBUF), TYPE_LENGTH (TYPE))
/* In COFF, if PCC says a parameter is a short or a char, do not
change it to int (it seems the convention is to change it). */
#define BELIEVE_PCC_PROMOTION 1
-/* We provide our own get_saved_register in m88k-tdep.c. */
-#define GET_SAVED_REGISTER
-
/* 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.
- FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address
- and produces the nominal address of the caller frame.
-
However, if FRAME_CHAIN_VALID returns zero,
- it means the given frame is the outermost one and has no caller.
- In that case, FRAME_CHAIN_COMBINE is not used. */
+ it means the given frame is the outermost one and has no caller. */
-/* These are just dummies for the 88k because INIT_FRAME_PC sets prev->frame
- instead. */
+extern CORE_ADDR frame_chain ();
+extern int frame_chain_valid ();
+extern int frameless_function_invocation ();
-#define FRAME_CHAIN(thisframe) (0)
+#define FRAME_CHAIN(thisframe) \
+ frame_chain (thisframe)
-#define FRAME_CHAIN_VALID(chain, thisframe) (1)
+#define FRAME_CHAIN_VALID(chain, thisframe) \
+ frame_chain_valid (chain, thisframe)
-#define FRAME_CHAIN_COMBINE(chain, thisframe) (0)
+#define FRAMELESS_FUNCTION_INVOCATION(frame, fromleaf) \
+ fromleaf = frameless_function_invocation (frame)
/* Define other aspects of the stack frame. */
-#define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame+4, 4))
+#define FRAME_SAVED_PC(FRAME) \
+ frame_saved_pc (FRAME)
+extern CORE_ADDR frame_saved_pc ();
-#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
+#define FRAME_ARGS_ADDRESS(fi) \
+ frame_args_address (fi)
+extern CORE_ADDR frame_args_address ();
-#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
+#define FRAME_LOCALS_ADDRESS(fi) \
+ frame_locals_address (fi)
+extern CORE_ADDR frame_locals_address ();
/* Return number of args passed to a frame.
Can return -1, meaning no way to tell. */
calling function only expects to have the "preserved" registers restored.
Thus, those are the only ones that we even try to restore here. */
-extern void pop_frame ();
-
#define POP_FRAME pop_frame ()
-
-/* BCS is a standard for binary compatibility. This machine uses it. */
-#if !defined (BCS)
-#define BCS 1
-#endif
+extern void pop_frame ();