* src/vm/jit/i386/linux/md-os.c: Simplified signal handlers.
[cacao.git] / src / vm / jit / i386 / md-trap.h
index 52e6a0067ce0d74777e664f73cfc85da4c757e65..6cf2bbf20b99acfa7da6d9c3c28d72758f7d93e3 100644 (file)
@@ -62,6 +62,25 @@ enum {
        TRAP_END
 };
 
+
+/**
+* Macro to fixup a compiler stub.
+* PV : The PV from the compiler stub is equal to the XPC.
+* RA : We use a framesize of zero here because the call pushed
+*      the return addres onto the stack.
+* SP : Skip the RA on the stack.
+* XPC: The XPC is the RA minus 2, because the RA points to the
+*      instruction after the call.
+*/
+#define MD_TRAP_COMPILER_FIXUP(xpc, ra, sp, pv) \
+       do { \
+               (pv)  = (xpc); \
+               (ra)  = md_stacktrace_get_returnaddress((sp), 0); \
+               (sp)  = (void*) (((uintptr_t) (sp)) + 1 * SIZEOF_VOID_P); \
+               (xpc) = (void*) (((uintptr_t) (ra)) - 2); \
+       } while(0)
+
+
 #endif /* _MD_TRAP_H */