* alpha-tdep.c (alpha_supply_int_regs, alpha_fill_int_regs): New.
authorRichard Henderson <rth@redhat.com>
Mon, 2 Jun 2003 20:57:16 +0000 (20:57 +0000)
committerRichard Henderson <rth@redhat.com>
Mon, 2 Jun 2003 20:57:16 +0000 (20:57 +0000)
        (alpha_supply_fp_regs, alpha_fill_fp_regs): New.
        * alpha-tdep.h: Declare them.

        * alpha-nat.c (fetch_osf_core_registers): Constify core_reg_mapping.
        Remove zerobuf.  Don't error on UNIQUE.
        (fetch_elf_core_registers): Use alpha_supply_{int,fp}_regs.
        (ALPHA_REGSET_UNIQUE): Provide default.
        (supply_gregset): Use alpha_supply_int_regs.
        (fill_gregset): Use alpha_fill_int_regs.
        (supply_fpregset): Use alpha_supply_fp_regs.
        (fill_fpregset): Use alpha_fill_fp_regs.
        * alphabsd-tdep.c (NUM_GREGS, NUM_FPREGS): Remove.
        (alphabsd_supply_reg): Use alpha_supply_int_regs.
        (alphabsd_fill_reg): Use alpha_fill_int_regs.
        (alphabsd_supply_fpreg): Use alpha_supply_fp_regs.
        (alphabsd_fill_fpreg): Use alpha_fill_fp_regs.
        * config/alpha/nm-linux.h (ALPHA_REGSET_UNIQUE): New.

gdb/ChangeLog
gdb/alpha-nat.c
gdb/alpha-tdep.c
gdb/alpha-tdep.h
gdb/alphabsd-tdep.c
gdb/config/alpha/nm-linux.h

index 329e04d40baa19552785f10e7da791ae235fe876..0d78fe9f47ff2fc0ab37ce8a934f204cc6cbc0d5 100644 (file)
@@ -1,3 +1,24 @@
+2003-06-02  Richard Henderson  <rth@redhat.com>
+
+       * alpha-tdep.c (alpha_supply_int_regs, alpha_fill_int_regs): New.
+       (alpha_supply_fp_regs, alpha_fill_fp_regs): New.
+       * alpha-tdep.h: Declare them.
+
+       * alpha-nat.c (fetch_osf_core_registers): Constify core_reg_mapping.
+       Remove zerobuf.  Don't error on UNIQUE.
+       (fetch_elf_core_registers): Use alpha_supply_{int,fp}_regs.
+       (ALPHA_REGSET_UNIQUE): Provide default.
+       (supply_gregset): Use alpha_supply_int_regs.
+       (fill_gregset): Use alpha_fill_int_regs.
+       (supply_fpregset): Use alpha_supply_fp_regs.
+       (fill_fpregset): Use alpha_fill_fp_regs.
+       * alphabsd-tdep.c (NUM_GREGS, NUM_FPREGS): Remove.
+       (alphabsd_supply_reg): Use alpha_supply_int_regs.
+       (alphabsd_fill_reg): Use alpha_fill_int_regs.
+       (alphabsd_supply_fpreg): Use alpha_supply_fp_regs.
+       (alphabsd_fill_fpreg): Use alpha_fill_fp_regs.
+       * config/alpha/nm-linux.h (ALPHA_REGSET_UNIQUE): New.
+
 2003-06-02  Richard Henderson  <rth@redhat.com>
 
        * alpha-tdep.c (alpha_store_return_value): Avoid switch fallthru.
 2003-06-02  Richard Henderson  <rth@redhat.com>
 
        * alpha-tdep.c (alpha_store_return_value): Avoid switch fallthru.
 
 2003-06-02  Richard Henderson  <rth@redhat.com>
 
 
 2003-06-02  Richard Henderson  <rth@redhat.com>
 
