From: Jim Blandy <jimb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [ppc64-linux]: correctly compute u-area register offsets
Date: Tue, 10 Jun 2003 16:24:00 -0000 [thread overview]
Message-ID: <vt2d6hlvr14.fsf@zenia.home> (raw)
This patch contains all my fixes to ppc_register_u_addr to date; I
think it's complete and correct.
It combines a recent patch, "Compute u-area offsets of FP registers
correctly" with a change I committed to the ppc64-linux branch a while
back, and forgot to post. The patch I did post:
http://sources.redhat.com/ml/gdb-patches/2003-06/msg00250.html
2003-06-10 Jim Blandy <jimb@redhat.com>
* ppc-linux-nat.c (ppc_register_u_addr): Correctly compute u-area
register offsets for both the 32- and 64-bit interfaces.
Index: gdb/ppc-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-nat.c,v
retrieving revision 1.21.6.5
diff -c -r1.21.6.5 ppc-linux-nat.c
*** gdb/ppc-linux-nat.c 10 Jun 2003 16:18:12 -0000 1.21.6.5
--- gdb/ppc-linux-nat.c 10 Jun 2003 16:20:14 -0000
***************
*** 127,160 ****
{
int u_addr = -1;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
/* General purpose registers occupy 1 slot each in the buffer */
if (regno >= tdep->ppc_gp0_regnum && regno <= tdep->ppc_gplast_regnum )
! u_addr = ((PT_R0 + regno) * 4);
! /* Floating point regs: 2 slots each */
if (regno >= FP0_REGNUM && regno <= FPLAST_REGNUM)
! u_addr = ((PT_FPR0 + (regno - FP0_REGNUM) * 2) * 4);
/* UISA special purpose registers: 1 slot each */
if (regno == PC_REGNUM)
! u_addr = PT_NIP * 4;
if (regno == tdep->ppc_lr_regnum)
! u_addr = PT_LNK * 4;
if (regno == tdep->ppc_cr_regnum)
! u_addr = PT_CCR * 4;
if (regno == tdep->ppc_xer_regnum)
! u_addr = PT_XER * 4;
if (regno == tdep->ppc_ctr_regnum)
! u_addr = PT_CTR * 4;
#ifdef PT_MQ
if (regno == tdep->ppc_mq_regnum)
! u_addr = PT_MQ * 4;
#endif
if (regno == tdep->ppc_ps_regnum)
! u_addr = PT_MSR * 4;
if (regno == tdep->ppc_fpscr_regnum)
! u_addr = PT_FPSCR * 4;
return u_addr;
}
--- 127,163 ----
{
int u_addr = -1;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ int wordsize = tdep->wordsize;
/* General purpose registers occupy 1 slot each in the buffer */
if (regno >= tdep->ppc_gp0_regnum && regno <= tdep->ppc_gplast_regnum )
! u_addr = ((PT_R0 + regno) * wordsize);
! /* 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 <= FPLAST_REGNUM)
! u_addr = (PT_FPR0 * wordsize) + ((regno - FP0_REGNUM) * 8);
/* UISA special purpose registers: 1 slot each */
if (regno == PC_REGNUM)
! u_addr = PT_NIP * wordsize;
if (regno == tdep->ppc_lr_regnum)
! u_addr = PT_LNK * wordsize;
if (regno == tdep->ppc_cr_regnum)
! u_addr = PT_CCR * wordsize;
if (regno == tdep->ppc_xer_regnum)
! u_addr = PT_XER * wordsize;
if (regno == tdep->ppc_ctr_regnum)
! u_addr = PT_CTR * wordsize;
#ifdef PT_MQ
if (regno == tdep->ppc_mq_regnum)
! u_addr = PT_MQ * wordsize;
#endif
if (regno == tdep->ppc_ps_regnum)
! u_addr = PT_MSR * wordsize;
if (regno == tdep->ppc_fpscr_regnum)
! u_addr = PT_FPSCR * wordsize;
return u_addr;
}
next reply other threads:[~2003-06-10 16:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-10 16:24 Jim Blandy [this message]
2003-06-10 16:32 ` Kevin Buettner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vt2d6hlvr14.fsf@zenia.home \
--to=jimb@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox