OSDN Git Service

* config/m68k/tm-m68k.h (REGISTER_BYTE, REGISTER_RAW_SIZE)
authorgraces <graces>
Fri, 21 Jun 2002 20:23:24 +0000 (20:23 +0000)
committergraces <graces>
Fri, 21 Jun 2002 20:23:24 +0000 (20:23 +0000)
(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.

gdb/ChangeLog
gdb/config/m68k/tm-m68k.h
gdb/m68k-tdep.c

index bf43c33..580223b 100644 (file)
@@ -1,9 +1,27 @@
 2002-06-21  Grace Sainsbury  <graces@redhat.com>
 
+       * 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.
+
+2002-06-21  Grace Sainsbury  <graces@redhat.com>
+
        * m68k-tdep.c (m68k_frame_init_saved_regs): Replace
         m68k_find_saved_regs.
         (m68k_pop_frame): Removed saved_regs structure, and replaced
-        references to it with frasme->saved_regs.
+        references to it with frame->saved_regs.
         (m68k_gdbarch_init): Added function calls to initialize the
         gdbarch structure.
        (m68k_fix_call_dummy): Add. 
index c114be0..0954a02 100644 (file)
@@ -25,6 +25,7 @@
 
 /* Generic 68000 stuff, to be included by other tm-*.h files.  */
 
+#if !GDB_MULTI_ARCH
 #define TARGET_LONG_DOUBLE_FORMAT &floatformat_m68881_ext
 
 #define TARGET_LONG_DOUBLE_BIT 96
 #if !defined(SKIP_PROLOGUE)
 #define SKIP_PROLOGUE(ip) (m68k_skip_prologue (ip))
 #endif
+#endif
 extern CORE_ADDR m68k_skip_prologue (CORE_ADDR ip);
 
+
 /* Immediately after a function call, return the saved pc.
    Can't always go through the frames for this because on some machines
    the new frame is not set up until the new function executes
@@ -49,18 +52,22 @@ extern CORE_ADDR m68k_skip_prologue (CORE_ADDR ip);
 
 struct frame_info;
 
+#if !GDB_MULTI_ARCH
 extern CORE_ADDR m68k_saved_pc_after_call (struct frame_info *);
 
 #define SAVED_PC_AFTER_CALL(frame) \
   m68k_saved_pc_after_call(frame)
+#endif
 
 /* Stack grows downward.  */
 
+#if !GDB_MULTI_ARCH
 #define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
 
 /* Stack must be kept short aligned when doing function calls.  */
 
 #define STACK_ALIGN(ADDR) (((ADDR) + 1) & ~1)
+#endif
 
 /* Sequence of bytes for breakpoint instruction.
    This is a TRAP instruction.  The last 4 bits (0xf below) is the
@@ -96,7 +103,9 @@ extern CORE_ADDR m68k_saved_pc_after_call (struct frame_info *);
    used in push_word and a few other places; REGISTER_RAW_SIZE is the
    real way to know how big a register is.  */
 
+#if !GDB_MULTI_ARCH
 #define REGISTER_SIZE 4
+#endif
 
 #define REGISTER_BYTES_FP (16*4 + 8 + 8*12 + 3*4)
 #define REGISTER_BYTES_NOFP (16*4 + 8)
@@ -120,17 +129,19 @@ extern CORE_ADDR m68k_saved_pc_after_call (struct frame_info *);
 /* Index within `registers' of the first byte of the space for
    register N.  */
 
+#if !GDB_MULTI_ARCH
 #define REGISTER_BYTE(N)  \
  ((N) >= FPC_REGNUM ? (((N) - FPC_REGNUM) * 4) + 168   \
   : (N) >= FP0_REGNUM ? (((N) - FP0_REGNUM) * 12) + 72 \
   : (N) * 4)
+#endif
 
 /* Number of bytes of storage in the actual machine representation
    for register N.  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 N < FP0_REGNUM */
-
+#if !GDB_MULTI_ARCH
 #define REGISTER_RAW_SIZE(N) (((unsigned)(N) - FP0_REGNUM) < 8 ? 12 : 4)
 
 /* Number of bytes of storage in the program's representation
@@ -146,29 +157,31 @@ extern CORE_ADDR m68k_saved_pc_after_call (struct frame_info *);
 /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
 
 #define MAX_REGISTER_VIRTUAL_SIZE 12
-
+#endif
 /* 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.  */
-
+#if !GDB_MULTI_ARCH
 #define REGISTER_VIRTUAL_TYPE(N) \
   ((unsigned) (N) >= FPC_REGNUM ? lookup_pointer_type (builtin_type_void) : \
    (unsigned) (N) >= FP0_REGNUM ? builtin_type_long_double :                \
    (unsigned) (N) >=  A0_REGNUM ? lookup_pointer_type (builtin_type_void) : \
    builtin_type_int)
-
+#endif
 /* Initializer for an array of names of registers.
    Entries beyond the first NUM_REGS are ignored.  */
 
+#if !GDB_MULTI_ARCH
 #define 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" }
+#endif
 
 /* Register numbers of various important registers.
    Note that some of these values are "real" register numbers,
@@ -189,6 +202,7 @@ extern CORE_ADDR m68k_saved_pc_after_call (struct frame_info *);
 #define FPS_REGNUM 27          /* 68881 status register */
 #define FPI_REGNUM 28          /* 68881 iaddr register */
 
+
 /* Store the address of the place in which to copy the structure the
    subroutine will return.  This is called from call_function. */
 
index 39d2a22..9ffce37 100644 (file)
@@ -27,6 +27,7 @@
 #include "gdb_string.h"
 #include "inferior.h"
 #include "regcache.h"
+#include "arch-utils.h"
 \f
 
 #define P_LINKL_FP     0x480e
 
 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);