about summary refs log tree commit diff stats
path: root/src/custommem.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-05-31 20:13:41 +0200
committerptitSeb <sebastien.chev@gmail.com>2023-05-31 20:13:41 +0200
commite028a67f4f0f2d4f8c423d0eef9c10223e7922f9 (patch)
tree5c71a98b793d711a0a7456ff27ba171eb23f34a9 /src/custommem.c
parentc5e8aaff4a73665ad9ee0231713a7b6068bf2547 (diff)
downloadbox64-e028a67f4f0f2d4f8c423d0eef9c10223e7922f9.tar.gz
box64-e028a67f4f0f2d4f8c423d0eef9c10223e7922f9.zip
Do not try to preserve high memory (unless BOX64_RESERVE_HIGH=1 is used), as currently, it seems buggy and making more harm then good
Diffstat (limited to 'src/custommem.c')
-rw-r--r--src/custommem.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/custommem.c b/src/custommem.c
index 6cb7cedb..dfeb6bbc 100644
--- a/src/custommem.c
+++ b/src/custommem.c
@@ -1425,6 +1425,9 @@ static void atfork_child_custommem(void)
 
 void reserveHighMem()
 {
+    char* p = getenv("BOX64_RESERVE_HIGH");
+    if(!p || p[0]=='0')
+        return; // don't reserve by default
     intptr_t cur = 1LL<<47;
     mapmem_t* m = mapmem;
     while(m && (m->end<cur)) {
@@ -1434,7 +1437,8 @@ void reserveHighMem()
         uintptr_t addr = 0, end = 0;
         if(m->begin>cur) {
             void* ret = mmap64((void*)cur, m->begin-cur, 0, MAP_ANONYMOUS|MAP_FIXED|MAP_PRIVATE|MAP_NORESERVE, -1, 0);
-            printf_log(LOG_DEBUG, "Reserve %p(0x%zx) => %p (%s)\n", (void*)cur, m->begin-cur, ret, strerror(errno));
+            printf_log(LOG_DEBUG, "Reserve %p-%p => %p (%s)\n", (void*)cur, m->begin, ret, strerror(errno));
+            printf_log(LOG_DEBUG, "mmap %p-%p\n", m->begin, m->end);
             if(ret!=(void*)-1) {
                 addr = cur;
                 end = m->begin;