This implements functions related to signal bh on x86-64.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munte...@linux360.ro>
---
 arch/x86/signal-bh.S |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/arch/x86/signal-bh.S b/arch/x86/signal-bh.S
index c63f853..beb1f65 100644
--- a/arch/x86/signal-bh.S
+++ b/arch/x86/signal-bh.S
@@ -3,6 +3,8 @@
 .global signal_bh_trampoline
 .text
 
+#ifdef CONFIG_X86_32
+
 /*
  * signal_bh_trampoline - saves the caller saved registers and calls
  *                        signal bottom half hanlder.
@@ -46,3 +48,56 @@ signal_bh_trampoline:
         */
        addl $0x04, %esp
        ret
+
+#else /* CONFIG_X86_32 */
+
+/*
+ * signal_bh_trampoline - saves the caller saved registers and calls
+ *                        signal bottom half hanlder.
+ */
+signal_bh_trampoline:
+       push %rbp
+       movq %rsp, %rbp
+
+       /* save caller saved registers */
+       push %rax
+       push %rdi
+       push %rsi
+       push %rdx
+       push %rcx
+       push %r8
+       push %r9
+
+       /* push signal bottom half handler's argument - address of
+          faulting instruction. */
+       movq 0x08(%rbp), %rdi
+
+       /* call the signal bottom half handler */
+       push $.bh_return
+       push 0x10(%rbp)
+       ret
+
+.bh_return:
+       /* overwrite return address */
+       movq %rax, 0x10(%rbp)
+
+       /* restore caller saved registers */
+       pop %r9
+       pop %r8
+       pop %rcx
+       pop %rdx
+       pop %rsi
+       pop %rdi
+       pop %rax
+
+       pop %rbp
+
+       /*
+        * Cleanup bottom half handler address pushed by signal_install_bh().
+        * We do this by popping the return address from stack into
+        * the call argument.
+        */
+       addq $0x08, %rsp
+       ret
+
+#endif /* CONFIG_X86_32 */
-- 
1.6.0.6


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to