Created
February 10, 2018 17:30
-
-
Save NattyNarwhal/772afeaaa1b96954676e21c5dc84baf9 to your computer and use it in GitHub Desktop.
skeleton of POWER interpeter trampoline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/mono/mini/mini-ppc.h b/mono/mini/mini-ppc.h | |
index 167f6ed..ff29d54 100644 | |
--- a/mono/mini/mini-ppc.h | |
+++ b/mono/mini/mini-ppc.h | |
@@ -264,6 +264,8 @@ typedef struct MonoCompileArch { | |
#endif | |
#define MONO_ARCH_HAVE_OP_TAIL_CALL 1 | |
+#define MONO_ARCH_HAVE_INTERP_PINVOKE_TRAMP | |
+ | |
#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) | |
@@ -330,6 +332,18 @@ typedef struct { | |
int offset; | |
} MonoPPCArgInfo; | |
+typedef struct { | |
+ mgreg_t gregs [MONO_SAVED_GREGS]; | |
+ /* | |
+ * XXX: consistent with arm/amd64, but this might not work with AIX, so | |
+ * we'd need a 64-bit fp type that isn't sizeof 4 in structs for it | |
+ * (and I think we'd want the same for MonoLMF?) | |
+ */ | |
+ gdouble fregs [MONO_SAVED_FREGS]; | |
+ gsize stack_size; | |
+ gpointer stack; | |
+} CallContext; | |
+ | |
#ifdef PPC_USES_FUNCTION_DESCRIPTOR | |
typedef struct { | |
gpointer code; | |
diff --git a/mono/mini/tramp-ppc.c b/mono/mini/tramp-ppc.c | |
index 3376cc4..df622b5 100644 | |
--- a/mono/mini/tramp-ppc.c | |
+++ b/mono/mini/tramp-ppc.c | |
@@ -25,6 +25,10 @@ | |
#include "mini-ppc.h" | |
#include "mini-runtime.h" | |
+#ifndef DISABLE_INTERPRETER | |
+#include "interp/interp.h" | |
+#endif | |
+ | |
#if 0 | |
/* Same as mono_create_ftnptr, but doesn't require a domain */ | |
static gpointer | |
@@ -638,6 +642,26 @@ mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code) | |
gpointer | |
mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) | |
{ | |
+#ifndef DISABLE_INTERPRETER | |
+ guint8 *start = NULL, *code; | |
+ guint8 *label_start_copy, *label_exit_copy; | |
+ MonoJumpInfo *ji = NULL; | |
+ GSList *unwind_ops = NULL; | |
+ int buf_len, i, off_methodargs, off_targetaddr; | |
+ | |
+ buf_len = 512 + 1024; | |
+ start = code = (guint8 *) mono_global_codeman_reserve (buf_len); | |
+ | |
+ /* TODO: the rest of the owl */ | |
+ | |
+ mono_arch_flush_icache (start, code - start); | |
+ | |
+ if (info) | |
+ *info = mono_tramp_info_create ("interp_to_native_trampoline", start, code - start, ji, unwind_ops); | |
+ | |
+ return start; | |
+#else | |
g_assert_not_reached (); | |
return NULL; | |
+#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment