* 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.
This commit is contained in:
Richard Henderson
2003-06-02 20:57:16 +00:00
parent f75d70ccb3
commit 98a8e1e505
6 changed files with 204 additions and 171 deletions

View File

@@ -1259,6 +1259,73 @@ alpha_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
return pc;
}
/* 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);
}
/* 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