aboutsummaryrefslogtreecommitdiff
path: root/source/arm_dynarec/map_rwx.c
diff options
context:
space:
mode:
authorneonloop2022-02-09 07:15:14 +0000
committerneonloop2022-02-09 07:15:14 +0000
commitce34e879e348cecd4e21329be5974cc4162fa6c4 (patch)
tree6bc241b726fc554a31d778642f45a2d1ea2309b4 /source/arm_dynarec/map_rwx.c
parent874c431fdaff24413886416ed3ffa3455681ac01 (diff)
downloadsnes9x2005-ce34e879e348cecd4e21329be5974cc4162fa6c4.tar.gz
snes9x2005-ce34e879e348cecd4e21329be5974cc4162fa6c4.tar.bz2
snes9x2005-ce34e879e348cecd4e21329be5974cc4162fa6c4.zip
Adds experimental ARM dynarecdynarec
Supports ARMv5 and higher, enable with USE_DYNAREC Makefile variable
Diffstat (limited to 'source/arm_dynarec/map_rwx.c')
-rw-r--r--source/arm_dynarec/map_rwx.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/arm_dynarec/map_rwx.c b/source/arm_dynarec/map_rwx.c
new file mode 100644
index 0000000..d4373f7
--- /dev/null
+++ b/source/arm_dynarec/map_rwx.c
@@ -0,0 +1,16 @@
+#define _GNU_SOURCE /* MAP_ANONYMOUS */
+
+#include <sys/mman.h>
+#include <stdlib.h>
+
+void *MapRWX(void *target, size_t size) {
+ void *buf = mmap(target, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0);
+
+ if (buf == MAP_FAILED)
+ {
+ perror("mmap");
+ return NULL;
+ }
+
+ return buf;
+}