Move MonoContext defines to mono-context.h on arm.
authorZoltan Varga <vargaz@gmail.com>
Sat, 5 Mar 2011 21:36:05 +0000 (22:36 +0100)
committerZoltan Varga <vargaz@gmail.com>
Sat, 5 Mar 2011 21:36:05 +0000 (22:36 +0100)
mono/mini/mini-arm.h
mono/utils/mono-context.h

index 5758710aec883325162c250bc2ff0623ae67f1bd..73f6b0515ebf0e379bf678ae4ff5ab255a27828b 100644 (file)
@@ -2,6 +2,7 @@
 #define __MONO_MINI_ARM_H__
 
 #include <mono/arch/arm/arm-codegen.h>
+#include <mono/utils/mono-context.h>
 #include <glib.h>
 
 #if defined(ARM_FPU_NONE) || (defined(__ARM_EABI__) && !defined(ARM_FPU_VFP))
@@ -112,19 +113,6 @@ struct MonoLMF {
        gulong     iregs [14];
 };
 
-/* we define our own structure and we'll copy the data
- * from sigcontext/ucontext/mach when we need it.
- * This also makes us save stack space and time when copying
- * We might also want to add an additional field to propagate
- * the original context from the signal handler.
- */
-typedef struct {
-       gulong eip;          // pc 
-       gulong esp;          // sp
-       gulong regs [16];
-       double fregs [MONO_SAVED_FREGS];
-} MonoContext;
-
 typedef struct MonoCompileArch {
        gpointer seq_point_info_var, ss_trigger_page_var;
        gboolean omit_fp, omit_fp_computed;
@@ -181,15 +169,6 @@ typedef struct MonoCompileArch {
 /* First argument reg */
 #define MONO_ARCH_VTABLE_REG ARMREG_R0
 
-/* we have the stack pointer, not the base pointer in sigcontext */
-#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->eip = (int)ip; } while (0); 
-#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->regs [ARMREG_FP] = (int)bp; } while (0); 
-#define MONO_CONTEXT_SET_SP(ctx,bp) do { (ctx)->esp = (int)bp; } while (0); 
-
-#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->eip))
-#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->regs [ARMREG_FP]))
-#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->esp))
-
 #define MONO_CONTEXT_SET_LLVM_EXC_REG(ctx, exc) do { (ctx)->regs [0] = (gsize)exc; } while (0)
 
 #define MONO_INIT_CONTEXT_FROM_FUNC(ctx,func) do {     \
index bbd5c3db2615a6d987065e935d0311fd6d912156..71874a663e013c442f9326d2176d57af4103e2eb 100644 (file)
@@ -183,6 +183,24 @@ typedef struct {
                : "a" (&(ctx))  \
                : "rdx", "memory")
 
+#elif defined(__arm__) /* defined(__x86_64__) */
+
+typedef struct {
+       gulong eip;          // pc 
+       gulong esp;          // sp
+       gulong regs [16];
+       double fregs [8];
+} MonoContext;
+
+/* we have the stack pointer, not the base pointer in sigcontext */
+#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->eip = (int)ip; } while (0); 
+#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->regs [ARMREG_FP] = (int)bp; } while (0); 
+#define MONO_CONTEXT_SET_SP(ctx,bp) do { (ctx)->esp = (int)bp; } while (0); 
+
+#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->eip))
+#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->regs [ARMREG_FP]))
+#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->esp))
+
 #else  
 
 #error "Implement mono-context for the current arch"