From: Leslie P. P. <sk...@vi...> - 2009-07-06 16:19:41
|
I'm writing a function to interrupt a thread and take a look at the current state of its registers. I will use VOPs to store the register values into a known memory location. This in itself works fine. The problem is that a full call as in (interrupt-thread thread #'save-regs) clobbers at least part of the registers (e.g. function in EAX on x86). I've considered using a signal handler instead of INTERRUPT-THREAD but I'm unsure whether that will do the job since a handler installed with ENABLE-INTERRUPT will be run in an APPLY inside an FLET. Before I spent more time digging: is there a smart way to have a direct jump to the function entry point preventing any reg modifications? Alternatively, can I instruct the compiler to push the old state of the registers onto the stack? Leslie -- http://www.linkedin.com/in/polzer |
From: Gábor M. <me...@re...> - 2009-07-06 16:41:23
|
On Lunes 06 Julio 2009, Leslie P. Polzer wrote: > I'm writing a function to interrupt a thread and take a > look at the current state of its registers. > > I will use VOPs to store the register values into a known > memory location. This in itself works fine. > > The problem is that a full call as in > > (interrupt-thread thread #'save-regs) > > clobbers at least part of the registers (e.g. function > in EAX on x86). > > I've considered using a signal handler instead of > INTERRUPT-THREAD but I'm unsure whether that will > do the job since a handler installed with > ENABLE-INTERRUPT will be run in an APPLY inside an > FLET. > > Before I spent more time digging: is there a smart way > to have a direct jump to the function entry point > preventing any reg modifications? > > Alternatively, can I instruct the compiler to push the > old state of the registers onto the stack? > > Leslie Even a C signal handler will have some registers clobbered. The interrupt context is already stored, see interrupt_contexts in src/runtime/genesis/thread.h. It's of type os_context and is platform specific. Cheers, Gabor |