Move MonoContext to mono-context for mips
[mono.git] / mono / mini / mini-arm.h
index 09ce01b41897ed7f66805bdf684d3f82b8fe4df7..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))
 #define MONO_MAX_IREGS 16
 #define MONO_MAX_FREGS 16
 
-#define MONO_SAVED_GREGS 10 /* r4-411, ip, lr */
+#define MONO_SAVED_GREGS 10 /* r4-r11, ip, lr */
 #define MONO_SAVED_FREGS 8
 
 /* r4-r11, ip, lr: registers saved in the LMF  */
 #define MONO_ARM_REGSAVE_MASK 0x5ff0
+#define MONO_ARM_FIRST_SAVED_REG ARMREG_R4
+#define MONO_ARM_NUM_SAVED_REGS 10
 
 /* Parameters used by the register allocator */
 
@@ -110,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;
@@ -179,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 {     \