methodpool: also call native methods
[mate.git] / ffi / trap.c
index 2073dae2ec285afe4c1a89343654d1a189882a00..0e1c8735c9d9a640924177925ad1a153bd68dea5 100644 (file)
@@ -54,7 +54,7 @@ void mainresult(unsigned int a)
 void callertrap(int nSignal, siginfo_t *info, void *ctx)
 {
        struct ucontext *uctx = (struct ucontext *) ctx;
-       unsigned int from = (unsigned int) uctx->uc_mcontext.eip;
+       unsigned int from = (unsigned int) uctx->uc_mcontext.eip - 2;
        unsigned int patchme = getMethodEntry(from, method_map, caller_map);
 
        printf("callertrap(mctx)  by 0x%08x\n", from);
@@ -64,7 +64,7 @@ void callertrap(int nSignal, siginfo_t *info, void *ctx)
        *insn = 0xe8; // call opcode
        printf(" to_patch: 0x%08x\n", (unsigned int) to_patch);
        printf("*to_patch: 0x%08x\n", *to_patch);
-       if (*to_patch != 0x90ffffff) {
+       if (*to_patch != 0x90ffff90) {
                printf("something is wrong here. abort\n");
                exit(0);
        }