forked from pool/mono-core
02eae0b897
- rediff and reactivate ppc.patch - port forward ppc64le fixes from matz: - Add support for ppc64le, fix build warnings, the blocksize changes in mono-core-ppc64le.diff should also help ppc64 proper. Added patches: * mono-core-parallel-build.diff * mono-core-ppc64le-callreg.diff * mono-core-ppc64le-swr11r12.diff * mono-core-ppc64le.diff - no valgrind on aarch64 and s390 (but on s390x) OBS-URL: https://build.opensuse.org/request/show/225490 OBS-URL: https://build.opensuse.org/package/show/Mono:Factory/mono-core?expand=0&rev=127
195 lines
7.1 KiB
Diff
195 lines
7.1 KiB
Diff
Use ppc_r12 for some global call sequences
|
|
|
|
After the mechanical exchange of ppc_r11 and ppc_r12 we now can use
|
|
ppc_r12 for global calls to hold the callees address without clobbering
|
|
r11 (which potentially contains IMT_REG, VTABLE_REG and RGCTX_REG).
|
|
We don't need to change all indirect calls, only those potentially reaching
|
|
functions containing a TOC setup based on r12 (in particular functions
|
|
in shared libs). As the instruction sequence patcher can only deal
|
|
with one destination register we also need to make some additional
|
|
calls use r12. We probably should convert all calls that currently
|
|
use r0 to use r12 if no other conflicts arise but this is enough to build.
|
|
|
|
diff -u mono-3.2.3/mono/mini/exceptions-ppc.c mono-3.2.3/mono/mini/exceptions-ppc.c
|
|
--- mono-3.2.3/mono/mini/exceptions-ppc.c 2014-01-04 19:04:35.000000000 +0000
|
|
+++ mono-3.2.3/mono/mini/exceptions-ppc.c 2014-01-04 19:32:51.000000000 +0000
|
|
@@ -395,8 +395,8 @@
|
|
ppc_bcctrl (code, PPC_BR_ALWAYS, 0);
|
|
} else {
|
|
ppc_load (code, ppc_r3, (gulong)mono_defaults.corlib);
|
|
- ppc_load_func (code, ppc_r0, mono_exception_from_token);
|
|
- ppc_mtctr (code, ppc_r0);
|
|
+ ppc_load_func (code, PPC_CALL_REG, mono_exception_from_token);
|
|
+ ppc_mtctr (code, PPC_CALL_REG);
|
|
ppc_bcctrl (code, PPC_BR_ALWAYS, 0);
|
|
}
|
|
}
|
|
@@ -430,8 +430,8 @@
|
|
ppc_mtctr (code, ppc_r12);
|
|
ppc_bcctrl (code, PPC_BR_ALWAYS, 0);
|
|
} else {
|
|
- ppc_load_func (code, ppc_r0, mono_ppc_throw_exception);
|
|
- ppc_mtctr (code, ppc_r0);
|
|
+ ppc_load_func (code, PPC_CALL_REG, mono_ppc_throw_exception);
|
|
+ ppc_mtctr (code, PPC_CALL_REG);
|
|
ppc_bcctrl (code, PPC_BR_ALWAYS, 0);
|
|
}
|
|
/* we should never reach this breakpoint */
|
|
diff -u mono-3.2.3/mono/mini/mini-ppc.c mono-3.2.3/mono/mini/mini-ppc.c
|
|
--- mono-3.2.3/mono/mini/mini-ppc.c 2014-01-04 19:16:23.000000000 +0000
|
|
+++ mono-3.2.3/mono/mini/mini-ppc.c 2014-01-04 19:58:06.000000000 +0000
|
|
@@ -1783,8 +1783,8 @@
|
|
|
|
ppc_load_ptr (code, ppc_r3, cfg->method);
|
|
ppc_li (code, ppc_r4, 0); /* NULL ebp for now */
|
|
- ppc_load_func (code, ppc_r0, func);
|
|
- ppc_mtlr (code, ppc_r0);
|
|
+ ppc_load_func (code, PPC_CALL_REG, func);
|
|
+ ppc_mtlr (code, PPC_CALL_REG);
|
|
ppc_blrl (code);
|
|
return code;
|
|
}
|
|
@@ -1881,8 +1881,8 @@
|
|
}
|
|
|
|
ppc_load_ptr (code, ppc_r3, cfg->method);
|
|
- ppc_load_func (code, ppc_r0, func);
|
|
- ppc_mtlr (code, ppc_r0);
|
|
+ ppc_load_func (code, PPC_CALL_REG, func);
|
|
+ ppc_mtlr (code, PPC_CALL_REG);
|
|
ppc_blrl (code);
|
|
|
|
switch (save_mode) {
|
|
@@ -2923,7 +2923,7 @@
|
|
|
|
if (!is_fd) {
|
|
guint8 *buf = (guint8*)&seq [5];
|
|
- ppc_mr (buf, ppc_r0, ppc_r12);
|
|
+ ppc_mr (buf, PPC_CALL_REG, ppc_r12);
|
|
ppc_nop (buf);
|
|
}
|
|
} else {
|
|
@@ -2936,7 +2936,7 @@
|
|
/* FIXME: we're assuming we're using r12 here */
|
|
ppc_load_ptr_sequence (code, ppc_r12, target);
|
|
#else
|
|
- ppc_load_ptr_sequence (code, ppc_r0, target);
|
|
+ ppc_load_ptr_sequence (code, PPC_CALL_REG, target);
|
|
#endif
|
|
mono_arch_flush_icache ((guint8*)seq, 28);
|
|
#else
|
|
@@ -2952,8 +2952,8 @@
|
|
g_assert ((seq [2] >> 26) == 31);
|
|
g_assert (seq [3] == 0x4e800021 || seq [3] == 0x4e800020 || seq [3] == 0x4e800420);
|
|
/* FIXME: make this thread safe */
|
|
- ppc_lis (code, ppc_r0, (guint32)(target) >> 16);
|
|
- ppc_ori (code, ppc_r0, ppc_r0, (guint32)(target) & 0xffff);
|
|
+ ppc_lis (code, PPC_CALL_REG, (guint32)(target) >> 16);
|
|
+ ppc_ori (code, PPC_CALL_REG, PPC_CALL_REG, (guint32)(target) & 0xffff);
|
|
mono_arch_flush_icache (code - 8, 8);
|
|
#endif
|
|
} else {
|
|
@@ -3371,8 +3371,8 @@
|
|
mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_INTERNAL_METHOD,
|
|
(gpointer)"mono_break");
|
|
if ((FORCE_INDIR_CALL || cfg->method->dynamic) && !cfg->compile_aot) {
|
|
- ppc_load_func (code, ppc_r0, 0);
|
|
- ppc_mtlr (code, ppc_r0);
|
|
+ ppc_load_func (code, PPC_CALL_REG, 0);
|
|
+ ppc_mtlr (code, PPC_CALL_REG);
|
|
ppc_blrl (code);
|
|
} else {
|
|
ppc_bl (code, 0);
|
|
@@ -3819,8 +3819,8 @@
|
|
else
|
|
mono_add_patch_info (cfg, offset, MONO_PATCH_INFO_ABS, call->fptr);
|
|
if ((FORCE_INDIR_CALL || cfg->method->dynamic) && !cfg->compile_aot) {
|
|
- ppc_load_func (code, ppc_r0, 0);
|
|
- ppc_mtlr (code, ppc_r0);
|
|
+ ppc_load_func (code, PPC_CALL_REG, 0);
|
|
+ ppc_mtlr (code, PPC_CALL_REG);
|
|
ppc_blrl (code);
|
|
} else {
|
|
ppc_bl (code, 0);
|
|
@@ -3913,8 +3913,8 @@
|
|
mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_INTERNAL_METHOD,
|
|
(gpointer)"mono_arch_throw_exception");
|
|
if ((FORCE_INDIR_CALL || cfg->method->dynamic) && !cfg->compile_aot) {
|
|
- ppc_load_func (code, ppc_r0, 0);
|
|
- ppc_mtlr (code, ppc_r0);
|
|
+ ppc_load_func (code, PPC_CALL_REG, 0);
|
|
+ ppc_mtlr (code, PPC_CALL_REG);
|
|
ppc_blrl (code);
|
|
} else {
|
|
ppc_bl (code, 0);
|
|
@@ -3927,8 +3927,8 @@
|
|
mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_INTERNAL_METHOD,
|
|
(gpointer)"mono_arch_rethrow_exception");
|
|
if ((FORCE_INDIR_CALL || cfg->method->dynamic) && !cfg->compile_aot) {
|
|
- ppc_load_func (code, ppc_r0, 0);
|
|
- ppc_mtlr (code, ppc_r0);
|
|
+ ppc_load_func (code, PPC_CALL_REG, 0);
|
|
+ ppc_mtlr (code, PPC_CALL_REG);
|
|
ppc_blrl (code);
|
|
} else {
|
|
ppc_bl (code, 0);
|
|
@@ -5070,8 +5070,8 @@
|
|
mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_INTERNAL_METHOD,
|
|
(gpointer)"mono_get_lmf_addr");
|
|
if ((FORCE_INDIR_CALL || cfg->method->dynamic) && !cfg->compile_aot) {
|
|
- ppc_load_func (code, ppc_r0, 0);
|
|
- ppc_mtlr (code, ppc_r0);
|
|
+ ppc_load_func (code, PPC_CALL_REG, 0);
|
|
+ ppc_mtlr (code, PPC_CALL_REG);
|
|
ppc_blrl (code);
|
|
} else {
|
|
ppc_bl (code, 0);
|
|
@@ -5380,8 +5380,8 @@
|
|
patch_info->data.name = "mono_arch_throw_corlib_exception";
|
|
patch_info->ip.i = code - cfg->native_code;
|
|
if (FORCE_INDIR_CALL || cfg->method->dynamic) {
|
|
- ppc_load_func (code, ppc_r0, 0);
|
|
- ppc_mtctr (code, ppc_r0);
|
|
+ ppc_load_func (code, PPC_CALL_REG, 0);
|
|
+ ppc_mtctr (code, PPC_CALL_REG);
|
|
ppc_bcctr (code, PPC_BR_ALWAYS, 0);
|
|
} else {
|
|
ppc_bl (code, 0);
|
|
diff -u mono-3.2.3/mono/mini/mini-ppc.h mono-3.2.3/mono/mini/mini-ppc.h
|
|
--- mono-3.2.3/mono/mini/mini-ppc.h 2014-01-04 19:04:36.000000000 +0000
|
|
+++ mono-3.2.3/mono/mini/mini-ppc.h 2014-01-04 19:27:07.000000000 +0000
|
|
@@ -172,6 +172,8 @@
|
|
#define PPC_FIRST_FPARG_REG ppc_f1
|
|
#endif
|
|
|
|
+#define PPC_CALL_REG ppc_r12
|
|
+
|
|
#if defined(HAVE_WORKING_SIGALTSTACK) && !defined(__APPLE__)
|
|
#define MONO_ARCH_SIGSEGV_ON_ALTSTACK 1
|
|
#define MONO_ARCH_SIGNAL_STACK_SIZE (12 * 1024)
|
|
diff -u mono-3.2.3/mono/mini/tramp-ppc.c mono-3.2.3/mono/mini/tramp-ppc.c
|
|
--- mono-3.2.3/mono/mini/tramp-ppc.c 2014-01-04 19:16:53.000000000 +0000
|
|
+++ mono-3.2.3/mono/mini/tramp-ppc.c 2014-01-04 19:35:16.000000000 +0000
|
|
@@ -309,8 +309,8 @@
|
|
ppc_mtlr (code, ppc_r12);
|
|
ppc_blrl (code);
|
|
} else {
|
|
- ppc_load_func (code, ppc_r0, mono_get_lmf_addr);
|
|
- ppc_mtlr (code, ppc_r0);
|
|
+ ppc_load_func (code, PPC_CALL_REG, mono_get_lmf_addr);
|
|
+ ppc_mtlr (code, PPC_CALL_REG);
|
|
ppc_blrl (code);
|
|
}
|
|
/* we build the MonoLMF structure on the stack - see mini-ppc.h
|
|
@@ -371,8 +371,8 @@
|
|
ppc_blrl (code);
|
|
} else {
|
|
tramp_handler = mono_get_trampoline_func (tramp_type);
|
|
- ppc_load_func (code, ppc_r0, tramp_handler);
|
|
- ppc_mtlr (code, ppc_r0);
|
|
+ ppc_load_func (code, PPC_CALL_REG, tramp_handler);
|
|
+ ppc_mtlr (code, PPC_CALL_REG);
|
|
ppc_blrl (code);
|
|
}
|
|
|