-        * alpha-tdep.c (alpha_push_dummy_call): Use
-        builtin_type_ieee_double_little instead of builtin_type_double.
+       * alpha-tdep.c (alpha_push_dummy_call): Use
+       builtin_type_ieee_double_little instead of builtin_type_double.
 
 
-        * alpha-tdep.c (alpha_push_dummy_call): Handle ABI mandated 
-        sign-extension of 32-bit values.
-        (alpha_store_return_value): Similarly.
+       * alpha-tdep.c (alpha_push_dummy_call): Handle ABI mandated 
+       sign-extension of 32-bit values.
+       (alpha_store_return_value): Similarly.
 
 
-        * alpha-tdep.c (alpha_push_dummy_call): Handle COMPLEX types.
-        (alpha_extract_return_value): Likewise.
-        (alpha_store_return_value): Likewise.
+       * alpha-tdep.c (alpha_push_dummy_call): Handle COMPLEX types.
+       (alpha_extract_return_value): Likewise.
+       (alpha_store_return_value): Likewise.
 
 
-        * alpha-tdep.c (alpha_extract_return_value): Handle IEEE Quad floats.
-        (alpha_store_return_value): Error on IEEE Quad floats.
+       * alpha-tdep.c (alpha_extract_return_value): Handle IEEE Quad floats.
+       (alpha_store_return_value): Error on IEEE Quad floats.
 
 
-        * alpha-tdep.c (alpha_extract_return_value): Convert to regcache.
-        (alpha_extract_struct_value_address): Likewise.
-        (alpha_store_return_value): Likewise.
-        (alpha_store_struct_return): Remove.
-        (alpha_gdbarch_init): Update hook registration to match.
+       * alpha-tdep.c (alpha_extract_return_value): Convert to regcache.
+       (alpha_extract_struct_value_address): Likewise.
+       (alpha_store_return_value): Likewise.
+       (alpha_store_struct_return): Remove.
+       (alpha_gdbarch_init): Update hook registration to match.
 
 
-        * alpha-tdep.c (alpha_register_convert_to_virtual): Tidy use of
-        deprecated interfaces; use ALPHA_REGISTER_SIZE instead of gdbarch
-        macros where appropriate.
-        (alpha_register_convert_to_raw): Similarly.  Use unpack_long.
-        (alpha_convert_flt_dbl, alpha_convert_dbl_flt): New.
+       * alpha-tdep.c (alpha_register_convert_to_virtual): Tidy use of
+       deprecated interfaces; use ALPHA_REGISTER_SIZE instead of gdbarch
+       macros where appropriate.
+       (alpha_register_convert_to_raw): Similarly.  Use unpack_long.
+       (alpha_convert_flt_dbl, alpha_convert_dbl_flt): New.
 
 
-        * alpha-tdep.c (alpha_register_virtual_type): Use void_data_ptr
-        for SP, GP; void_func_ptr for PC; non-language-specific types
-        for all others.
-        * alpha-tdep.h (ALPHA_GP_REGNUM): New.
+       * alpha-tdep.c (alpha_register_virtual_type): Use void_data_ptr
+       for SP, GP; void_func_ptr for PC; non-language-specific types
+       for all others.
+       * alpha-tdep.h (ALPHA_GP_REGNUM): New.
 
 2003-06-02  Richard Henderson  <rth@redhat.com>
 
 
 2003-06-02  Richard Henderson  <rth@redhat.com>
 
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
-        * Makefile.in (ALLDEPFILES): Add alpha-mdebug-tdep.c.
-        (alpha-linux-tdep.o): Update dependencies.
-        (alpha-nat.o, alpha-tdep.o, alpha-mdebug-tdep.o): Likewise.
-        * alpha-mdebug-tdep.c: Remove unneeded includes.
+       * Makefile.in (ALLDEPFILES): Add alpha-mdebug-tdep.c.
+       (alpha-linux-tdep.o): Update dependencies.
+       (alpha-nat.o, alpha-tdep.o, alpha-mdebug-tdep.o): Likewise.
+       * alpha-mdebug-tdep.c: Remove unneeded includes.
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
-        * alpha-tdep.c (alpha_register_reggroup_p): New.
-        (alpha_gdbarch_init): Register it.
+       * alpha-tdep.c (alpha_register_reggroup_p): New.
+       (alpha_gdbarch_init): Register it.
 
 2003-06-02  Andrew Cagney  <cagney@redhat.com>
 
 
 2003-06-02  Andrew Cagney  <cagney@redhat.com>
 
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
-        * alpha-tdep.c (alpha_gdbarch_init): Use set_gdbarch_print_insn ...
-        (_initialize_alpha_tdep): ... not deprecated_tm_print_insn.
+       * alpha-tdep.c (alpha_gdbarch_init): Use set_gdbarch_print_insn ...
+       (_initialize_alpha_tdep): ... not deprecated_tm_print_insn.
 
 2003-06-01  Adam Fedor  <fedor@gnu.org>
 
 
 2003-06-01  Adam Fedor  <fedor@gnu.org>
 
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
-        * alpha-tdep.h (ALPHA_FP_REGNUM): Remove.
-        * alpha-tdep.c (alpha_register_name): Remove vfp entry.
-        (alpha_cannot_fetch_register): Remove ALPHA_FP_REGNUM.
-        (alpha_cannot_store_register): Likewise.
-        * alphabsd-nat.c (fetch_inferior_registers): Don't set FP_REGNUM.
-        * alpha-nat.c (supply_gregset): Likewise.
-        * alphanbsd-tdep.c (fetch_core_registers): Likewise.
+       * alpha-tdep.h (ALPHA_FP_REGNUM): Remove.
+       * alpha-tdep.c (alpha_register_name): Remove vfp entry.
+       (alpha_cannot_fetch_register): Remove ALPHA_FP_REGNUM.
+       (alpha_cannot_store_register): Likewise.
+       * alphabsd-nat.c (fetch_inferior_registers): Don't set FP_REGNUM.
+       * alpha-nat.c (supply_gregset): Likewise.
+       * alphanbsd-tdep.c (fetch_core_registers): Likewise.
 
 2003-06-01  Andrew Cagney  <cagney@redhat.com>
 
 
 2003-06-01  Andrew Cagney  <cagney@redhat.com>
 
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
-        * alpha-nat.c (fetch_osf_core_registers): Use ALPHA_REGISTER_SIZE
-        instead of ALPHA_MAX_REGISTER_RAW_SIZE.
-        (supply_gregset): Likewise.
-        * alpha-tdep.c (alpha_store_return_value): Likewise.
-        (alpha_get_longjmp_target): Likewise.
-        (alpha_register_name): Constify array.
-        (alpha_gdbarch_init): Remove deprecated_fp_regnum,
-        deprecated_register_size, deprecated_register_bytes,
-        deprecated_max_register_raw_size, deprecated_max_register_virtual_size.
-        * alpha-tdep.h (ALPHA_MAX_REGISTER_RAW_SIZE): Remove.
-        (ALPHA_MAX_REGISTER_VIRTUAL_SIZE): Remove.
+       * alpha-nat.c (fetch_osf_core_registers): Use ALPHA_REGISTER_SIZE
+       instead of ALPHA_MAX_REGISTER_RAW_SIZE.
+       (supply_gregset): Likewise.
+       * alpha-tdep.c (alpha_store_return_value): Likewise.
+       (alpha_get_longjmp_target): Likewise.
+       (alpha_register_name): Constify array.
+       (alpha_gdbarch_init): Remove deprecated_fp_regnum,
+       deprecated_register_size, deprecated_register_bytes,
+       deprecated_max_register_raw_size, deprecated_max_register_virtual_size.
+       * alpha-tdep.h (ALPHA_MAX_REGISTER_RAW_SIZE): Remove.
+       (ALPHA_MAX_REGISTER_VIRTUAL_SIZE): Remove.
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
-        * dwarf2-frame.c (struct dwarf2_cie): Add saw_z_augmentation.
-        (decode_frame_entry): Set it.  Skip FDE augmentation.
+       * dwarf2-frame.c (struct dwarf2_cie): Add saw_z_augmentation.
+       (decode_frame_entry): Set it.  Skip FDE augmentation.
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
-        * dwarf2-frame.c (dwarf2_frame_cache): Handle retaddr_column
-        not overlapping PC_REGNUM.
+       * dwarf2-frame.c (dwarf2_frame_cache): Handle retaddr_column
+       not overlapping PC_REGNUM.
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
-        * alpha-tdep.c (alpha_push_dummy_call): Transmography from
-        alpha_push_arguments.  Don't dump argument register data to
-        the target stack.  Fix float and 128-bit long double semantics.
-        Store $t12 and $ra as specified by the ABI.  Use regcache everywhere.
-        (alpha_fix_call_dummy): Remove.
-        (alpha_call_dummy_words): Remove.
-        (alpha_gdbarch_init): Kill deprecated call hooks; add push_dummy_call.
+       * alpha-tdep.c (alpha_push_dummy_call): Transmography from
+       alpha_push_arguments.  Don't dump argument register data to
+       the target stack.  Fix float and 128-bit long double semantics.
+       Store $t12 and $ra as specified by the ABI.  Use regcache everywhere.
+       (alpha_fix_call_dummy): Remove.
+       (alpha_call_dummy_words): Remove.
+       (alpha_gdbarch_init): Kill deprecated call hooks; add push_dummy_call.
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
 
 2003-06-01  Richard Henderson  <rth@redhat.com>
 
