forked from Imagelibrary/binutils-gdb
* config/m68k/tm-m68k.h (REGISTER_BYTE, REGISTER_RAW_SIZE)
(REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_TYPE, REGISTER_NAMES, TARGET_LONG_DOUBLE_FORMAT) (FUNCTION_START_OFFSET, SKIP_PROLOGUE, SAVED_PC_AFTER_CALL) (INNER_THAN, STACK_ALIGN, REGISTER_SIZE): Remove macros. * m68k-tdep.c: Include arch-utils.h (m68k_register_raw_size): Add. (m68k_register_virtual_size): Add. (m68k_register_virtual_type): Add. (m68k_register_name): Add. (m68k_stack_align): Add. (m68k_register_byte): Add. (m68k_gdbarch_init): Add set_gdbarch calls for macros removed in tm-m68k.h.
This commit is contained in:
108
gdb/m68k-tdep.c
108
gdb/m68k-tdep.c
@@ -27,6 +27,7 @@
|
||||
#include "gdb_string.h"
|
||||
#include "inferior.h"
|
||||
#include "regcache.h"
|
||||
#include "arch-utils.h"
|
||||
|
||||
|
||||
#define P_LINKL_FP 0x480e
|
||||
@@ -43,6 +44,92 @@
|
||||
|
||||
void m68k_frame_init_saved_regs (struct frame_info *frame_info);
|
||||
|
||||
/* Number of bytes of storage in the actual machine representation
|
||||
for register regnum. On the 68000, all regs are 4 bytes
|
||||
except the floating point regs which are 12 bytes. */
|
||||
/* Note that the unsigned cast here forces the result of the
|
||||
subtraction to very high positive values if regnum < FP0_REGNUM */
|
||||
|
||||
static int
|
||||
m68k_register_raw_size (int regnum)
|
||||
{
|
||||
return (((unsigned) (regnum) - FP0_REGNUM) < 8 ? 12 : 4);
|
||||
}
|
||||
|
||||
/* Number of bytes of storage in the program's representation
|
||||
for register regnum. On the 68000, all regs are 4 bytes
|
||||
except the floating point regs which are 12-byte long doubles. */
|
||||
|
||||
static int
|
||||
m68k_register_virtual_size (int regnum)
|
||||
{
|
||||
return (((unsigned) (regnum) - FP0_REGNUM) < 8 ? 12 : 4);
|
||||
}
|
||||
|
||||
/* Return the GDB type object for the "standard" data type of data
|
||||
in register N. This should be int for D0-D7, long double for FP0-FP7,
|
||||
and void pointer for all others (A0-A7, PC, SR, FPCONTROL etc).
|
||||
Note, for registers which contain addresses return pointer to void,
|
||||
not pointer to char, because we don't want to attempt to print
|
||||
the string after printing the address. */
|
||||
|
||||
static struct type *
|
||||
m68k_register_virtual_type (int regnum)
|
||||
{
|
||||
if ((unsigned) regnum >= FPC_REGNUM)
|
||||
return lookup_pointer_type (builtin_type_void);
|
||||
else if ((unsigned) regnum >= FP0_REGNUM)
|
||||
return builtin_type_long_double;
|
||||
else if ((unsigned) regnum >= A0_REGNUM)
|
||||
return lookup_pointer_type (builtin_type_void);
|
||||
else
|
||||
return builtin_type_int;
|
||||
}
|
||||
|
||||
/* Function: m68k_register_name
|
||||
Returns the name of the standard m68k register regnum. */
|
||||
|
||||
static const char *
|
||||
m68k_register_name (int regnum)
|
||||
{
|
||||
static char *register_names[] = {
|
||||
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
|
||||
"a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp",
|
||||
"ps", "pc",
|
||||
"fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7",
|
||||
"fpcontrol", "fpstatus", "fpiaddr", "fpcode", "fpflags"
|
||||
};
|
||||
|
||||
if (regnum < 0 ||
|
||||
regnum >= sizeof (register_names) / sizeof (register_names[0]))
|
||||
internal_error (__FILE__, __LINE__,
|
||||
"m68k_register_name: illegal register number %d", regnum);
|
||||
else
|
||||
return register_names[regnum];
|
||||
}
|
||||
|
||||
/* Stack must be kept short aligned when doing function calls. */
|
||||
|
||||
static CORE_ADDR
|
||||
m68k_stack_align (CORE_ADDR addr)
|
||||
{
|
||||
return ((addr + 1) & ~1);
|
||||
}
|
||||
|
||||
/* Index within `registers' of the first byte of the space for
|
||||
register regnum. */
|
||||
|
||||
static int
|
||||
m68k_register_byte (int regnum)
|
||||
{
|
||||
if (regnum >= FPC_REGNUM)
|
||||
return (((regnum - FPC_REGNUM) * 4) + 168);
|
||||
else if (regnum >= FP0_REGNUM)
|
||||
return (((regnum - FP0_REGNUM) * 12) + 72);
|
||||
else
|
||||
return (regnum * 4);
|
||||
}
|
||||
|
||||
/* The only reason this is here is the tm-altos.h reference below. It
|
||||
was moved back here from tm-m68k.h. FIXME? */
|
||||
|
||||
@@ -731,6 +818,27 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
|
||||
gdbarch = gdbarch_alloc (&info, 0);
|
||||
|
||||
set_gdbarch_long_double_format (gdbarch, &floatformat_m68881_ext);
|
||||
set_gdbarch_long_double_bit (gdbarch, 96);
|
||||
|
||||
set_gdbarch_function_start_offset (gdbarch, 0);
|
||||
|
||||
set_gdbarch_skip_prologue (gdbarch, m68k_skip_prologue);
|
||||
set_gdbarch_saved_pc_after_call (gdbarch, m68k_saved_pc_after_call);
|
||||
|
||||
/* Stack grows down. */
|
||||
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
|
||||
set_gdbarch_stack_align (gdbarch, m68k_stack_align);
|
||||
|
||||
set_gdbarch_register_raw_size (gdbarch, m68k_register_raw_size);
|
||||
set_gdbarch_register_virtual_size (gdbarch, m68k_register_virtual_size);
|
||||
set_gdbarch_max_register_raw_size (gdbarch, 12);
|
||||
set_gdbarch_max_register_virtual_size (gdbarch, 12);
|
||||
set_gdbarch_register_virtual_type (gdbarch, m68k_register_virtual_type);
|
||||
set_gdbarch_register_name (gdbarch, m68k_register_name);
|
||||
set_gdbarch_register_size (gdbarch, 4);
|
||||
set_gdbarch_register_byte (gdbarch, m68k_register_byte);
|
||||
|
||||
set_gdbarch_frame_init_saved_regs (gdbarch, m68k_frame_init_saved_regs);
|
||||
|
||||
set_gdbarch_use_generic_dummy_frames (gdbarch, 0);
|
||||
|
||||
Reference in New Issue
Block a user