From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31281 invoked by alias); 4 May 2004 20:45:57 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 31186 invoked from network); 4 May 2004 20:45:51 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 4 May 2004 20:45:51 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i44KjpkG021933 for ; Tue, 4 May 2004 16:45:51 -0400 Received: from zenia.home.redhat.com (porkchop.devel.redhat.com [172.16.58.2]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i44Kjfv28383; Tue, 4 May 2004 16:45:41 -0400 To: Kevin Buettner Cc: gdb-patches@sources.redhat.com Subject: Re: RFA: let gdbarch define FP0_REGNUM on rs6000 References: <4097A012.2050409@gnu.org> <20040504090129.74ce59dd@saguaro> From: Jim Blandy Date: Tue, 04 May 2004 20:45:00 -0000 In-Reply-To: <20040504090129.74ce59dd@saguaro> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-05/txt/msg00119.txt.bz2 Kevin Buettner writes: > On 04 May 2004 10:16:25 -0500 > Jim Blandy wrote: > > > > > - #define FP0_REGNUM 32 /* Floating point register 0 */ > > > > > > Note that FP0_REGNUM is on the deprecate hit list, it's superseeded by > > > things like reggroups and regsets. As with other code, you should > > > s/FP0_REGNUM/RS6000_FP0_REGNUM/ where possible. > > > > Okay. In the RS6000 case, it'd probably be more consistent to simply > > use tdep->ppc_fp0_regnum, rather than introducing a new macro. > > I agree. Consider such a patch to be preapproved. Actually, I'd appreciate a second set of eyes. The patch to completely remove uses of FP0_REGNUM from RS6000-specific code was larger than I expected. 2004-05-04 Jim Blandy * 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. *** gdb/config/rs6000/tm-rs6000.h 2004-05-03 17:32:42.000000000 -0500 --- gdb/config/rs6000/tm-rs6000.h 2004-05-04 13:19:37.000000000 -0500 *************** *** 71,76 **** --- 71,80 ---- 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. */ *** gdb/ppc-tdep.h 2004-05-03 17:32:35.000000000 -0500 --- gdb/ppc-tdep.h 2004-05-04 13:05:36.000000000 -0500 *************** *** 150,155 **** --- 150,156 ---- 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 */ *** gdb/rs6000-tdep.c 2004-05-03 17:32:35.000000000 -0500 --- gdb/rs6000-tdep.c 2004-05-04 13:52:24.000000000 -0500 *************** *** 227,233 **** int i; offset = offsets->f0_offset; ! for (i = FP0_REGNUM; i < FP0_REGNUM + 32; i++, offset += 4) { if (regnum == -1 || regnum == i) ppc_supply_reg (regcache, i, fpregs, offset); --- 227,235 ---- int i; offset = offsets->f0_offset; ! 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,306 **** int i; offset = offsets->f0_offset; ! for (i = FP0_REGNUM; i <= FP0_REGNUM + 32; i++, offset += 4) { if (regnum == -1 || regnum == i) ppc_collect_reg (regcache, regnum, fpregs, offset); --- 302,310 ---- int i; offset = offsets->f0_offset; ! 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,1245 **** 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)], VALUE_CONTENTS (arg), len); ++f_argno; --- 1243,1250 ---- printf_unfiltered ( "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno); ! memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE ! (tdep->ppc_fp0_regnum + 1 + f_argno)], VALUE_CONTENTS (arg), len); ++f_argno; *************** *** 1352,1358 **** 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)], VALUE_CONTENTS (arg), len); ++f_argno; --- 1357,1365 ---- printf_unfiltered ( "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno); ! memcpy (&(deprecated_registers ! [DEPRECATED_REGISTER_BYTE ! (tdep->ppc_fp0_regnum + 1 + f_argno)]), VALUE_CONTENTS (arg), len); ++f_argno; *************** *** 1417,1423 **** necessary. */ convert_typed_floating (®buf[DEPRECATED_REGISTER_BYTE ! (FP0_REGNUM + 1)], builtin_type_double, valbuf, valtype); --- 1424,1430 ---- necessary. */ convert_typed_floating (®buf[DEPRECATED_REGISTER_BYTE ! (tdep->ppc_fp0_regnum + 1)], builtin_type_double, valbuf, valtype); *************** *** 1720,1726 **** if (0 <= num && num <= 31) return tdep->ppc_gp0_regnum + num; else if (32 <= num && num <= 63) ! return FP0_REGNUM + (num - 32); else if (1200 <= num && num < 1200 + 32) return tdep->ppc_ev0_regnum + (num - 1200); else --- 1727,1733 ---- if (0 <= num && num <= 31) return tdep->ppc_gp0_regnum + num; else if (32 <= num && num <= 63) ! return tdep->ppc_fp0_regnum + (num - 32); else if (1200 <= num && num < 1200 + 32) return tdep->ppc_ev0_regnum + (num - 1200); else *************** *** 1764,1771 **** 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)); else if (TYPE_CODE (type) == TYPE_CODE_ARRAY) { if (TYPE_LENGTH (type) == 16 --- 1771,1780 ---- Say a double_double_double type could be returned in FPR1/FPR2/FPR3 triple. */ ! 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,2444 **** 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; fpr_addr += 8; } } --- 2447,2453 ---- CORE_ADDR fpr_addr = cache->base + fdata.fpr_offset; for (i = fdata.saved_fpr; i < 32; i++) { ! cache->saved_regs[tdep->ppc_fp0_regnum + i].addr = fpr_addr; fpr_addr += 8; } } *************** *** 2713,2718 **** --- 2722,2728 ---- 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); *** gdb/aix-thread.c 2004-05-03 17:32:35.000000000 -0500 --- gdb/aix-thread.c 2004-05-04 15:21:10.000000000 -0500 *************** *** 1020,1029 **** static void supply_fprs (double *vals) { int regno; for (regno = 0; regno < 32; regno++) ! supply_register (regno + FP0_REGNUM, (char *) (vals + regno)); } /* Predicate to test whether given register number is a "special" register. */ --- 1020,1030 ---- 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 + tdep->ppc_fp0_regnum, (char *) (vals + regno)); } /* Predicate to test whether given register number is a "special" register. */ *************** *** 1142,1147 **** --- 1143,1149 ---- 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,1161 **** (long) tid, regno, arch64); /* General-purpose registers. */ ! if (regno == -1 || regno < FP0_REGNUM) { if (arch64) { --- 1157,1163 ---- (long) tid, regno, arch64); /* General-purpose registers. */ ! if (regno == -1 || regno < tdep->ppc_fp0_regnum) { if (arch64) { *************** *** 1176,1183 **** /* Floating-point registers. */ if (regno == -1 ! || (regno >= FP0_REGNUM ! && regno < FP0_REGNUM + ppc_num_fprs)) { if (!ptrace32 (PTT_READ_FPRS, tid, (int *) fprs, 0, NULL)) memset (fprs, 0, sizeof (fprs)); --- 1178,1185 ---- /* Floating-point registers. */ if (regno == -1 ! || (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,1249 **** static void fill_gprs64 (uint64_t *vals) { int regno; ! for (regno = 0; regno < FP0_REGNUM; regno++) if (register_cached (regno)) regcache_collect (regno, vals + regno); } --- 1243,1252 ---- static void fill_gprs64 (uint64_t *vals) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int regno; ! for (regno = 0; regno < tdep->ppc_fp0_regnum; regno++) if (register_cached (regno)) regcache_collect (regno, vals + regno); } *************** *** 1251,1259 **** static void fill_gprs32 (uint32_t *vals) { int regno; ! for (regno = 0; regno < FP0_REGNUM; regno++) if (register_cached (regno)) regcache_collect (regno, vals + regno); } --- 1254,1263 ---- static void fill_gprs32 (uint32_t *vals) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int regno; ! for (regno = 0; regno < tdep->ppc_fp0_regnum; regno++) if (register_cached (regno)) regcache_collect (regno, vals + regno); } *************** *** 1262,1270 **** static void fill_fprs (double *vals) { int regno; ! for (regno = FP0_REGNUM; regno < FP0_REGNUM + ppc_num_fprs; regno++) if (register_cached (regno)) regcache_collect (regno, vals + regno); } --- 1266,1277 ---- static void fill_fprs (double *vals) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int 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,1439 **** --- 1441,1447 ---- 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,1454 **** (long) tid, regno); /* General-purpose registers. */ ! if (regno == -1 || regno < FP0_REGNUM) { if (arch64) { --- 1456,1462 ---- (long) tid, regno); /* General-purpose registers. */ ! if (regno == -1 || regno < tdep->ppc_fp0_regnum) { if (arch64) { *************** *** 1469,1476 **** /* Floating-point registers. */ if (regno == -1 ! || (regno >= FP0_REGNUM ! && regno < FP0_REGNUM + ppc_num_fprs)) { /* Pre-fetch: some regs may not be in the cache. */ ptrace32 (PTT_READ_FPRS, tid, (int *) fprs, 0, NULL); --- 1477,1484 ---- /* Floating-point registers. */ if (regno == -1 ! || (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); *** gdb/ppc-bdm.c 2004-05-03 17:32:35.000000000 -0500 --- gdb/ppc-bdm.c 2004-05-04 13:30:35.000000000 -0500 *************** *** 153,158 **** --- 153,159 ---- 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,209 **** /* 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))) { /* printf("invalid reg request!\n"); */ supply_register (first_regno, NULL); --- 203,210 ---- /* 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 >= tdep->ppc_fp0_regnum) ! && (first_regno < tdep->ppc_fp0_regnum + ppc_num_fprs))) { /* printf("invalid reg request!\n"); */ supply_register (first_regno, NULL); *************** *** 220,229 **** { /* 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))); almostregs = (strcat (beginregs, endregs)); regs = (strcat (almostregs, mqreg)); reglen = beginreglen + 32 + endreglen + 1; --- 221,232 ---- { /* printf("Asking for registers %d to %d\n", first_regno, last_regno); */ beginregs = ocd_read_bdm_registers (first_bdm_regno, ! 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,264 **** --- 262,268 ---- 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,299 **** /* (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))) { /* printf("write valid reg %d\n", bdm_regno); */ ocd_write_bdm_registers (bdm_regno, deprecated_registers + DEPRECATED_REGISTER_BYTE (i), 4); --- 297,304 ---- /* (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 < 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); *** gdb/ppc-linux-nat.c 2004-05-03 17:32:35.000000000 -0500 --- gdb/ppc-linux-nat.c 2004-05-04 13:32:34.000000000 -0500 *************** *** 139,146 **** /* 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); /* UISA special purpose registers: 1 slot each */ if (regno == PC_REGNUM) --- 139,147 ---- /* 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 >= 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,207 **** --- 203,209 ---- 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,257 **** /* 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) || 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. */ --- 253,260 ---- /* Now supply the register. Be careful to map between ptrace's and the current_regcache's idea of the current wordsize. */ ! 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,381 **** --- 379,385 ---- 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,401 **** /* 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) || 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. */ --- 399,406 ---- /* 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 >= 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,592 **** 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_fpscr_regnum) right_fill_reg (tdep->ppc_fpscr_regnum, (fpp + 8 * 32)); --- 590,597 ---- for (regi = 0; regi < 32; 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)); *** gdb/ppc-linux-tdep.c 2004-05-03 17:32:35.000000000 -0500 --- gdb/ppc-linux-tdep.c 2004-05-04 14:28:12.000000000 -0500 *************** *** 946,952 **** /* Floating point registers. */ for (i = 0; i < 32; i++) { ! int regnum = i + FP0_REGNUM; cache->saved_regs[regnum].addr = fpregs + i * tdep->wordsize; } cache->saved_regs[tdep->ppc_fpscr_regnum].addr = fpregs + 32 * tdep->wordsize; --- 946,952 ---- /* Floating point registers. */ for (i = 0; i < 32; i++) { ! 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,1025 **** const bfd_byte *buf = fpset; for (regi = 0; regi < 32; regi++) ! regcache_raw_supply (regcache, FP0_REGNUM + regi, buf + 8 * regi); /* The FPSCR is stored in the low order word of the last doubleword in the fpregset. */ --- 1019,1027 ---- const bfd_byte *buf = fpset; for (regi = 0; regi < 32; 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. */ *** gdb/ppcnbsd-nat.c 2004-05-03 17:32:35.000000000 -0500 --- gdb/ppcnbsd-nat.c 2004-05-04 13:37:21.000000000 -0500 *************** *** 49,55 **** { struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); ! return ((regno >= FP0_REGNUM && regno <= FP0_REGNUM + 31) || regno == tdep->ppc_fpscr_regnum); } --- 49,56 ---- { struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); ! return ((regno >= tdep->ppc_fp0_regnum ! && regno < tdep->ppc_fp0_regnum + ppc_num_fprs) || regno == tdep->ppc_fpscr_regnum); } *** gdb/ppcnbsd-tdep.c 2004-05-03 17:32:35.000000000 -0500 --- gdb/ppcnbsd-tdep.c 2004-05-04 13:41:23.000000000 -0500 *************** *** 111,120 **** struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int i; ! for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++) { ! if (regno == i || regno == -1) ! supply_register (i, fpregs + FPREG_FPR_OFFSET (i - FP0_REGNUM)); } if (regno == tdep->ppc_fpscr_regnum || regno == -1) --- 111,121 ---- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int i; ! for (i = 0; i < ppc_num_fprs; i++) { ! 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,136 **** struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int i; ! for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++) { ! if (regno == i || regno == -1) ! regcache_collect (i, fpregs + FPREG_FPR_OFFSET (i - FP0_REGNUM)); } if (regno == tdep->ppc_fpscr_regnum || regno == -1) --- 128,138 ---- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int i; ! for (i = 0; i < ppc_num_fprs; i++) { ! 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) *** gdb/ppc-sysv-tdep.c 2004-05-03 17:32:35.000000000 -0500 --- gdb/ppc-sysv-tdep.c 2004-05-04 13:35:42.000000000 -0500 *************** *** 114,122 **** the register's floating-point format. */ char regval[MAX_REGISTER_SIZE]; struct type *regtype ! = register_type (gdbarch, FP0_REGNUM + freg); convert_typed_floating (val, type, regval, regtype); ! regcache_cooked_write (regcache, FP0_REGNUM + freg, regval); } freg++; --- 114,123 ---- the register's floating-point format. */ char regval[MAX_REGISTER_SIZE]; struct type *regtype ! = register_type (gdbarch, tdep->ppc_fp0_regnum + freg); convert_typed_floating (val, type, regval, regtype); ! regcache_cooked_write (regcache, ! tdep->ppc_fp0_regnum + freg, regval); } freg++; *************** *** 338,345 **** /* 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); convert_typed_floating (regval, regtype, readbuf, type); } if (writebuf) --- 339,347 ---- /* Floats and doubles stored in "f1". Convert the value to the required type. */ char regval[MAX_REGISTER_SIZE]; ! 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,355 **** /* 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); convert_typed_floating (writebuf, type, regval, regtype); ! regcache_cooked_write (regcache, FP0_REGNUM + 1, regval); } return RETURN_VALUE_REGISTER_CONVENTION; } --- 349,357 ---- /* 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, tdep->ppc_fp0_regnum); convert_typed_floating (writebuf, type, regval, regtype); ! regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval); } return RETURN_VALUE_REGISTER_CONVENTION; } *************** *** 643,652 **** && freg <= 13) { char regval[MAX_REGISTER_SIZE]; ! struct type *regtype = register_type (gdbarch, ! FP0_REGNUM); convert_typed_floating (val, type, regval, regtype); ! regcache_cooked_write (regcache, FP0_REGNUM + freg, regval); } if (greg <= 10) --- 645,655 ---- && freg <= 13) { char regval[MAX_REGISTER_SIZE]; ! struct type *regtype ! = register_type (gdbarch, tdep->ppc_fp0_regnum); convert_typed_floating (val, type, regval, regtype); ! regcache_cooked_write (regcache, ! tdep->ppc_fp0_regnum + freg, regval); } if (greg <= 10) *************** *** 851,865 **** if (TYPE_CODE (valtype) == TYPE_CODE_FLT && TYPE_LENGTH (valtype) <= 8) { char regval[MAX_REGISTER_SIZE]; ! struct type *regtype = register_type (gdbarch, FP0_REGNUM); if (writebuf != NULL) { convert_typed_floating (writebuf, valtype, regval, regtype); ! regcache_cooked_write (regcache, FP0_REGNUM + 1, regval); } if (readbuf != NULL) { ! regcache_cooked_read (regcache, FP0_REGNUM + 1, regval); convert_typed_floating (regval, regtype, readbuf, valtype); } return RETURN_VALUE_REGISTER_CONVENTION; --- 854,868 ---- if (TYPE_CODE (valtype) == TYPE_CODE_FLT && TYPE_LENGTH (valtype) <= 8) { char regval[MAX_REGISTER_SIZE]; ! struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum); if (writebuf != NULL) { convert_typed_floating (writebuf, valtype, regval, regtype); ! regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval); } if (readbuf != NULL) { ! regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval); convert_typed_floating (regval, regtype, readbuf, valtype); } return RETURN_VALUE_REGISTER_CONVENTION; *************** *** 921,930 **** for (i = 0; i < TYPE_LENGTH (valtype) / 8; i++) { if (writebuf != NULL) ! regcache_cooked_write (regcache, FP0_REGNUM + 1 + i, (const bfd_byte *) writebuf + i * 8); if (readbuf != NULL) ! regcache_cooked_read (regcache, FP0_REGNUM + 1 + i, (bfd_byte *) readbuf + i * 8); } } --- 924,933 ---- for (i = 0; i < TYPE_LENGTH (valtype) / 8; i++) { if (writebuf != NULL) ! regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1 + i, (const bfd_byte *) writebuf + i * 8); if (readbuf != NULL) ! regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1 + i, (bfd_byte *) readbuf + i * 8); } } *************** *** 941,958 **** { char regval[MAX_REGISTER_SIZE]; struct type *regtype = ! register_type (current_gdbarch, 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, regval); } if (readbuf != NULL) { ! regcache_cooked_read (regcache, FP0_REGNUM + 1 + i, regval); convert_typed_floating (regval, regtype, (bfd_byte *) readbuf + i * (TYPE_LENGTH (valtype) / 2), --- 944,964 ---- { char regval[MAX_REGISTER_SIZE]; struct type *regtype = ! 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, ! tdep->ppc_fp0_regnum + 1 + i, regval); } if (readbuf != NULL) { ! 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,980 **** for (i = 0; i < 4; i++) { if (writebuf != NULL) ! regcache_cooked_write (regcache, FP0_REGNUM + 1 + i, (const bfd_byte *) writebuf + i * 8); if (readbuf != NULL) ! regcache_cooked_read (regcache, FP0_REGNUM + 1 + i, (bfd_byte *) readbuf + i * 8); } } --- 977,986 ---- for (i = 0; i < 4; i++) { if (writebuf != NULL) ! regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1 + i, (const bfd_byte *) writebuf + i * 8); if (readbuf != NULL) ! regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1 + i, (bfd_byte *) readbuf + i * 8); } } *** gdb/rs6000-nat.c 2004-05-03 17:32:35.000000000 -0500 --- gdb/rs6000-nat.c 2004-05-04 13:46:56.000000000 -0500 *************** *** 159,168 **** 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) { *isfloat = 1; ! return regno - FP0_REGNUM + FPR0; } else if (regno == PC_REGNUM) return IAR; --- 159,169 ---- if (tdep->ppc_gp0_regnum <= regno && regno < tdep->ppc_gp0_regnum + ppc_num_gprs) return regno; ! else if (tdep->ppc_fp0_regnum <= regno ! && regno < tdep->ppc_fp0_regnum + ppc_num_fprs) { *isfloat = 1; ! return regno - tdep->ppc_fp0_regnum + FPR0; } else if (regno == PC_REGNUM) return IAR; *************** *** 358,365 **** } /* Read general purpose floating point registers. */ ! for (regno = FP0_REGNUM; regno < FP0_REGNUM + ppc_num_fprs; regno++) ! fetch_register (regno); /* Read special registers. */ fetch_register (PC_REGNUM); --- 359,366 ---- } /* Read general purpose floating point registers. */ ! for (regno = 0; regno < ppc_num_fprs; regno++) ! fetch_register (tdep->ppc_fp0_regnum + regno); /* Read special registers. */ fetch_register (PC_REGNUM); *************** *** 397,404 **** } /* Write floating point registers. */ ! for (regno = FP0_REGNUM; regno < FP0_REGNUM + ppc_num_fprs; regno ++) ! store_register (regno); /* Write special registers. */ store_register (PC_REGNUM); --- 398,405 ---- } /* Write floating point registers. */ ! for (regno = 0; regno < ppc_num_fprs; regno++) ! store_register (tdep->ppc_fp0_regnum + regno); /* Write special registers. */ store_register (PC_REGNUM); *************** *** 583,589 **** 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 (PC_REGNUM, (char *) ®s->r64.iar); supply_register (tdep->ppc_ps_regnum, (char *) ®s->r64.msr); --- 584,591 ---- supply_register (regi, (char *) ®s->r64.gpr[regi]); for (regi = 0; regi < 32; 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,605 **** 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 (PC_REGNUM, (char *) ®s->r32.iar); supply_register (tdep->ppc_ps_regnum, (char *) ®s->r32.msr); --- 601,608 ---- supply_register (regi, (char *) ®s->r32.gpr[regi]); for (regi = 0; regi < 32; 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);