index 975b5977ccaedbb5ccc4e168a6efc097d4446bd6..342deff22b402ca760dd3d3835ce2be6927bb05f 100644 (file)
@@ -68,7 +68,7 @@ fetch_osf_core_registers (char *core_reg_sect, unsigned core_reg_size,
      OSF/1.2 core files.  OSF5 uses different names for the register
      enum list, need to handle two cases.  The actual values are the
      same.  */
      OSF/1.2 core files.  OSF5 uses different names for the register
      enum list, need to handle two cases.  The actual values are the
      same.  */
-  static int core_reg_mapping[ALPHA_NUM_REGS] =
+  static int const core_reg_mapping[ALPHA_NUM_REGS] =
   {
 #ifdef NCF_REGS
 #define EFL NCF_REGS
   {
 #ifdef NCF_REGS
 #define EFL NCF_REGS
@@ -94,18 +94,23 @@ fetch_osf_core_registers (char *core_reg_sect, unsigned core_reg_size,
     EF_PC, -1
 #endif
   };
     EF_PC, -1
 #endif
   };
-  static char zerobuf[ALPHA_REGISTER_SIZE] = {0};
 
 
-  for (regno = 0; regno < NUM_REGS; regno++)
+  for (regno = 0; regno < ALPHA_NUM_REGS; regno++)
     {
       if (CANNOT_FETCH_REGISTER (regno))
        {
     {
       if (CANNOT_FETCH_REGISTER (regno))
        {
-         supply_register (regno, zerobuf);
+         supply_register (regno, NULL);
          continue;
        }
       addr = 8 * core_reg_mapping[regno];
       if (addr < 0 || addr >= core_reg_size)
        {
          continue;
        }
       addr = 8 * core_reg_mapping[regno];
       if (addr < 0 || addr >= core_reg_size)
        {
+         /* ??? UNIQUE is a new addition.  Don't generate an error.  */
+         if (regno == ALPHA_UNIQUE_REGNUM)
+           {
+             supply_register (regno, NULL);
+             continue;
+           }
          if (bad_reg < 0)
            bad_reg = regno;
        }
          if (bad_reg < 0)
            bad_reg = regno;
        }
@@ -130,31 +135,22 @@ fetch_elf_core_registers (char *core_reg_sect, unsigned core_reg_size,
       return;
     }
 
       return;
     }
 
-  if (which == 2)
+  switch (which)
     {
     {
-      /* The FPU Registers.  */
-      memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)],
-             core_reg_sect, 31 * 8);
-      memset (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM + 31)], 0, 8);
-      memset (&deprecated_register_valid[FP0_REGNUM], 1, 32);
-    }
-  else
-    {
-      /* The General Registers.  */
-      memcpy (&deprecated_registers[REGISTER_BYTE (ALPHA_V0_REGNUM)],
-             core_reg_sect, 31 * 8);
-      memcpy (&deprecated_registers[REGISTER_BYTE (PC_REGNUM)],
-             core_reg_sect + 31 * 8, 8);
-      memset (&deprecated_registers[REGISTER_BYTE (ALPHA_ZERO_REGNUM)], 0, 8);
-      memset (&deprecated_register_valid[ALPHA_V0_REGNUM], 1, 32);
-      deprecated_register_valid[PC_REGNUM] = 1;
-
-      if (core_reg_size >= 33 * 8)
-       {
-         memcpy (&deprecated_registers[REGISTER_BYTE (ALPHA_UNIQUE_REGNUM)],
-                 core_reg_sect + 32 * 8, 8);
-         deprecated_register_valid[ALPHA_UNIQUE_REGNUM] = 1;
-       }
+    case 0: /* integer registers */
+      /* PC is in slot 32; UNIQUE is in slot 33, if present.  */
+      alpha_supply_int_regs (-1, core_reg_sect, core_reg_sect + 31*8,
+                            (core_reg_size >= 33 * 8
+                             ? core_reg_sect + 32*8 : NULL));
+      break;
+
+    case 2: /* floating-point registers */
+      /* FPCR is in slot 32.  */
+      alpha_supply_fp_regs (-1, core_reg_sect, core_reg_sect + 31*8);
+      break;
+
+    default:
+      break;
     }
 }
 
     }
 }
 
