about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-03-23 10:23:00 +0100
committerptitSeb <sebastien.chev@gmail.com>2022-03-23 10:23:00 +0100
commitfa07a0f3310858c7000762d10778e42ace256a40 (patch)
treea23d4e80bb01ae31d58e3468251fff00ffd5a9bf /src
parent44a20349e3d07af9b1e65f261be2ed150e86b11e (diff)
downloadbox64-fa07a0f3310858c7000762d10778e42ace256a40.tar.gz
box64-fa07a0f3310858c7000762d10778e42ace256a40.zip
Added a better way to select 16K pages, and added M1 paragraph in COMPILE.md
Diffstat (limited to 'src')
-rw-r--r--src/custommem.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/custommem.c b/src/custommem.c
index ede78b6f..c11e1557 100644
--- a/src/custommem.c
+++ b/src/custommem.c
@@ -42,7 +42,7 @@ static uintptr_t*          box64_jmptbldefault1[1<<JMPTABL_SHIFT];
 static uintptr_t           box64_jmptbldefault0[1<<JMPTABL_SHIFT];
 #endif
 static pthread_mutex_t     mutex_prot;
-#if defined(LA464) || defined(M1)
+#if defined(PAGE16K)
 #define MEMPROT_SHIFT 14
 #define MEMPROT_SHIFT2 (16+14)
 #else
@@ -1236,6 +1236,11 @@ void init_custommem_helper(box64context_t* ctx)
     mapmem->begin = 0x0;
     mapmem->end = (uintptr_t)LOWEST - 1;
     loadProtectionFromMap();
+    // check if PageSize is correctly defined
+    if(box64_pagesize != (1<<MEMPROT_SHIFT)) {
+        printf_log(LOG_NONE, "Error: PageSize configuation is wrong: configured with %d, but got %d\n", 1<<MEMPROT_SHIFT, box64_pagesize);
+        exit(-1);   // abort or let it continue?
+    }
 }
 
 void fini_custommem_helper(box64context_t *ctx)