Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [ppc64-linux]: correctly compute u-area register offsets
@ 2003-06-10 16:24 Jim Blandy
  2003-06-10 16:32 ` Kevin Buettner
  0 siblings, 1 reply; 2+ messages in thread
From: Jim Blandy @ 2003-06-10 16:24 UTC (permalink / raw)
  To: gdb-patches


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;
  }


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ppc64-linux]: correctly compute u-area register offsets
  2003-06-10 16:24 [ppc64-linux]: correctly compute u-area register offsets Jim Blandy
@ 2003-06-10 16:32 ` Kevin Buettner
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Buettner @ 2003-06-10 16:32 UTC (permalink / raw)
  To: Jim Blandy, gdb-patches

On Jun 10, 11:25am, Jim Blandy wrote:

> 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.

Okay.

Kevin


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-06-10 16:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-10 16:24 [ppc64-linux]: correctly compute u-area register offsets Jim Blandy
2003-06-10 16:32 ` Kevin Buettner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox