From 2188cbdd51632bca507dd4ae973a6e9bc322f297 Mon Sep 17 00:00:00 2001 From: Elena Zannoni Date: Sun, 9 Dec 2001 21:39:53 +0000 Subject: 2001-12-09 Elena Zannoni * config/rs6000/tm-rs6000.h (STAB_REG_TO_REGNUM): Remove definition, it is now multiarched. * ppc-tdep.h (struct gdbarch_tdep): Move from rs6000-tdep.c. Add fields for special register numbers. * rs6000-tdep.c (rs6000_gdbarch_init): Initialize new tdep special regnum fields. (rs6000_saved_pc_after_call): Use gdbarch_tdep registers fields instead of hardcoded macros. (branch_dest, rs6000_pop_frame, rs6000_fix_call_dummy, ppc_push_return_address, rs6000_frame_saved_pc, frame_get_saved_regs, rs6000_frame_chain, rs6000_store_return_value): Ditto. (rs6000_stab_reg_to_regnum): New function. * ppcnbsd-nat.c (fetch_inferior_registers, store_inferior_registers, fetch_core_registers): Ditto. * ppc-linux-tdep.c (ppc_linux_in_sigtramp, ppc_linux_frame_init_saved_regs): Ditto. * ppc-linux-nat.c (ppc_register_u_addr, supply_gregset, fill_gregset): Ditto. * ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_store_registers): Ditto. --- gdb/ppc-linux-nat.c | 70 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 25 deletions(-) (limited to 'gdb/ppc-linux-nat.c') diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 5701476..1d57a9a 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -62,7 +62,8 @@ ppc_register_u_addr (int ustart, int regno) int u_addr = -1; /* General purpose registers occupy 1 slot each in the buffer */ - if (regno >= PPC_GP0_REGNUM && regno <= PPC_GPLAST_REGNUM ) + if (regno >= gdbarch_tdep (current_gdbarch)->ppc_gp0_regnum + && regno <= gdbarch_tdep (current_gdbarch)->ppc_gplast_regnum ) u_addr = (ustart + (PT_R0 + regno) * 4); /* Floating point regs: 2 slots each */ @@ -72,17 +73,17 @@ ppc_register_u_addr (int ustart, int regno) /* UISA special purpose registers: 1 slot each */ if (regno == PC_REGNUM) u_addr = ustart + PT_NIP * 4; - if (regno == PPC_LR_REGNUM) + if (regno == gdbarch_tdep (current_gdbarch)->ppc_lr_regnum) u_addr = ustart + PT_LNK * 4; - if (regno == PPC_CR_REGNUM) + if (regno == gdbarch_tdep (current_gdbarch)->ppc_cr_regnum) u_addr = ustart + PT_CCR * 4; - if (regno == PPC_XER_REGNUM) + if (regno == gdbarch_tdep (current_gdbarch)->ppc_xer_regnum) u_addr = ustart + PT_XER * 4; - if (regno == PPC_CTR_REGNUM) + if (regno == gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum) u_addr = ustart + PT_CTR * 4; - if (regno == PPC_MQ_REGNUM) + if (regno == gdbarch_tdep (current_gdbarch)->ppc_mq_regnum) u_addr = ustart + PT_MQ * 4; - if (regno == PPC_PS_REGNUM) + if (regno == gdbarch_tdep (current_gdbarch)->ppc_ps_regnum) u_addr = ustart + PT_MSR * 4; return u_addr; @@ -98,12 +99,19 @@ supply_gregset (gdb_gregset_t *gregsetp) supply_register (regi, (char *) (regp + regi)); supply_register (PC_REGNUM, (char *) (regp + PT_NIP)); - supply_register (PPC_LR_REGNUM, (char *) (regp + PT_LNK)); - supply_register (PPC_CR_REGNUM, (char *) (regp + PT_CCR)); - supply_register (PPC_XER_REGNUM, (char *) (regp + PT_XER)); - supply_register (PPC_CTR_REGNUM, (char *) (regp + PT_CTR)); - supply_register (PPC_MQ_REGNUM, (char *) (regp + PT_MQ)); - supply_register (PPC_PS_REGNUM, (char *) (regp + PT_MSR)); + supply_register (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum, + (char *) (regp + PT_LNK)); + supply_register (gdbarch_tdep (current_gdbarch)->ppc_cr_regnum, + (char *) (regp + PT_CCR)); + supply_register (gdbarch_tdep (current_gdbarch)->ppc_xer_regnum, + (char *) (regp + PT_XER)); + supply_register (gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum, + (char *) (regp + PT_CTR)); + supply_register (gdbarch_tdep (current_gdbarch)->ppc_mq_regnum, + (char *) (regp + PT_MQ)); + supply_register (gdbarch_tdep (current_gdbarch)->ppc_ps_regnum, + (char *) (regp + PT_MSR)); + } void @@ -120,18 +128,30 @@ fill_gregset (gdb_gregset_t *gregsetp, int regno) if ((regno == -1) || regno == PC_REGNUM) regcache_collect (PC_REGNUM, regp + PT_NIP); - if ((regno == -1) || regno == PPC_LR_REGNUM) - regcache_collect (PPC_LR_REGNUM, regp + PT_LNK); - if ((regno == -1) || regno == PPC_CR_REGNUM) - regcache_collect (PPC_CR_REGNUM, regp + PT_CCR); - if ((regno == -1) || regno == PPC_XER_REGNUM) - regcache_collect (PPC_XER_REGNUM, regp + PT_XER); - if ((regno == -1) || regno == PPC_CTR_REGNUM) - regcache_collect (PPC_CTR_REGNUM, regp + PT_CTR); - if ((regno == -1) || regno == PPC_MQ_REGNUM) - regcache_collect (PPC_MQ_REGNUM, regp + PT_MQ); - if ((regno == -1) || regno == PPC_PS_REGNUM) - regcache_collect (PPC_PS_REGNUM, regp + PT_MSR); + if ((regno == -1) + || regno == gdbarch_tdep (current_gdbarch)->ppc_lr_regnum) + regcache_collect (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum, + regp + PT_LNK); + if ((regno == -1) + || regno == gdbarch_tdep (current_gdbarch)->ppc_cr_regnum) + regcache_collect (gdbarch_tdep (current_gdbarch)->ppc_cr_regnum, + regp + PT_CCR); + if ((regno == -1) + || regno == gdbarch_tdep (current_gdbarch)->ppc_xer_regnum) + regcache_collect (gdbarch_tdep (current_gdbarch)->ppc_xer_regnum, + regp + PT_XER); + if ((regno == -1) + || regno == gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum) + regcache_collect (gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum, + regp + PT_CTR); + if ((regno == -1) + || regno == gdbarch_tdep (current_gdbarch)->ppc_mq_regnum) + regcache_collect (gdbarch_tdep (current_gdbarch)->ppc_mq_regnum, + regp + PT_MQ); + if ((regno == -1) + || regno == gdbarch_tdep (current_gdbarch)->ppc_ps_regnum) + regcache_collect (gdbarch_tdep (current_gdbarch)->ppc_ps_regnum, + regp + PT_MSR); } void -- cgit v1.1