summaryrefslogtreecommitdiff
path: root/src/thread/sh/__unmapself.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread/sh/__unmapself.c')
-rw-r--r--src/thread/sh/__unmapself.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/thread/sh/__unmapself.c b/src/thread/sh/__unmapself.c
new file mode 100644
index 00000000..d4fb8be5
--- /dev/null
+++ b/src/thread/sh/__unmapself.c
@@ -0,0 +1,24 @@
+#include "pthread_impl.h"
+
+void __unmapself_sh_mmu(void *, size_t);
+void __unmapself_sh_nommu(void *, size_t);
+
+#if !defined(__SH3__) && !defined(__SH4__)
+#define __unmapself __unmapself_sh_nommu
+#include "dynlink.h"
+#undef CRTJMP
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "mov.l @%0+,r0 ; mov.l @%0,r12 ; jmp @r0 ; mov %1,r15" \
+ : : "r"(pc), "r"(sp) : "r0", "memory" )
+#include "../__unmapself.c"
+#undef __unmapself
+extern __attribute__((__visibility__("hidden"))) unsigned __sh_nommu;
+#else
+#define __sh_nommu 0
+#endif
+
+void __unmapself(void *base, size_t size)
+{
+ if (__sh_nommu) __unmapself_sh_nommu(base, size);
+ else __unmapself_sh_mmu(base, size);
+}