Code in arch/exception.c can be used in x86_64 as well.

Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 arch/x86/Makefile_32    |    2 +-
 arch/x86/exception.c    |   73 +++++++++++++++++++++++++++++++++++++++++++++++
 arch/x86/exception_32.c |   73 -----------------------------------------------
 test/arch-x86/Makefile  |    2 +-
 4 files changed, 75 insertions(+), 75 deletions(-)
 create mode 100644 arch/x86/exception.c
 delete mode 100644 arch/x86/exception_32.c

diff --git a/arch/x86/Makefile_32 b/arch/x86/Makefile_32
index 784e5f7..9889039 100644
--- a/arch/x86/Makefile_32
+++ b/arch/x86/Makefile_32
@@ -7,7 +7,7 @@ ARCH_OBJS = \
        arch/x86/registers_32.o         \
        arch/x86/stack-frame.o          \
        arch/x86/use-def.o              \
-       arch/x86/exception_32.o         \
+       arch/x86/exception.o            \
        arch/x86/unwind_32.o            \
        arch/x86/signal.o               \
        jamvm/os/$(OS)/i386/dll_md.o    \
diff --git a/arch/x86/exception.c b/arch/x86/exception.c
new file mode 100644
index 0000000..81174b5
--- /dev/null
+++ b/arch/x86/exception.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2009 Tomasz Grabiec
+ *
+ * This file is released under the GPL version 2 with the following
+ * clarification and special exception:
+ *
+ *     Linking this library statically or dynamically with other modules is
+ *     making a combined work based on this library. Thus, the terms and
+ *     conditions of the GNU General Public License cover the whole
+ *     combination.
+ *
+ *     As a special exception, the copyright holders of this library give you
+ *     permission to link this library with independent modules to produce an
+ *     executable, regardless of the license terms of these independent
+ *     modules, and to copy and distribute the resulting executable under terms
+ *     of your choice, provided that you also meet, for each linked independent
+ *     module, the terms and conditions of the license of that module. An
+ *     independent module is a module which is not derived from or based on
+ *     this library. If you modify this library, you may extend this exception
+ *     to your version of the library, but you are not obligated to do so. If
+ *     you do not wish to do so, delete this exception statement from your
+ *     version.
+ *
+ * Please refer to the file LICENSE for details.
+ */
+
+#include <jit/compilation-unit.h>
+#include <jit/basic-block.h>
+#include <jit/cu-mapping.h>
+#include <jit/exception.h>
+
+#include <arch/stack-frame.h>
+#include <arch/exception.h>
+#include <arch/memory.h>
+#include <arch/signal.h>
+
+unsigned char *
+throw_exception(struct compilation_unit *cu, struct object *exception)
+{
+       unsigned char *native_ptr;
+       struct jit_stack_frame *frame;
+
+       native_ptr = __builtin_return_address(0) - 1;
+       frame      = __builtin_frame_address(1);
+
+       return throw_exception_from(cu, frame, native_ptr, exception);
+}
+
+void throw_exception_from_signal(void *ctx, struct object *exception)
+{
+       struct jit_stack_frame *frame;
+       struct compilation_unit *cu;
+       unsigned long source_addr;
+       unsigned long *stack;
+       ucontext_t *uc;
+       void *eh;
+
+       uc = ctx;
+
+       source_addr = uc->uc_mcontext.gregs[REG_IP];
+       cu = get_cu_from_native_addr(source_addr);
+       frame = (struct jit_stack_frame*)uc->uc_mcontext.gregs[REG_BP];
+
+       eh = throw_exception_from(cu, frame, (unsigned char*)source_addr,
+                                 exception);
+
+       uc->uc_mcontext.gregs[REG_IP] = (unsigned long)eh;
+
+       /* push exception object reference on stack */
+       uc->uc_mcontext.gregs[REG_SP] -= sizeof(exception);
+       stack = (unsigned long*)uc->uc_mcontext.gregs[REG_SP];
+       *stack = (unsigned long)exception;
+}
diff --git a/arch/x86/exception_32.c b/arch/x86/exception_32.c
deleted file mode 100644
index 81174b5..0000000
--- a/arch/x86/exception_32.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2009 Tomasz Grabiec
- *
- * This file is released under the GPL version 2 with the following
- * clarification and special exception:
- *
- *     Linking this library statically or dynamically with other modules is
- *     making a combined work based on this library. Thus, the terms and
- *     conditions of the GNU General Public License cover the whole
- *     combination.
- *
- *     As a special exception, the copyright holders of this library give you
- *     permission to link this library with independent modules to produce an
- *     executable, regardless of the license terms of these independent
- *     modules, and to copy and distribute the resulting executable under terms
- *     of your choice, provided that you also meet, for each linked independent
- *     module, the terms and conditions of the license of that module. An
- *     independent module is a module which is not derived from or based on
- *     this library. If you modify this library, you may extend this exception
- *     to your version of the library, but you are not obligated to do so. If
- *     you do not wish to do so, delete this exception statement from your
- *     version.
- *
- * Please refer to the file LICENSE for details.
- */
-
-#include <jit/compilation-unit.h>
-#include <jit/basic-block.h>
-#include <jit/cu-mapping.h>
-#include <jit/exception.h>
-
-#include <arch/stack-frame.h>
-#include <arch/exception.h>
-#include <arch/memory.h>
-#include <arch/signal.h>
-
-unsigned char *
-throw_exception(struct compilation_unit *cu, struct object *exception)
-{
-       unsigned char *native_ptr;
-       struct jit_stack_frame *frame;
-
-       native_ptr = __builtin_return_address(0) - 1;
-       frame      = __builtin_frame_address(1);
-
-       return throw_exception_from(cu, frame, native_ptr, exception);
-}
-
-void throw_exception_from_signal(void *ctx, struct object *exception)
-{
-       struct jit_stack_frame *frame;
-       struct compilation_unit *cu;
-       unsigned long source_addr;
-       unsigned long *stack;
-       ucontext_t *uc;
-       void *eh;
-
-       uc = ctx;
-
-       source_addr = uc->uc_mcontext.gregs[REG_IP];
-       cu = get_cu_from_native_addr(source_addr);
-       frame = (struct jit_stack_frame*)uc->uc_mcontext.gregs[REG_BP];
-
-       eh = throw_exception_from(cu, frame, (unsigned char*)source_addr,
-                                 exception);
-
-       uc->uc_mcontext.gregs[REG_IP] = (unsigned long)eh;
-
-       /* push exception object reference on stack */
-       uc->uc_mcontext.gregs[REG_SP] -= sizeof(exception);
-       stack = (unsigned long*)uc->uc_mcontext.gregs[REG_SP];
-       *stack = (unsigned long)exception;
-}
diff --git a/test/arch-x86/Makefile b/test/arch-x86/Makefile
index b271f16..26e730c 100644
--- a/test/arch-x86/Makefile
+++ b/test/arch-x86/Makefile
@@ -55,7 +55,7 @@ OBJS = \
        ../../arch/x86/insn-selector$(ARCH_POSTFIX).o \
        ../../arch/x86/stack-frame.o \
        ../../arch/x86/use-def.o \
-       ../../arch/x86/exception$(ARCH_POSTFIX).o \
+       ../../arch/x86/exception.o \
        ../../arch/x86/unwind$(ARCH_POSTFIX).o \
        $(TESTS)
 
-- 
1.6.0.6


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to