diff options
-rw-r--r-- | gdb/ChangeLog | 31 | ||||
-rw-r--r-- | gdb/aix-thread.c | 28 | ||||
-rw-r--r-- | gdb/config/rs6000/tm-rs6000.h | 4 | ||||
-rw-r--r-- | gdb/ppc-bdm.c | 19 | ||||
-rw-r--r-- | gdb/ppc-linux-nat.c | 17 | ||||
-rw-r--r-- | gdb/ppc-linux-tdep.c | 6 | ||||
-rw-r--r-- | gdb/ppc-sysv-tdep.c | 44 | ||||
-rw-r--r-- | gdb/ppc-tdep.h | 1 | ||||
-rw-r--r-- | gdb/ppcnbsd-nat.c | 3 | ||||
-rw-r--r-- | gdb/ppcnbsd-tdep.c | 14 | ||||
-rw-r--r-- | gdb/rs6000-nat.c | 19 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 28 |
12 files changed, 146 insertions, 68 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9dc0962..0862f2c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,34 @@ +2004-05-04 Jim Blandy <jimb@redhat.com> + + * config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this + should no longer be used in code specific to the RS6000 and its + derivatives. + * ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member. + * rs6000-tdep.c (rs6000_gdbarch_init): Initialize + tdep->ppc_fp0_regnum. + (ppc_supply_fpregset, ppc_collect_fpregset) + (rs6000_push_dummy_call, rs6000_extract_return_value) + (rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value) + (rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of + FP0_REGNUM. + * aix-thread.c (supply_fprs, fetch_regs_kernel_thread) + (fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread): + Same. + * ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers, + bdm_ppc_store_registers): Same. + * ppc-linux-nat.c (ppc_register_u_addr, fetch_register) + (store_register, fill_fpregset): Same. + * ppc-linux-tdep.c (ppc_linux_sigtramp_cache) + (ppc_linux_supply_fpregset): Same. + * ppcnbsd-nat.c (getfpregs_supplies): Same. + * ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg): + Same. + * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call, + do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call, + ppc64_sysv_abi_return_value): Same. + * rs6000-nat.c (regmap, fetch_inferior_registers) + (store_inferior_registers, fetch_core_registers): Same. + 2004-05-01 Mark Kettenis <kettenis@gnu.org> * m68knbsd-nat.c: Remove file. diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 89a0755..36174b4 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -1020,10 +1020,11 @@ supply_reg32 (int regno, uint32_t val) static void supply_fprs (double *vals) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int regno; for (regno = 0; regno < 32; regno++) - supply_register (regno + FP0_REGNUM, (char *) (vals + regno)); + supply_register (regno + tdep->ppc_fp0_regnum, (char *) (vals + regno)); } /* Predicate to test whether given register number is a "special" register. */ @@ -1142,6 +1143,7 @@ fetch_regs_user_thread (pthdb_pthread_t pdtid) static void fetch_regs_kernel_thread (int regno, pthdb_tid_t tid) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); uint64_t gprs64[32]; uint32_t gprs32[32]; double fprs[32]; @@ -1155,7 +1157,7 @@ fetch_regs_kernel_thread (int regno, pthdb_tid_t tid) (long) tid, regno, arch64); /* General-purpose registers. */ - if (regno == -1 || regno < FP0_REGNUM) + if (regno == -1 || regno < tdep->ppc_fp0_regnum) { if (arch64) { @@ -1176,8 +1178,8 @@ fetch_regs_kernel_thread (int regno, pthdb_tid_t tid) /* Floating-point registers. */ if (regno == -1 - || (regno >= FP0_REGNUM - && regno < FP0_REGNUM + ppc_num_fprs)) + || (regno >= tdep->ppc_fp0_regnum + && regno < tdep->ppc_fp0_regnum + ppc_num_fprs)) { if (!ptrace32 (PTT_READ_FPRS, tid, (int *) fprs, 0, NULL)) memset (fprs, 0, sizeof (fprs)); @@ -1241,9 +1243,10 @@ aix_thread_fetch_registers (int regno) static void fill_gprs64 (uint64_t *vals) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int regno; - for (regno = 0; regno < FP0_REGNUM; regno++) + for (regno = 0; regno < tdep->ppc_fp0_regnum; regno++) if (register_cached (regno)) regcache_collect (regno, vals + regno); } @@ -1251,9 +1254,10 @@ fill_gprs64 (uint64_t *vals) static void fill_gprs32 (uint32_t *vals) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int regno; - for (regno = 0; regno < FP0_REGNUM; regno++) + for (regno = 0; regno < tdep->ppc_fp0_regnum; regno++) if (register_cached (regno)) regcache_collect (regno, vals + regno); } @@ -1262,9 +1266,12 @@ fill_gprs32 (uint32_t *vals) static void fill_fprs (double *vals) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int regno; - for (regno = FP0_REGNUM; regno < FP0_REGNUM + ppc_num_fprs; regno++) + for (regno = tdep->ppc_fp0_regnum; + regno < tdep->ppc_fp0_regnum + ppc_num_fprs; + regno++) if (register_cached (regno)) regcache_collect (regno, vals + regno); } @@ -1434,6 +1441,7 @@ store_regs_user_thread (pthdb_pthread_t pdtid) static void store_regs_kernel_thread (int regno, pthdb_tid_t tid) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); uint64_t gprs64[32]; uint32_t gprs32[32]; double fprs[32]; @@ -1448,7 +1456,7 @@ store_regs_kernel_thread (int regno, pthdb_tid_t tid) (long) tid, regno); /* General-purpose registers. */ - if (regno == -1 || regno < FP0_REGNUM) + if (regno == -1 || regno < tdep->ppc_fp0_regnum) { if (arch64) { @@ -1469,8 +1477,8 @@ store_regs_kernel_thread (int regno, pthdb_tid_t tid) /* Floating-point registers. */ if (regno == -1 - || (regno >= FP0_REGNUM - && regno < FP0_REGNUM + ppc_num_fprs)) + || (regno >= tdep->ppc_fp0_regnum + && regno < tdep->ppc_fp0_regnum + ppc_num_fprs)) { /* Pre-fetch: some regs may not be in the cache. */ ptrace32 (PTT_READ_FPRS, tid, (int *) fprs, 0, NULL); diff --git a/gdb/config/rs6000/tm-rs6000.h b/gdb/config/rs6000/tm-rs6000.h index e53a7b8..59af62b 100644 --- a/gdb/config/rs6000/tm-rs6000.h +++ b/gdb/config/rs6000/tm-rs6000.h @@ -71,6 +71,10 @@ extern void aix_process_linenos (void); to be actual register numbers as far as the user is concerned but do serve to get the desired values when passed to read_register. */ +/* Don't use this in code specific to the RS6000 and its descendants; + use tdep->ppc_fp0_regnum instead. FP0_REGNUM will be deprecated + soon, but we still need to define it here for the uses in + architecture-independent code. */ #define FP0_REGNUM 32 /* Floating point register 0 */ /* Notice when a new child process is started. */ diff --git a/gdb/ppc-bdm.c b/gdb/ppc-bdm.c index 515cbdd..59fac1f 100644 --- a/gdb/ppc-bdm.c +++ b/gdb/ppc-bdm.c @@ -153,6 +153,7 @@ static int bdm_regmap[] = static void bdm_ppc_fetch_registers (int regno) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int i; unsigned char *regs, *beginregs, *endregs, *almostregs; unsigned char midregs[32]; @@ -202,8 +203,8 @@ bdm_ppc_fetch_registers (int regno) /* if asking for an invalid register */ if ((first_regno == gdbarch_tdep (current_gdbarch)->ppc_mq_regnum) || (first_regno == gdbarch_tdep (current_gdbarch)->ppc_fpscr_regnum) - || ((first_regno >= FP0_REGNUM) - && (first_regno < FP0_REGNUM + ppc_num_fprs))) + || ((first_regno >= tdep->ppc_fp0_regnum) + && (first_regno < tdep->ppc_fp0_regnum + ppc_num_fprs))) { /* printf("invalid reg request!\n"); */ supply_register (first_regno, NULL); @@ -220,10 +221,12 @@ bdm_ppc_fetch_registers (int regno) { /* printf("Asking for registers %d to %d\n", first_regno, last_regno); */ beginregs = ocd_read_bdm_registers (first_bdm_regno, - FP0_REGNUM - 1, &beginreglen); - endregs = (strcat (midregs, - ocd_read_bdm_registers (FP0_REGNUM + ppc_num_fprs, - last_bdm_regno - 1, &endreglen))); + tdep->ppc_fp0_regnum - 1, + &beginreglen); + endregs + = (strcat (midregs, + ocd_read_bdm_registers (tdep->ppc_fp0_regnum + ppc_num_fprs, + last_bdm_regno - 1, &endreglen))); almostregs = (strcat (beginregs, endregs)); regs = (strcat (almostregs, mqreg)); reglen = beginreglen + 32 + endreglen + 1; @@ -259,6 +262,7 @@ bdm_ppc_fetch_registers (int regno) static void bdm_ppc_store_registers (int regno) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int i; int first_regno, last_regno; int first_bdm_regno, last_bdm_regno; @@ -293,7 +297,8 @@ bdm_ppc_store_registers (int regno) /* (need to avoid FP regs and MQ reg) */ if ((i != gdbarch_tdep (current_gdbarch)->ppc_mq_regnum) && (i != gdbarch_tdep (current_gdbarch)->ppc_fpscr_regnum) - && ((i < FP0_REGNUM) || (i >= FP0_REGNUM + ppc_num_fprs))) + && ((i < tdep->ppc_fp0_regnum) + || (i >= tdep->ppc_fp0_regnum + ppc_num_fprs))) { /* printf("write valid reg %d\n", bdm_regno); */ ocd_write_bdm_registers (bdm_regno, deprecated_registers + DEPRECATED_REGISTER_BYTE (i), 4); diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index fc8508d..b6dbbc9 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -139,8 +139,9 @@ ppc_register_u_addr (int regno) /* Floating point regs: eight bytes each in both 32- and 64-bit ptrace interfaces. Thus, two slots each in 32-bit interface, one slot each in 64-bit interface. */ - if (regno >= FP0_REGNUM && regno < FP0_REGNUM + ppc_num_fprs) - u_addr = (PT_FPR0 * wordsize) + ((regno - FP0_REGNUM) * 8); + if (regno >= tdep->ppc_fp0_regnum + && regno < tdep->ppc_fp0_regnum + ppc_num_fprs) + u_addr = (PT_FPR0 * wordsize) + ((regno - tdep->ppc_fp0_regnum) * 8); /* UISA special purpose registers: 1 slot each */ if (regno == PC_REGNUM) @@ -202,6 +203,7 @@ fetch_altivec_register (int tid, int regno) static void fetch_register (int tid, int regno) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); /* This isn't really an address. But ptrace thinks of it as one. */ char mess[128]; /* For messages */ int i; @@ -251,7 +253,8 @@ fetch_register (int tid, int regno) /* Now supply the register. Be careful to map between ptrace's and the current_regcache's idea of the current wordsize. */ - if ((regno >= FP0_REGNUM && regno < FP0_REGNUM +32) + if ((regno >= tdep->ppc_fp0_regnum + && regno < tdep->ppc_fp0_regnum + ppc_num_fprs) || gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE) /* FPs are always 64 bits. Little endian values are always found at the left-hand end of the register. */ @@ -376,6 +379,7 @@ store_altivec_register (int tid, int regno) static void store_register (int tid, int regno) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); /* This isn't really an address. But ptrace thinks of it as one. */ CORE_ADDR regaddr = ppc_register_u_addr (regno); char mess[128]; /* For messages */ @@ -395,7 +399,8 @@ store_register (int tid, int regno) /* First collect the register value from the regcache. Be careful to to convert the regcache's wordsize into ptrace's wordsize. */ memset (buf, 0, sizeof buf); - if ((regno >= FP0_REGNUM && regno < FP0_REGNUM + 32) + if ((regno >= tdep->ppc_fp0_regnum + && regno < tdep->ppc_fp0_regnum + ppc_num_fprs) || TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) /* Floats are always 64-bit. Little endian registers are always at the left-hand end of the register cache. */ @@ -585,8 +590,8 @@ fill_fpregset (gdb_fpregset_t *fpregsetp, int regno) for (regi = 0; regi < 32; regi++) { - if ((regno == -1) || (regno == FP0_REGNUM + regi)) - regcache_collect (FP0_REGNUM + regi, fpp + 8 * regi); + if ((regno == -1) || (regno == tdep->ppc_fp0_regnum + regi)) + regcache_collect (tdep->ppc_fp0_regnum + regi, fpp + 8 * regi); } if ((regno == -1) || regno == tdep->ppc_fpscr_regnum) right_fill_reg (tdep->ppc_fpscr_regnum, (fpp + 8 * 32)); diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index d0e82e6..94c67f1 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -946,7 +946,7 @@ ppc_linux_sigtramp_cache (struct frame_info *next_frame, void **this_cache) /* Floating point registers. */ for (i = 0; i < 32; i++) { - int regnum = i + FP0_REGNUM; + int regnum = i + tdep->ppc_fp0_regnum; cache->saved_regs[regnum].addr = fpregs + i * tdep->wordsize; } cache->saved_regs[tdep->ppc_fpscr_regnum].addr = fpregs + 32 * tdep->wordsize; @@ -1019,7 +1019,9 @@ ppc_linux_supply_fpregset (const struct regset *regset, const bfd_byte *buf = fpset; for (regi = 0; regi < 32; regi++) - regcache_raw_supply (regcache, FP0_REGNUM + regi, buf + 8 * regi); + regcache_raw_supply (regcache, + regcache_tdep->ppc_fp0_regnum + regi, + buf + 8 * regi); /* The FPSCR is stored in the low order word of the last doubleword in the fpregset. */ diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 60cf986..2d48ed5 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -114,9 +114,10 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, the register's floating-point format. */ char regval[MAX_REGISTER_SIZE]; struct type *regtype - = register_type (gdbarch, FP0_REGNUM + freg); + = register_type (gdbarch, tdep->ppc_fp0_regnum + freg); convert_typed_floating (val, type, regval, regtype); - regcache_cooked_write (regcache, FP0_REGNUM + freg, + regcache_cooked_write (regcache, + tdep->ppc_fp0_regnum + freg, regval); } freg++; @@ -338,8 +339,9 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *type, /* Floats and doubles stored in "f1". Convert the value to the required type. */ char regval[MAX_REGISTER_SIZE]; - struct type *regtype = register_type (gdbarch, FP0_REGNUM + 1); - regcache_cooked_read (regcache, FP0_REGNUM + 1, regval); + struct type *regtype = register_type (gdbarch, + tdep->ppc_fp0_regnum + 1); + regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval); convert_typed_floating (regval, regtype, readbuf, type); } if (writebuf) @@ -347,9 +349,9 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *type, /* Floats and doubles stored in "f1". Convert the value to the register's "double" type. */ char regval[MAX_REGISTER_SIZE]; - struct type *regtype = register_type (gdbarch, FP0_REGNUM); + struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum); convert_typed_floating (writebuf, type, regval, regtype); - regcache_cooked_write (regcache, FP0_REGNUM + 1, regval); + regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval); } return RETURN_VALUE_REGISTER_CONVENTION; } @@ -643,10 +645,11 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, && freg <= 13) { char regval[MAX_REGISTER_SIZE]; - struct type *regtype = register_type (gdbarch, - FP0_REGNUM); + struct type *regtype + = register_type (gdbarch, tdep->ppc_fp0_regnum); convert_typed_floating (val, type, regval, regtype); - regcache_cooked_write (regcache, FP0_REGNUM + freg, + regcache_cooked_write (regcache, + tdep->ppc_fp0_regnum + freg, regval); } if (greg <= 10) @@ -851,15 +854,15 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *valtype, if (TYPE_CODE (valtype) == TYPE_CODE_FLT && TYPE_LENGTH (valtype) <= 8) { char regval[MAX_REGISTER_SIZE]; - struct type *regtype = register_type (gdbarch, FP0_REGNUM); + struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum); if (writebuf != NULL) { convert_typed_floating (writebuf, valtype, regval, regtype); - regcache_cooked_write (regcache, FP0_REGNUM + 1, regval); + regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval); } if (readbuf != NULL) { - regcache_cooked_read (regcache, FP0_REGNUM + 1, regval); + regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval); convert_typed_floating (regval, regtype, readbuf, valtype); } return RETURN_VALUE_REGISTER_CONVENTION; @@ -921,10 +924,10 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *valtype, for (i = 0; i < TYPE_LENGTH (valtype) / 8; i++) { if (writebuf != NULL) - regcache_cooked_write (regcache, FP0_REGNUM + 1 + i, + regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1 + i, (const bfd_byte *) writebuf + i * 8); if (readbuf != NULL) - regcache_cooked_read (regcache, FP0_REGNUM + 1 + i, + regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1 + i, (bfd_byte *) readbuf + i * 8); } } @@ -941,18 +944,21 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *valtype, { char regval[MAX_REGISTER_SIZE]; struct type *regtype = - register_type (current_gdbarch, FP0_REGNUM); + register_type (current_gdbarch, tdep->ppc_fp0_regnum); if (writebuf != NULL) { convert_typed_floating ((const bfd_byte *) writebuf + i * (TYPE_LENGTH (valtype) / 2), valtype, regval, regtype); - regcache_cooked_write (regcache, FP0_REGNUM + 1 + i, + regcache_cooked_write (regcache, + tdep->ppc_fp0_regnum + 1 + i, regval); } if (readbuf != NULL) { - regcache_cooked_read (regcache, FP0_REGNUM + 1 + i, regval); + regcache_cooked_read (regcache, + tdep->ppc_fp0_regnum + 1 + i, + regval); convert_typed_floating (regval, regtype, (bfd_byte *) readbuf + i * (TYPE_LENGTH (valtype) / 2), @@ -971,10 +977,10 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *valtype, for (i = 0; i < 4; i++) { if (writebuf != NULL) - regcache_cooked_write (regcache, FP0_REGNUM + 1 + i, + regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1 + i, (const bfd_byte *) writebuf + i * 8); if (readbuf != NULL) - regcache_cooked_read (regcache, FP0_REGNUM + 1 + i, + regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1 + i, (bfd_byte *) readbuf + i * 8); } } diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h index 4830c5e..9bfb68e 100644 --- a/gdb/ppc-tdep.h +++ b/gdb/ppc-tdep.h @@ -150,6 +150,7 @@ struct gdbarch_tdep int ppc_lr_regnum; /* Link register */ int ppc_ctr_regnum; /* Count register */ int ppc_xer_regnum; /* Integer exception register */ + int ppc_fp0_regnum; /* floating-point register 0 */ int ppc_fpscr_regnum; /* Floating point status and condition register */ int ppc_mq_regnum; /* Multiply/Divide extension register */ diff --git a/gdb/ppcnbsd-nat.c b/gdb/ppcnbsd-nat.c index ce097d7..9b7a550 100644 --- a/gdb/ppcnbsd-nat.c +++ b/gdb/ppcnbsd-nat.c @@ -49,7 +49,8 @@ getfpregs_supplies (int regno) { struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - return ((regno >= FP0_REGNUM && regno <= FP0_REGNUM + 31) + return ((regno >= tdep->ppc_fp0_regnum + && regno < tdep->ppc_fp0_regnum + ppc_num_fprs) || regno == tdep->ppc_fpscr_regnum); } diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c index 77150af..891b74fc 100644 --- a/gdb/ppcnbsd-tdep.c +++ b/gdb/ppcnbsd-tdep.c @@ -111,10 +111,11 @@ ppcnbsd_supply_fpreg (char *fpregs, int regno) struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int i; - for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++) + for (i = 0; i < ppc_num_fprs; i++) { - if (regno == i || regno == -1) - supply_register (i, fpregs + FPREG_FPR_OFFSET (i - FP0_REGNUM)); + if (regno == tdep->ppc_fp0_regnum + i || regno == -1) + supply_register (tdep->ppc_fp0_regnum + i, + fpregs + FPREG_FPR_OFFSET (i)); } if (regno == tdep->ppc_fpscr_regnum || regno == -1) @@ -127,10 +128,11 @@ ppcnbsd_fill_fpreg (char *fpregs, int regno) struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int i; - for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++) + for (i = 0; i < ppc_num_fprs; i++) { - if (regno == i || regno == -1) - regcache_collect (i, fpregs + FPREG_FPR_OFFSET (i - FP0_REGNUM)); + if (regno == tdep->ppc_fp0_regnum + i || regno == -1) + regcache_collect (tdep->ppc_fp0_regnum + i, + fpregs + FPREG_FPR_OFFSET (i)); } if (regno == tdep->ppc_fpscr_regnum || regno == -1) diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index 5628a2e..b80b5a5 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -159,10 +159,11 @@ regmap (int regno, int *isfloat) if (tdep->ppc_gp0_regnum <= regno && regno < tdep->ppc_gp0_regnum + ppc_num_gprs) return regno; - else if (FP0_REGNUM <= regno && regno < FP0_REGNUM + ppc_num_fprs) + else if (tdep->ppc_fp0_regnum <= regno + && regno < tdep->ppc_fp0_regnum + ppc_num_fprs) { *isfloat = 1; - return regno - FP0_REGNUM + FPR0; + return regno - tdep->ppc_fp0_regnum + FPR0; } else if (regno == PC_REGNUM) return IAR; @@ -358,8 +359,8 @@ fetch_inferior_registers (int regno) } /* Read general purpose floating point registers. */ - for (regno = FP0_REGNUM; regno < FP0_REGNUM + ppc_num_fprs; regno++) - fetch_register (regno); + for (regno = 0; regno < ppc_num_fprs; regno++) + fetch_register (tdep->ppc_fp0_regnum + regno); /* Read special registers. */ fetch_register (PC_REGNUM); @@ -397,8 +398,8 @@ store_inferior_registers (int regno) } /* Write floating point registers. */ - for (regno = FP0_REGNUM; regno < FP0_REGNUM + ppc_num_fprs; regno ++) - store_register (regno); + for (regno = 0; regno < ppc_num_fprs; regno++) + store_register (tdep->ppc_fp0_regnum + regno); /* Write special registers. */ store_register (PC_REGNUM); @@ -583,7 +584,8 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, supply_register (regi, (char *) ®s->r64.gpr[regi]); for (regi = 0; regi < 32; regi++) - supply_register (FP0_REGNUM + regi, (char *) ®s->r64.fpr[regi]); + supply_register (tdep->ppc_fp0_regnum + regi, + (char *) ®s->r64.fpr[regi]); supply_register (PC_REGNUM, (char *) ®s->r64.iar); supply_register (tdep->ppc_ps_regnum, (char *) ®s->r64.msr); @@ -599,7 +601,8 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, supply_register (regi, (char *) ®s->r32.gpr[regi]); for (regi = 0; regi < 32; regi++) - supply_register (FP0_REGNUM + regi, (char *) ®s->r32.fpr[regi]); + supply_register (tdep->ppc_fp0_regnum + regi, + (char *) ®s->r32.fpr[regi]); supply_register (PC_REGNUM, (char *) ®s->r32.iar); supply_register (tdep->ppc_ps_regnum, (char *) ®s->r32.msr); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 8a78ff2..bdc7e5e 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -227,7 +227,9 @@ ppc_supply_fpregset (const struct regset *regset, struct regcache *regcache, int i; offset = offsets->f0_offset; - for (i = FP0_REGNUM; i < FP0_REGNUM + 32; i++, offset += 4) + for (i = tdep->ppc_fp0_regnum; + i < tdep->ppc_fp0_regnum + ppc_num_fprs; + i++, offset += 4) { if (regnum == -1 || regnum == i) ppc_supply_reg (regcache, i, fpregs, offset); @@ -300,7 +302,9 @@ ppc_collect_fpregset (const struct regset *regset, int i; offset = offsets->f0_offset; - for (i = FP0_REGNUM; i <= FP0_REGNUM + 32; i++, offset += 4) + for (i = tdep->ppc_fp0_regnum; + i <= tdep->ppc_fp0_regnum + ppc_num_fprs; + i++, offset += 4) { if (regnum == -1 || regnum == i) ppc_collect_reg (regcache, regnum, fpregs, offset); @@ -1239,7 +1243,8 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, printf_unfiltered ( "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno); - memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FP0_REGNUM + 1 + f_argno)], + memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE + (tdep->ppc_fp0_regnum + 1 + f_argno)], VALUE_CONTENTS (arg), len); ++f_argno; @@ -1352,7 +1357,9 @@ ran_out_of_registers_for_arguments: printf_unfiltered ( "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno); - memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FP0_REGNUM + 1 + f_argno)], + memcpy (&(deprecated_registers + [DEPRECATED_REGISTER_BYTE + (tdep->ppc_fp0_regnum + 1 + f_argno)]), VALUE_CONTENTS (arg), len); ++f_argno; @@ -1417,7 +1424,7 @@ rs6000_extract_return_value (struct type *valtype, char *regbuf, char *valbuf) necessary. */ convert_typed_floating (®buf[DEPRECATED_REGISTER_BYTE - (FP0_REGNUM + 1)], + (tdep->ppc_fp0_regnum + 1)], builtin_type_double, valbuf, valtype); @@ -1720,7 +1727,7 @@ rs6000_dwarf2_stab_reg_to_regnum (int num) if (0 <= num && num <= 31) return tdep->ppc_gp0_regnum + num; else if (32 <= num && num <= 63) - return FP0_REGNUM + (num - 32); + return tdep->ppc_fp0_regnum + (num - 32); else if (1200 <= num && num < 1200 + 32) return tdep->ppc_ev0_regnum + (num - 1200); else @@ -1764,8 +1771,10 @@ rs6000_store_return_value (struct type *type, char *valbuf) Say a double_double_double type could be returned in FPR1/FPR2/FPR3 triple. */ - deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (FP0_REGNUM + 1), valbuf, - TYPE_LENGTH (type)); + deprecated_write_register_bytes + (DEPRECATED_REGISTER_BYTE (tdep->ppc_fp0_regnum + 1), + valbuf, + TYPE_LENGTH (type)); else if (TYPE_CODE (type) == TYPE_CODE_ARRAY) { if (TYPE_LENGTH (type) == 16 @@ -2438,7 +2447,7 @@ rs6000_frame_cache (struct frame_info *next_frame, void **this_cache) CORE_ADDR fpr_addr = cache->base + fdata.fpr_offset; for (i = fdata.saved_fpr; i < 32; i++) { - cache->saved_regs[FP0_REGNUM + i].addr = fpr_addr; + cache->saved_regs[tdep->ppc_fp0_regnum + i].addr = fpr_addr; fpr_addr += 8; } } @@ -2713,6 +2722,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->ppc_mq_regnum = 70; else tdep->ppc_mq_regnum = -1; + tdep->ppc_fp0_regnum = 32; tdep->ppc_fpscr_regnum = power ? 71 : 70; set_gdbarch_pc_regnum (gdbarch, 64); |