Re: Reading power PC MPC 8260 program counter (Next Instruction address)
- From: Lew Pitcher <lpitcher@xxxxxxxxxxxx>
- Date: Tue, 08 Feb 2011 14:03:02 -0500
On February 8, 2011 13:16, in comp.os.linux.embedded, rajesha@xxxxxxxxxxxxx
wrote:
Hello,
Please can somebody let me know how to read power PC 8260 program counter
using C program (Using asm directive).
That seems to me to be a "fools errand". By the time you've read the program
counter, the program counter has changed. Each instruction executed changes
the program counter, and in a multi-processing architecture like Linux,
each context switch changes the program counter as well. By the time your
code has retrieved the counter, the counter has changed.
Anyway, it's a trivial thing to get the PC (or reasonable facsimile) in C
code:
void dummy(void)
{
void (*pc)() = &dummy; /* got the PC on entry to the function */
/*
...
*/
}
--
Lew Pitcher
Master Codewright & JOAT-in-training | Registered Linux User #112576
Me: http://pitcher.digitalfreehold.ca/ | Just Linux: http://justlinux.ca/
---------- Slackware - Because I know what I'm doing. ------
.
- Follow-Ups:
- Re: Reading power PC MPC 8260 program counter (Next Instruction address)
- From: Tauno Voipio
- Re: Reading power PC MPC 8260 program counter (Next Instruction address)
- From: David Brown
- Re: Reading power PC MPC 8260 program counter (Next Instruction address)
- Prev by Date: hai guys
- Next by Date: Re: Reading power PC MPC 8260 program counter (Next Instruction address)
- Previous by thread: hai guys
- Next by thread: Re: Reading power PC MPC 8260 program counter (Next Instruction address)
- Index(es):
Relevant Pages
|