Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Varga <vargaz@gmail.com>2015-06-09 21:59:25 +0300
committerZoltan Varga <vargaz@gmail.com>2015-06-12 01:04:49 +0300
commitc99aa0cf437b5f5f5a3a0e811dbdcbc52675ac4f (patch)
tree7970d2d149bcf2b5f038588b7a15a8bc225e499c
parent198235db76306c3fe373a1294b88d19e8ca59b8f (diff)
[arm] Fix crashes on ios9 by using 16kb trampoline pages.mono-4.0.2.5
-rw-r--r--mono/mini/aot-compiler.c15
-rw-r--r--mono/mini/aot-runtime.c13
-rwxr-xr-xmono/mini/mini.h2
3 files changed, 16 insertions, 14 deletions
diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c
index 746324b102b..3a7fd76d7bf 100644
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -1167,24 +1167,25 @@ arch_emit_specific_trampoline_pages (MonoAotCompile *acfg)
guint8 *code;
guint8 *loop_start, *loop_branch_back, *loop_end_check, *imt_found_check;
int i;
+ int pagesize = MONO_AOT_TRAMP_PAGE_SIZE;
#define COMMON_TRAMP_SIZE 16
- int count = (mono_pagesize () - COMMON_TRAMP_SIZE) / 8;
+ int count = (pagesize - COMMON_TRAMP_SIZE) / 8;
int imm8, rot_amount;
char symbol [128];
if (!acfg->aot_opts.use_trampolines_page)
return;
- acfg->tramp_page_size = mono_pagesize ();
+ acfg->tramp_page_size = pagesize;
sprintf (symbol, "%sspecific_trampolines_page", acfg->user_symbol_prefix);
- emit_alignment (acfg, mono_pagesize ());
+ emit_alignment (acfg, pagesize);
emit_global (acfg, symbol, TRUE);
emit_label (acfg, symbol);
/* emit the generic code first, the trampoline address + 8 is in the lr register */
code = buf;
- imm8 = mono_arm_is_rotated_imm8 (mono_pagesize (), &rot_amount);
+ imm8 = mono_arm_is_rotated_imm8 (pagesize, &rot_amount);
ARM_SUB_REG_IMM (code, ARMREG_LR, ARMREG_LR, imm8, rot_amount);
ARM_LDR_IMM (code, ARMREG_R1, ARMREG_LR, -8);
ARM_LDR_IMM (code, ARMREG_PC, ARMREG_LR, -4);
@@ -1212,7 +1213,7 @@ arch_emit_specific_trampoline_pages (MonoAotCompile *acfg)
emit_global (acfg, symbol, TRUE);
emit_label (acfg, symbol);
code = buf;
- imm8 = mono_arm_is_rotated_imm8 (mono_pagesize (), &rot_amount);
+ imm8 = mono_arm_is_rotated_imm8 (pagesize, &rot_amount);
ARM_SUB_REG_IMM (code, ARMREG_IP, ARMREG_IP, imm8, rot_amount);
ARM_LDR_IMM (code, MONO_ARCH_RGCTX_REG, ARMREG_IP, -8);
ARM_LDR_IMM (code, ARMREG_PC, ARMREG_IP, -4);
@@ -1239,7 +1240,7 @@ arch_emit_specific_trampoline_pages (MonoAotCompile *acfg)
emit_label (acfg, symbol);
code = buf;
ARM_PUSH (code, (1 << ARMREG_R0) | (1 << ARMREG_R1) | (1 << ARMREG_R2) | (1 << ARMREG_R3));
- imm8 = mono_arm_is_rotated_imm8 (mono_pagesize (), &rot_amount);
+ imm8 = mono_arm_is_rotated_imm8 (pagesize, &rot_amount);
ARM_SUB_REG_IMM (code, ARMREG_IP, ARMREG_IP, imm8, rot_amount);
ARM_LDR_IMM (code, ARMREG_R0, ARMREG_IP, -8);
ARM_LDR_IMM (code, ARMREG_PC, ARMREG_IP, -4);
@@ -1269,7 +1270,7 @@ arch_emit_specific_trampoline_pages (MonoAotCompile *acfg)
/* Need at least two free registers, plus a slot for storing the pc */
ARM_PUSH (code, (1 << ARMREG_R0)|(1 << ARMREG_R1)|(1 << ARMREG_R2));
- imm8 = mono_arm_is_rotated_imm8 (mono_pagesize (), &rot_amount);
+ imm8 = mono_arm_is_rotated_imm8 (pagesize, &rot_amount);
ARM_SUB_REG_IMM (code, ARMREG_IP, ARMREG_IP, imm8, rot_amount);
ARM_LDR_IMM (code, ARMREG_R0, ARMREG_IP, -8);
diff --git a/mono/mini/aot-runtime.c b/mono/mini/aot-runtime.c
index 6c2ad4fe626..4f6e190e787 100644
--- a/mono/mini/aot-runtime.c
+++ b/mono/mini/aot-runtime.c
@@ -4596,16 +4596,15 @@ get_new_trampoline_from_page (int tramp_type)
return code;
}
mono_aot_page_unlock ();
- psize = mono_pagesize ();
/* the trampoline template page is in the mscorlib module */
image = mono_defaults.corlib;
g_assert (image);
+ psize = MONO_AOT_TRAMP_PAGE_SIZE;
+
amodule = image->aot_module;
g_assert (amodule);
- g_assert (amodule->info.tramp_page_size == psize);
-
if (tramp_type == MONO_AOT_TRAMP_SPECIFIC)
tpage = load_function (amodule, "specific_trampolines_page");
else if (tramp_type == MONO_AOT_TRAMP_STATIC_RGCTX)
@@ -4687,7 +4686,7 @@ get_new_specific_trampoline_from_page (gpointer tramp, gpointer arg)
code = get_new_trampoline_from_page (MONO_AOT_TRAMP_SPECIFIC);
- data = (gpointer*)((char*)code - mono_pagesize ());
+ data = (gpointer*)((char*)code - MONO_AOT_TRAMP_PAGE_SIZE);
data [0] = arg;
data [1] = tramp;
/*g_warning ("new trampoline at %p for data %p, tramp %p (stored at %p)", code, arg, tramp, data);*/
@@ -4703,7 +4702,7 @@ get_new_rgctx_trampoline_from_page (gpointer tramp, gpointer arg)
code = get_new_trampoline_from_page (MONO_AOT_TRAMP_STATIC_RGCTX);
- data = (gpointer*)((char*)code - mono_pagesize ());
+ data = (gpointer*)((char*)code - MONO_AOT_TRAMP_PAGE_SIZE);
data [0] = arg;
data [1] = tramp;
/*g_warning ("new rgctx trampoline at %p for data %p, tramp %p (stored at %p)", code, arg, tramp, data);*/
@@ -4719,7 +4718,7 @@ get_new_imt_trampoline_from_page (gpointer arg)
code = get_new_trampoline_from_page (MONO_AOT_TRAMP_IMT_THUNK);
- data = (gpointer*)((char*)code - mono_pagesize ());
+ data = (gpointer*)((char*)code - MONO_AOT_TRAMP_PAGE_SIZE);
data [0] = arg;
/*g_warning ("new imt trampoline at %p for data %p, (stored at %p)", code, arg, data);*/
return code;
@@ -4734,7 +4733,7 @@ get_new_gsharedvt_arg_trampoline_from_page (gpointer tramp, gpointer arg)
code = get_new_trampoline_from_page (MONO_AOT_TRAMP_GSHAREDVT_ARG);
- data = (gpointer*)((char*)code - mono_pagesize ());
+ data = (gpointer*)((char*)code - MONO_AOT_TRAMP_PAGE_SIZE);
data [0] = arg;
data [1] = tramp;
/*g_warning ("new rgctx trampoline at %p for data %p, tramp %p (stored at %p)", code, arg, tramp, data);*/
diff --git a/mono/mini/mini.h b/mono/mini/mini.h
index e063815a496..6d5e1655676 100755
--- a/mono/mini/mini.h
+++ b/mono/mini/mini.h
@@ -117,6 +117,8 @@
#define MONO_TYPE_IS_PRIMITIVE(t) ((!(t)->byref && ((((t)->type >= MONO_TYPE_BOOLEAN && (t)->type <= MONO_TYPE_R8) || ((t)->type >= MONO_TYPE_I && (t)->type <= MONO_TYPE_U)))))
+#define MONO_AOT_TRAMP_PAGE_SIZE 16384
+
/* Constants used to encode different types of methods in AOT */
enum {
MONO_AOT_METHODREF_MIN = 240,