This provides the necessary code for x86-64 and unifies it with 32-bit code.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munte...@linux360.ro>
---
 arch/x86/Makefile_32                  |    2 +-
 arch/x86/Makefile_64                  |    1 +
 arch/x86/{signal_32.S => signal-bh.S} |   46 +++++++++++++++++++++-----------
 3 files changed, 32 insertions(+), 17 deletions(-)
 rename arch/x86/{signal_32.S => signal-bh.S} (57%)

diff --git a/arch/x86/Makefile_32 b/arch/x86/Makefile_32
index 7242102..b55f4a6 100644
--- a/arch/x86/Makefile_32
+++ b/arch/x86/Makefile_32
@@ -10,6 +10,6 @@ ARCH_OBJS = \
        arch/x86/signal.o               \
        arch/x86/stack-frame.o          \
        arch/x86/unwind_32.o            \
-       arch/x86/signal_32.o            \
+       arch/x86/signal-bh.o            \
        arch/x86/use-def.o              \
        arch/x86/thread.o
diff --git a/arch/x86/Makefile_64 b/arch/x86/Makefile_64
index b354551..c12328a 100644
--- a/arch/x86/Makefile_64
+++ b/arch/x86/Makefile_64
@@ -11,6 +11,7 @@ ARCH_OBJS = \
        arch/x86/lir-printer.o          \
        arch/x86/registers_64.o         \
        arch/x86/signal.o               \
+       arch/x86/signal-bh.o            \
        arch/x86/stack-frame.o          \
        arch/x86/use-def.o              \
        arch/x86/unwind_64.o
diff --git a/arch/x86/signal_32.S b/arch/x86/signal-bh.S
similarity index 57%
rename from arch/x86/signal_32.S
rename to arch/x86/signal-bh.S
index af2d044..8d680f0 100644
--- a/arch/x86/signal_32.S
+++ b/arch/x86/signal-bh.S
@@ -1,3 +1,5 @@
+#include <arch/asm.h>
+
 .global signal_bh_trampoline
 .text
 
@@ -6,37 +8,49 @@
  *                        signal bottom half hanlder.
  */
 signal_bh_trampoline:
-       push %ebp
-       mov %esp, %ebp
+       push %xbp
+       mov %xsp, %xbp
 
        /* save caller saved registers */
-       pushl %eax
-       pushl %ecx
-       pushl %edx
+       push %xax
+       push %xcx
+       push %xdx
+#ifdef CONFIG_X86_64
+       pushq %r8
+       pushq %r9
+       pushq %r10
+       pushq %r11
+#endif
 
        /* push signal bottom half handler's argument - address of
           faulting instruction. */
-       pushl 8(%ebp)
+       push (2 * PTR_SIZE)(%xbp)
 
        /* call the signal bottom half handler */
-       pushl $.bh_return
-       pushl 4(%ebp)
+       push $.bh_return
+       push PTR_SIZE(%xbp)
        ret
 
 .bh_return:
        /* cleanup call arguments */
-       addl $4,%esp
+       add $PTR_SIZE, %xsp
 
        /* overwrite return address */
-       movl %eax, 8(%ebp)
+       mov %xax, (2 * PTR_SIZE)(%xbp)
 
        /* restore caller saved registers */
-       popl %edx
-       popl %ecx
-       popl %eax
-
-       popl %ebp
+#ifdef CONFIG_X86_64
+       popq %r11
+       popq %r10
+       popq %r9
+       popq %r8
+#endif
+       pop %xdx
+       pop %xcx
+       pop %xax
+
+       pop %xbp
 
        /* Skip bottom half hanlder address pushed by signal_install_bh() */
-       addl $4,%esp
+       add $PTR_SIZE, %xsp
        ret
-- 
1.6.0.6


------------------------------------------------------------------------------
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to