Re: How do I get the program counter of another process (PowerPC)?



Oh dear, replying to my own messages again... Well, this might be
useful to someone else.

I solved the problem by using an interrupt service routine instead of
a system state alarm. I attach my ISR to the clock ticker IRQ vector
at a higher priority than the clock ticker, and then return from it
EOS_NOTME so that the clock ticker (tkdec) is called immediately after
my ISR.

#define VECTOR T_DEC
#define PRIORITY 8

err = _os_irq(VECTOR, PRIORITY, myIsr, data);

Thus myIsr() is called on every clock tick. On entry to myIsr(), the
special register SRR0 contains the program counter to which the ISR
will return - i.e. the program counter of the next instruction at the
point of the interruption, and SRR1 contains the machine status
register (MSR). Bit MSR_PR is clear if the processor is in system
state and set if in user state. (Yes, it really is that way round.)
The functions _get_srr0() and _get_srr1() are useful here.

The essential header files to look at are regs.h, regsppc.h, and
getset.h.

That's basically it.
.



Relevant Pages

  • Re: microcontroller AT89S52 programing advice
    ... A loop in an interrupt service routine? ... He's using the loop to refresh the LEDs and provide a delay, ... That code should not be in the ISR. ...
    (comp.arch.embedded)
  • Re: NMI isr
    ... If you can tell us why you're trying to write an *interrupt service routine* ... for a *non-maskable interrupt* (NMI) on Linux then maybe we can help. ... > Can someone show me how to setup NMI ISR under Linux for x86 arch? ...
    (alt.os.linux)
  • Which functions can I call from an ISR(Interrupt Service Routine)
    ... functions that can be called from an interrupt service routine, ISR. ... Standard functions like printf and so on cannot be used because blocking can ...
    (microsoft.public.windowsce.platbuilder)