about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/tools/bridge.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tools/bridge.c b/src/tools/bridge.c
index 5f6bb5af..c800b8c5 100755
--- a/src/tools/bridge.c
+++ b/src/tools/bridge.c
@@ -4,6 +4,7 @@
 #include <string.h>
 #include <dlfcn.h>
 #include <pthread.h>
+#include <sys/mman.h>
 
 #include "custommem.h"
 #include "bridge.h"
@@ -36,9 +37,11 @@ typedef struct bridge_s {
 brick_t* NewBrick()
 {
     brick_t* ret = (brick_t*)calloc(1, sizeof(brick_t));
-    if(posix_memalign((void**)&ret->b, box64_pagesize, NBRICK*sizeof(onebridge_t))) {
+    void* ptr = my_mmap(thread_get_emu(), NULL, NBRICK * sizeof(onebridge_t), PROT_READ | PROT_WRITE, MAP_PRIVATE | 0x40 | MAP_ANONYMOUS, -1, 0); // 0x40 is MAP_32BIT
+    if(ptr == MAP_FAILED) {
         printf_log(LOG_NONE, "Warning, cannot allocate 0x%lx aligned bytes for bridge, will probably crash later\n", NBRICK*sizeof(onebridge_t));
     }
+    ret->b = ptr;
     return ret;
 }