I'm trying to see if I can hack together a sampling profiler, and to do that I tried using a Time Manager task that would execute every X milliseconds. The idea was that at interrupt time I would figure out the address of the instruction that execution will return to when the interrupt is finished, since according to Inside Macintosh its pushed on to the stack when an interrupt occurs.
The trouble is, I'm not sure how to do it! The stack doesn't seem to have any sort of predictable layout when a Time Manager task is firing at interrupt time. I figure this is because the OS is doing a bunch of work behind the scenes to allow a normal C or Pascal function to be called, and still restore everything back to how it was before the interrupt fired.
Is this actually possible? (Maybe it requires a much lower level interrupt handler written in assembly?)
The trouble is, I'm not sure how to do it! The stack doesn't seem to have any sort of predictable layout when a Time Manager task is firing at interrupt time. I figure this is because the OS is doing a bunch of work behind the scenes to allow a normal C or Pascal function to be called, and still restore everything back to how it was before the interrupt fired.
Is this actually possible? (Maybe it requires a much lower level interrupt handler written in assembly?)



