03-10-2013, 04:42 PM
You can try something like this but it didn't work for me, as mentioned:
-[Unknown]
Code:
diff --git a/Common/MemoryUtil.cpp b/Common/MemoryUtil.cpp
index a7119b3..c9d5518 100644
--- a/Common/MemoryUtil.cpp
+++ b/Common/MemoryUtil.cpp
@@ -30,6 +30,7 @@
#ifdef __APPLE__
#include <sys/types.h>
#include <sys/mman.h>
+#include <fcntl.h>
#endif
#include <stdlib.h>
@@ -86,12 +87,21 @@ void* AllocateExecutableMemory(size_t size, bool low)
if (low && (!map_hint))
map_hint = (char*)round_page(512*1024*1024); /* 0.5 GB rounded u
#endif
+#ifdef IOS
+ int fd = open("/dev/zero", O_RDWR, 0);
+#endif
+
void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC,
+#ifdef IOS
+ MAP_JIT | MAP_PRIVATE | MAP_FILE
+ , fd, 0);
+#else
MAP_ANON | MAP_PRIVATE
#if defined(__x86_64__) && defined(MAP_32BIT)
| (low ? MAP_32BIT : 0)
#endif
, -1, 0);
+#endif
#endif /* defined(_WIN32) */
// printf("Mapped executable memory at %p (size %ld)\n", ptr,-[Unknown]

