how to access PC

Paul Mackerras paulus at
Tue Sep 9 17:07:34 EST 2003

Mohammed Tajuddin writes:

> Has anyone tried accessing the program counter on linux powerpc64?  I
> notice struct pt_regs defined in ptrace.h, does not contain any place
> holder for program counter which is defined on mac-osx for example.

You want the nip field.  NIP stands for Next Instruction Pointer.

> Basically I was trying to access PC, PS from within a program.
> Appreciate your feedback.

And for "PS" you want the msr field, i.e. the Machine State Register.


** Sent via the linuxppc64-dev mail list. See

More information about the Linuxppc64-dev mailing list