Move MonoContext to mono-context for mips
[mono.git] / mono / mini / mini-arm.h
index cd9e5057f07d98cefa1584366397788528448f93..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 */
 
@@ -102,8 +105,6 @@ struct MonoLMF {
        /* This is only set in trampoline LMF frames */
        MonoMethod *method;
        gulong     esp;
-       /* Unused */
-       gulong     ebp;
        gulong     eip;
        /* all but sp and pc: matches the PUSH instruction layout in the trampolines
         * 0-4 should be considered undefined (execpt in the magic tramp)
@@ -112,21 +113,9 @@ 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;
        gpointer cinfo;
 } MonoCompileArch;
 
@@ -146,7 +135,6 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_USE_SIGACTION 1
 #define MONO_ARCH_NEED_DIV_CHECK 1
 
-#define MONO_ARCH_HAVE_THROW_CORLIB_EXCEPTION 1
 #define MONO_ARCH_HAVE_CREATE_DELEGATE_TRAMPOLINE
 #define MONO_ARCH_HAVE_XP_UNWIND 1
 #define MONO_ARCH_HAVE_GENERALIZED_IMT_THUNK 1
@@ -168,23 +156,19 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_DYN_CALL_PARAM_AREA 24
 
 #define MONO_ARCH_SOFT_DEBUG_SUPPORTED 1
-#define MONO_ARCH_HAVE_FIND_JIT_INFO_EXT 1
 #define MONO_ARCH_HAVE_EXCEPTIONS_INIT 1
+#define MONO_ARCH_HAVE_GET_TRAMPOLINES 1
+
+/* Matches the HAVE_AEABI_READ_TP define in mini-arm.c */
+#if defined(__ARM_EABI__) && defined(__linux__) && !defined(PLATFORM_ANDROID)
+#define MONO_ARCH_HAVE_TLS_GET 1
+#endif
 
 /* ARM doesn't have too many registers, so we have to use a callee saved one */
 #define MONO_ARCH_RGCTX_REG ARMREG_V5
 /* 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 {     \
@@ -193,14 +177,7 @@ typedef struct MonoCompileArch {
                MONO_CONTEXT_SET_IP ((ctx), (func));    \
        } while (0)
 
-/*
- * This structure is an extension of MonoLMF and contains extra information.
- */
-typedef struct {
-       struct MonoLMF lmf;
-       gboolean debugger_invoke;
-       MonoContext ctx; /* if debugger_invoke is TRUE */
-} MonoLMFExt;
+#define MONO_ARCH_INIT_TOP_LMF_ENTRY(lmf)
 
 void
 mono_arm_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, gulong *int_regs, gdouble *fp_regs);
@@ -208,8 +185,17 @@ mono_arm_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp,
 void
 mono_arm_throw_exception_by_token (guint32 type_token, unsigned long eip, unsigned long esp, gulong *int_regs, gdouble *fp_regs);
 
+void
+mono_arm_resume_unwind (guint32 dummy1, unsigned long eip, unsigned long esp, gulong *int_regs, gdouble *fp_regs);
+
 gboolean
 mono_arm_thumb_supported (void);
 
+GSList*
+mono_arm_get_exception_trampolines (gboolean aot) MONO_INTERNAL;
+
+guint8*
+mono_arm_get_thumb_plt_entry (guint8 *code) MONO_INTERNAL;
+
 #endif /* __MONO_MINI_ARM_H__ */