[arm] Fix native types support in the dyn call code on arm.
[mono.git] / mono / mini / mini-ppc.h
index acb62051864f0f110091d8a5cba70b452243e758..dcc1c5fae282ceb718968eb76979057494613a5a 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <mono/arch/ppc/ppc-codegen.h>
 #include <mono/utils/mono-sigcontext.h>
+#include <mono/utils/mono-context.h>
 #include <glib.h>
 
 #ifdef __mono_ppc64__
@@ -27,6 +28,10 @@ void ppc_patch (guchar *code, const guchar *target);
 void ppc_patch_full (guchar *code, const guchar *target, gboolean is_fd);
 
 struct MonoLMF {
+       /*
+        * If the second lowest bit is set to 1, then this is a MonoLMFExt structure, and
+        * the other fields are not valid.
+        */
        gpointer    previous_lmf;
        gpointer    lmf_addr;
        MonoMethod *method;
@@ -38,18 +43,6 @@ struct MonoLMF {
        gdouble    fregs [MONO_SAVED_FREGS]; /* 14..31 */
 };
 
-/* 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 sc_ir;          // pc 
-       gulong sc_sp;          // r1
-       mgreg_t regs [MONO_SAVED_GREGS];
-       double fregs [MONO_SAVED_FREGS];
-} MonoContext;
 
 typedef struct MonoCompileArch {
        int fp_conv_var_offset;
@@ -75,7 +68,6 @@ typedef struct MonoCompileArch {
 #ifdef __mono_ppc64__
 #define MONO_ARCH_NO_EMULATE_LONG_SHIFT_OPS
 #define MONO_ARCH_NO_EMULATE_LONG_MUL_OPTS
-#define MONO_ARCH_HAVE_ATOMIC_ADD 1
 #define PPC_USES_FUNCTION_DESCRIPTOR
 
 #ifndef __mono_ilp32__
@@ -102,7 +94,6 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_EMULATE_LCONV_TO_R8_UN 1
 #define MONO_ARCH_EMULATE_FREM 1
 #define MONO_ARCH_BIGMUL_INTRINS 1
-#define MONO_ARCH_HAVE_ATOMIC_CAS 1
 
 /* Parameters used by the register allocator */
 #define MONO_ARCH_CALLEE_REGS ((0xff << ppc_r3) | (1 << ppc_r11) | (1 << ppc_r12))
@@ -178,42 +169,34 @@ typedef struct MonoCompileArch {
 #endif /* HAVE_WORKING_SIGALTSTACK */
 
 #define MONO_ARCH_HAVE_CREATE_DELEGATE_TRAMPOLINE
-#define MONO_ARCH_HAVE_IMT 1
 #define MONO_ARCH_IMT_REG ppc_r12
 
 #define MONO_ARCH_VTABLE_REG   ppc_r12
-#define MONO_ARCH_RGCTX_REG    ppc_r12
+#define MONO_ARCH_RGCTX_REG    MONO_ARCH_IMT_REG
 
 #define MONO_ARCH_NO_IOV_CHECK 1
 #define MONO_ARCH_HAVE_DECOMPOSE_OPTS 1
 #define MONO_ARCH_HAVE_DECOMPOSE_LONG_OPTS 1
 
 #define MONO_ARCH_HAVE_GENERALIZED_IMT_THUNK 1
-#define MONO_ARCH_HAVE_THROW_CORLIB_EXCEPTION 1
 
-#define MONO_ARCH_HAVE_STATIC_RGCTX_TRAMPOLINE 1
 #define MONO_ARCH_HAVE_FULL_AOT_TRAMPOLINES 1
 #define MONO_ARCH_HAVE_XP_UNWIND 1
-#define MONO_ARCH_HAVE_FIND_JIT_INFO_EXT 1
 
 #define MONO_ARCH_GSHARED_SUPPORTED 1
 
 #define MONO_ARCH_NEED_DIV_CHECK 1
 #define MONO_ARCH_AOT_SUPPORTED 1
 #define MONO_ARCH_NEED_GOT_VAR 1
+#if !defined(MONO_CROSS_COMPILE) && !defined(TARGET_PS3)
+#define MONO_ARCH_SOFT_DEBUG_SUPPORTED 1
+#endif
+#define MONO_ARCH_THIS_AS_FIRST_ARG 1
+#define MONO_ARCH_HAVE_OP_TAIL_CALL 1
 
 #define PPC_NUM_REG_ARGS (PPC_LAST_ARG_REG-PPC_FIRST_ARG_REG+1)
 #define PPC_NUM_REG_FPARGS (PPC_LAST_FPARG_REG-PPC_FIRST_FPARG_REG+1)
 
-/* we have the stack pointer, not the base pointer in sigcontext */
-#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->sc_ir = (gulong)ip; } while (0);
-/* FIXME: should be called SET_SP */
-#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->sc_sp = (gulong)bp; } while (0);
-
-#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->sc_ir))
-#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->regs [ppc_r31-13]))
-#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->sc_sp))
-
 #ifdef MONO_CROSS_COMPILE
 
 typedef struct {
@@ -268,6 +251,8 @@ typedef struct {
 #endif
 #endif
 
+#define MONO_ARCH_INIT_TOP_LMF_ENTRY(lmf) do { (lmf)->ebp = -1; } while (0)
+
 typedef struct {
        gint8 reg;
        gint8 size;
@@ -299,11 +284,24 @@ extern guint8* mono_ppc_create_pre_code_ftnptr (guint8 *code) MONO_INTERNAL;
 #define MONO_ARCH_USE_SIGACTION 1
 #elif defined(__FreeBSD__)
 #define MONO_ARCH_USE_SIGACTION 1
+#elif defined(MONO_CROSS_COMPILE)
+       typedef MonoContext ucontext_t;
+/*     typedef struct {
+               int dummy;
+       } ucontext_t;*/
+       #define UCONTEXT_REG_Rn(ctx, n)
+       #define UCONTEXT_REG_FPRn(ctx, n)
+       #define UCONTEXT_REG_NIP(ctx)
+       #define UCONTEXT_REG_LNK(ctx)
+
 #else
 /* For other operating systems, we pull the definition from an external file */
 #include "mini-ppc-os.h"
 #endif
 
+gboolean
+mono_ppc_tail_call_supported (MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig) MONO_INTERNAL;
+
 void
 mono_ppc_patch (guchar *code, const guchar *target) MONO_INTERNAL;
 
@@ -312,7 +310,7 @@ mono_ppc_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp,
 
 #ifdef __mono_ppc64__
 #define MONO_PPC_32_64_CASE(c32,c64)   c64
-extern void mono_ppc_emitted (guint8 *code, ssize_t length, const char *format, ...);
+extern void mono_ppc_emitted (guint8 *code, gint64 length, const char *format, ...);
 #else
 #define MONO_PPC_32_64_CASE(c32,c64)   c32
 #endif
@@ -321,4 +319,6 @@ gboolean mono_ppc_is_direct_call_sequence (guint32 *code) MONO_INTERNAL;
 
 void mono_ppc_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) MONO_INTERNAL;
 
+void mono_ppc_set_func_into_sigctx (void *sigctx, void *func) MONO_INTERNAL;
+
 #endif /* __MONO_MINI_PPC_H__ */