@@ -192,6 +188,11 @@ kernel_u_size (void)
 /* Prototypes for supply_gregset etc. */
 #include "gregset.h"
 
 /* Prototypes for supply_gregset etc. */
 #include "gregset.h"
 
+/* Locate the UNIQUE value within the gregset_t.  */
+#ifndef ALPHA_REGSET_UNIQUE
+#define ALPHA_REGSET_UNIQUE(ptr) NULL
+#endif
+
 /*
  * See the comment in m68k-tdep.c regarding the utility of these functions.
  */
 /*
  * See the comment in m68k-tdep.c regarding the utility of these functions.
  */
@@ -199,31 +200,21 @@ kernel_u_size (void)
 void
 supply_gregset (gdb_gregset_t *gregsetp)
 {
 void
 supply_gregset (gdb_gregset_t *gregsetp)
 {
-  register int regi;
   register long *regp = ALPHA_REGSET_BASE (gregsetp);
   register long *regp = ALPHA_REGSET_BASE (gregsetp);
-  static char zerobuf[ALPHA_REGISTER_SIZE] = {0};
+  void *unique = ALPHA_REGSET_UNIQUE (gregsetp);
 
 
-  for (regi = 0; regi < 31; regi++)
-    supply_register (regi, (char *) (regp + regi));
-
-  supply_register (PC_REGNUM, (char *) (regp + 31));
-
-  /* Fill inaccessible registers with zero.  */
-  supply_register (ALPHA_ZERO_REGNUM, zerobuf);
+  /* PC is in slot 32.  */
+  alpha_supply_int_regs (-1, regp, regp + 31, unique);
 }
 
 void
 fill_gregset (gdb_gregset_t *gregsetp, int regno)
 {
 }
 
 void
 fill_gregset (gdb_gregset_t *gregsetp, int regno)
 {
-  int regi;
   register long *regp = ALPHA_REGSET_BASE (gregsetp);
   register long *regp = ALPHA_REGSET_BASE (gregsetp);
+  void *unique = ALPHA_REGSET_UNIQUE (gregsetp);
 
 
-  for (regi = 0; regi < 31; regi++)
-    if ((regno == -1) || (regno == regi))
-      *(regp + regi) = *(long *) &deprecated_registers[REGISTER_BYTE (regi)];
-
-  if ((regno == -1) || (regno == PC_REGNUM))
-    *(regp + 31) = *(long *) &deprecated_registers[REGISTER_BYTE (PC_REGNUM)];
+  /* PC is in slot 32.  */
+  alpha_fill_int_regs (regno, regp, regp + 31, unique);
 }
 
 /*
 }
 
 /*
@@ -234,27 +225,19 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno)
 void
 supply_fpregset (gdb_fpregset_t *fpregsetp)
 {
 void
 supply_fpregset (gdb_fpregset_t *fpregsetp)
 {
-  register int regi;
   register long *regp = ALPHA_REGSET_BASE (fpregsetp);
 
   register long *regp = ALPHA_REGSET_BASE (fpregsetp);
 
-  for (regi = 0; regi < 32; regi++)
-    supply_register (regi + FP0_REGNUM, (char *) (regp + regi));
+  /* FPCR is in slot 32.  */
+  alpha_supply_fp_regs (-1, regp, regp + 31);
 }
 
 void
 fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
 {
 }
 
 void
 fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
 {
-  int regi;
   register long *regp = ALPHA_REGSET_BASE (fpregsetp);
 
   register long *regp = ALPHA_REGSET_BASE (fpregsetp);
 
-  for (regi = FP0_REGNUM; regi < FP0_REGNUM + 32; regi++)
-    {
-      if ((regno == -1) || (regno == regi))
-       {
-         *(regp + regi - FP0_REGNUM) =
-           *(long *) &deprecated_registers[REGISTER_BYTE (regi)];
-       }
-    }
+  /* FPCR is in slot 32.  */
+  alpha_fill_fp_regs (regno, regp, regp + 31);
 }
 #endif
 \f
 }
 #endif
 \f
