linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* program counter..
@ 2001-08-17 17:13 Raghava Raju
  2001-08-17 17:24 ` David Edelsohn
  0 siblings, 1 reply; 4+ messages in thread
From: Raghava Raju @ 2001-08-17 17:13 UTC (permalink / raw)
  To: linuxppc-dev


  Hi

     I was unable to find the registers for
  program counter,stack pointer. Which registers
  I should use to access these values in powerpc.

  Thank You
  Raj.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* program counter...
@ 2001-08-17 17:14 Raghava Raju
  2001-08-20 17:46 ` Scott Anderson
  0 siblings, 1 reply; 4+ messages in thread
From: Raghava Raju @ 2001-08-17 17:14 UTC (permalink / raw)
  To: linuxppc-embedded


Hi

     I was unable to find the registers for
  program counter,stack pointer. Which registers
  I should use to access these values in powerpc.

  Thank You
  Raj.


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: program counter..
  2001-08-17 17:13 Raghava Raju
@ 2001-08-17 17:24 ` David Edelsohn
  0 siblings, 0 replies; 4+ messages in thread
From: David Edelsohn @ 2001-08-17 17:24 UTC (permalink / raw)
  To: Raghava Raju; +Cc: linuxppc-dev


>>>>> Raghava Raju writes:

Raghava> I was unable to find the registers for
Raghava> program counter,stack pointer. Which registers
Raghava> I should use to access these values in powerpc.

	The PowerPC ABI's specify that the stack pointer is in r1.  The
PowerPC architecture does not have a program counter in user-accessible
register.  One can obtain the PC of the last call (branch and link) from
the link register.  One can branch and link to the next instruction to
obtain the current PC, but make sure that the old value in the LR is saved
and restored as required by the ABI.

David


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: program counter...
  2001-08-17 17:14 program counter Raghava Raju
@ 2001-08-20 17:46 ` Scott Anderson
  0 siblings, 0 replies; 4+ messages in thread
From: Scott Anderson @ 2001-08-20 17:46 UTC (permalink / raw)
  To: Raghava Raju; +Cc: linuxppc-embedded


Raghava Raju wrote:
>      I was unable to find the registers for
>   program counter,stack pointer. Which registers
>   I should use to access these values in powerpc.

Er, there isn't really an program counter register that you can read.
The only way I know to find it out the value of the internal "Next
Instruction Address" is to do a bl and then look at the LR (link
register) before doing a blr.

As far as the stack pointer goes, the PowerPC ABI (Application Binary
Interface) states that gpr1 should be used as the stack pointer and
therefor, it is...

    Scott Anderson
    scott_anderson@mvista.com   MontaVista Software Inc.
    (408)328-9214               1237 East Arques Ave.
    http://www.mvista.com       Sunnyvale, CA  94085

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2001-08-20 17:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-17 17:14 program counter Raghava Raju
2001-08-20 17:46 ` Scott Anderson
  -- strict thread matches above, loose matches on Subject: below --
2001-08-17 17:13 Raghava Raju
2001-08-17 17:24 ` David Edelsohn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).