From: Michael Starzinger Date: Tue, 16 Sep 2008 14:33:51 +0000 (+0200) Subject: * src/vm/jit/trap.c (trap_handle): Update executionstates PC register in case X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=dfe6fe289acfc74a39747521412ef300e384d52a;p=cacao.git * src/vm/jit/trap.c (trap_handle): Update executionstates PC register in case of successful patcher trap. * src/vm/jit/alpha/linux/md-os.c: Further simplified signal handler. --- diff --git a/src/vm/jit/alpha/linux/md-os.c b/src/vm/jit/alpha/linux/md-os.c index 8f9c58746..8e127a9fa 100644 --- a/src/vm/jit/alpha/linux/md-os.c +++ b/src/vm/jit/alpha/linux/md-os.c @@ -156,13 +156,7 @@ void md_signal_handler_sigill(int sig, siginfo_t *siginfo, void *_p) intptr_t val = 0; // Handle the trap. - void* p = trap_handle(type, val, pv, sp, ra, xpc, _p); - - // Set registers - if (p == NULL) { - // We need to set the PC because we adjusted it above. - _mc->sc_pc = (uintptr_t) xpc; - } + trap_handle(type, val, pv, sp, ra, xpc, _p); } diff --git a/src/vm/jit/trap.c b/src/vm/jit/trap.c index 0f9152b4f..1ac7ffe7e 100644 --- a/src/vm/jit/trap.c +++ b/src/vm/jit/trap.c @@ -246,7 +246,7 @@ void* trap_handle(int type, intptr_t val, void *pv, void *sp, void *ra, void *xp switch (type) { case TRAP_COMPILER: - // The default case for a compiler trap is to jump directly to + // The normal case for a compiler trap is to jump directly to // the newly compiled method. if (p != NULL) { @@ -270,9 +270,20 @@ void* trap_handle(int type, intptr_t val, void *pv, void *sp, void *ra, void *xp es.intregs[REG_ITMP1_XPTR] = (uintptr_t) LLNI_DIRECT(e); es.intregs[REG_ITMP2_XPC] = (uintptr_t) xpc; es.pc = (uint8_t *) (uintptr_t) asm_handle_exception; - break; + case TRAP_PATCHER: + // The normal case for a patcher trap is to continue execution at + // the trap instruction. On some archs the PC may point after the + // trap instruction, so we reset it here. + + if (p == NULL) { + es.pc = (uint8_t *) (uintptr_t) xpc; + break; + } + + /* fall-through */ + default: if (p != NULL) { es.intregs[REG_ITMP1_XPTR] = (uintptr_t) LLNI_DIRECT(p);