index 508f0b917a8317ad41f520eb85f751bb257c5e7b..74e891baffaca8898bd62a972401b273582844f2 100644 (file)
@@ -1259,6 +1259,73 @@ alpha_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return pc;
 }
 
   return pc;
 }
 
+\f
+/* Helper routines for alpha*-nat.c files to move register sets to and
+   from core files.  The UNIQUE pointer is allowed to be NULL, as most
+   targets don't supply this value in their core files.  */
+
+void
+alpha_supply_int_regs (int regno, const void *r0_r30,
+                      const void *pc, const void *unique)
+{
+  int i;
+
+  for (i = 0; i < 31; ++i)
+    if (regno == i || regno == -1)
+      supply_register (i, (const char *)r0_r30 + i*8);
+
+  if (regno == ALPHA_ZERO_REGNUM || regno == -1)
+    supply_register (ALPHA_ZERO_REGNUM, NULL);
+
+  if (regno == ALPHA_PC_REGNUM || regno == -1)
+    supply_register (ALPHA_PC_REGNUM, pc);
+
+  if (regno == ALPHA_UNIQUE_REGNUM || regno == -1)
+    supply_register (ALPHA_UNIQUE_REGNUM, unique);
+}
+
+void
+alpha_fill_int_regs (int regno, void *r0_r30, void *pc, void *unique)
+{
+  int i;
+
+  for (i = 0; i < 31; ++i)
+    if (regno == i || regno == -1)
+      regcache_collect (i, (char *)r0_r30 + i*8);
+
+  if (regno == ALPHA_PC_REGNUM || regno == -1)
+    regcache_collect (ALPHA_PC_REGNUM, pc);
+
+  if (unique && (regno == ALPHA_UNIQUE_REGNUM || regno == -1))
+    regcache_collect (ALPHA_UNIQUE_REGNUM, unique);
+}
+
+void
+alpha_supply_fp_regs (int regno, const void *f0_f30, const void *fpcr)
+{
+  int i;
+
+  for (i = ALPHA_FP0_REGNUM; i < ALPHA_FP0_REGNUM + 31; ++i)
+    if (regno == i || regno == -1)
+      supply_register (i, (const char *)f0_f30 + (i - ALPHA_FP0_REGNUM) * 8);
+
+  if (regno == ALPHA_FPCR_REGNUM || regno == -1)
+    supply_register (ALPHA_FPCR_REGNUM, fpcr);
+}
+
+void
+alpha_fill_fp_regs (int regno, void *f0_f30, void *fpcr)
+{
+  int i;
+
+  for (i = ALPHA_FP0_REGNUM; i < ALPHA_FP0_REGNUM + 31; ++i)
+    if (regno == i || regno == -1)
+      regcache_collect (i, (char *)f0_f30 + (i - ALPHA_FP0_REGNUM) * 8);
+
+  if (regno == ALPHA_FPCR_REGNUM || regno == -1)
+    regcache_collect (ALPHA_FPCR_REGNUM, fpcr);
+}
+
 \f
 /* alpha_software_single_step() is called just before we want to resume
    the inferior, if we want to single-step it but there is no hardware
 \f
 /* alpha_software_single_step() is called just before we want to resume
    the inferior, if we want to single-step it but there is no hardware
index 7f1ec5139ef107efdae8b9c169e8dbc54992aa3e..eaeaa56b2e0fa18df1ef08c1a9910b508bb4df69 100644 (file)
@@ -94,4 +94,10 @@ extern CORE_ADDR alpha_after_prologue (CORE_ADDR pc);
 
 extern void alpha_mdebug_init_abi (struct gdbarch_info, struct gdbarch *);
 
 
 extern void alpha_mdebug_init_abi (struct gdbarch_info, struct gdbarch *);
 
+extern void alpha_supply_int_regs (int, const void *, const void *,
+                                  const void *);
+extern void alpha_fill_int_regs (int, void *, void *, void *);
+extern void alpha_supply_fp_regs (int, const void *, const void *);
+extern void alpha_fill_fp_regs (int, void *, void *);
+
 #endif /* ALPHA_TDEP_H */
 #endif /* ALPHA_TDEP_H */
