Signed-off-by: Tomek Grabiec <[email protected]>
---
arch/x86/signal-bh.S | 10 +++++++---
arch/x86/signal.c | 8 ++++----
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/arch/x86/signal-bh.S b/arch/x86/signal-bh.S
index 8d680f0..0eb6230 100644
--- a/arch/x86/signal-bh.S
+++ b/arch/x86/signal-bh.S
@@ -24,11 +24,11 @@ signal_bh_trampoline:
/* push signal bottom half handler's argument - address of
faulting instruction. */
- push (2 * PTR_SIZE)(%xbp)
+ push (PTR_SIZE)(%xbp)
/* call the signal bottom half handler */
push $.bh_return
- push PTR_SIZE(%xbp)
+ push (2 * PTR_SIZE)(%xbp)
ret
.bh_return:
@@ -51,6 +51,10 @@ signal_bh_trampoline:
pop %xbp
- /* Skip bottom half hanlder address pushed by signal_install_bh() */
+ /*
+ * Cleanup bottom half handler address pushed by signal_install_bh().
+ * We do this by popping the return address from stack into
+ * the call argument.
+ */
add $PTR_SIZE, %xsp
ret
diff --git a/arch/x86/signal.c b/arch/x86/signal.c
index 335547d..93b00f5 100644
--- a/arch/x86/signal.c
+++ b/arch/x86/signal.c
@@ -69,13 +69,13 @@ int install_signal_bh(void *ctx, signal_bh_fn bh)
stack = (unsigned long*)uc->uc_mcontext.gregs[REG_SP];
- /* push return address on stack */
+ /* push bottom-half handler address on stack */
stack--;
- *stack = uc->uc_mcontext.gregs[REG_IP];
+ *stack = (unsigned long)bh;
- /* push bottom-half handler address on stack */
+ /* push return address on stack */
stack--;
- *stack = (unsigned long) bh;
+ *stack = uc->uc_mcontext.gregs[REG_IP];
uc->uc_mcontext.gregs[REG_SP] -= 2 * sizeof(unsigned long);
--
1.6.0.6
------------------------------------------------------------------------------
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel