From 98a8e1e505088778f916f11803481c42b0d696b5 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 2 Jun 2003 20:57:16 +0000 Subject: * 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. --- gdb/alpha-tdep.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'gdb/alpha-tdep.c') diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 508f0b9..74e891b 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -1260,6 +1260,73 @@ alpha_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) } +/* 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 or kernel single-step support (NetBSD on Alpha, for example). We find -- cgit v1.1