index 39a9b1ae77eb93c979fa1ea49f49059281d473c0..89c9c30c1b3408004ff08b8ff767baf2a9f27ce9 100644 (file)
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
-#include "regcache.h"
 
 #include "alpha-tdep.h"
 #include "alphabsd-tdep.h"
 
 
 #include "alpha-tdep.h"
 #include "alphabsd-tdep.h"
 
-/* Number of general-purpose registers.  */
-#define NUM_GREGS 32
-
-/* Number of floating-point registers.  */
-#define NUM_FPREGS 31
-
 /* Conviently, GDB uses the same register numbering as the
    ptrace register structure used by BSD on Alpha.  */
 
 void
 alphabsd_supply_reg (char *regs, int regno)
 {
 /* Conviently, GDB uses the same register numbering as the
    ptrace register structure used by BSD on Alpha.  */
 
 void
 alphabsd_supply_reg (char *regs, int regno)
 {
-  int i;
-
-  for (i = 0; i < NUM_GREGS; i++)
-    {
-      if (i == regno || regno == -1)
-       {
-         if (CANNOT_FETCH_REGISTER (i))
-           supply_register (i, NULL);
-         else
-           supply_register (i, regs + (i * 8));
-       }
-    }
-
-  /* The PC travels in the ZERO slot.  */
-  if (regno == PC_REGNUM || regno == -1)
-    supply_register (PC_REGNUM, regs + (31 * 8));
+  /* PC is at slot 32; UNIQUE not present.  */
+  alpha_supply_int_regs (regno, regs, regs + 31*8, NULL);
 }
 
 void
 alphabsd_fill_reg (char *regs, int regno)
 {
 }
 
 void
 alphabsd_fill_reg (char *regs, int regno)
 {
-  int i;
-
-  for (i = 0; i < NUM_GREGS; i++)
-    if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i))
-      regcache_collect (i, regs + (i * 8));
-
-  /* The PC travels in the ZERO slot.  */
-  if (regno == PC_REGNUM || regno == -1)
-    regcache_collect (PC_REGNUM, regs + (31 * 8));
+  /* PC is at slot 32; UNIQUE not present.  */
+  alpha_fill_int_regs (regno, regs, regs + 31*8, NULL);
 }
 
 void
 alphabsd_supply_fpreg (char *fpregs, int regno)
 {
 }
 
 void
 alphabsd_supply_fpreg (char *fpregs, int regno)
 {
-  int i;
-
-  for (i = FP0_REGNUM; i < FP0_REGNUM + NUM_FPREGS; i++)
-    {
-      if (i == regno || regno == -1)
-       {
-         if (CANNOT_FETCH_REGISTER (i))
-           supply_register (i, NULL);
-         else
-           supply_register (i, fpregs + ((i - FP0_REGNUM) * 8));
-       }
-    }
-
-  if (regno == ALPHA_FPCR_REGNUM || regno == -1)
-    supply_register (ALPHA_FPCR_REGNUM, fpregs + (32 * 8));
+  /* FPCR is at slot 33; slot 32 unused.  */
+  alpha_supply_fp_regs (regno, regs, regs + 32*8);
 }
 
 void
 alphabsd_fill_fpreg (char *fpregs, int regno)
 {
 }
 
 void
 alphabsd_fill_fpreg (char *fpregs, int regno)
 {
-  int i;
-
-  for (i = FP0_REGNUM; i < FP0_REGNUM + NUM_FPREGS; i++)
-    if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i))
-      regcache_collect (i, fpregs + ((i - FP0_REGNUM) * 8));
-
-  if (regno == ALPHA_FPCR_REGNUM || regno == -1)
-    regcache_collect (ALPHA_FPCR_REGNUM, fpregs + (32 * 8));
+  /* FPCR is at slot 33; slot 32 unused.  */
+  alpha_fill_fp_regs (regno, regs, regs + 32*8);
 }
 }
index 9e99b33cd1f3a350e1a4ddffb48b81acea3d41be..a6f9a49f9d6d9f0630cb2035f2168b0890d73d02 100644 (file)
@@ -45,6 +45,9 @@
    pointer to the first register.  */
 #define ALPHA_REGSET_BASE(regsetp)  ((long *) (regsetp))
 
    pointer to the first register.  */
 #define ALPHA_REGSET_BASE(regsetp)  ((long *) (regsetp))
 
+/* Given a pointer to a gregset_t, locate the UNIQUE value.  */
+#define ALPHA_REGSET_UNIQUE(regsetp)  ((long *)(regsetp) + 32)
+
 /* The address of UNIQUE for ptrace.  */
 #define ALPHA_UNIQUE_PTRACE_ADDR 65
 
 /* The address of UNIQUE for ptrace.  */
 #define ALPHA_UNIQUE_PTRACE_ADDR 65