about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-03-05 11:48:48 +0100
committerptitSeb <sebastien.chev@gmail.com>2023-03-05 11:48:48 +0100
commit72119ddfa449bdfc98c7152653047f34feca332c (patch)
tree4074ad32867814b287bd141ab521ce3c967cb202 /src
parentd4afca9b5aa1970179d057b23941355c59a9723d (diff)
downloadbox64-72119ddfa449bdfc98c7152653047f34feca332c.tar.gz
box64-72119ddfa449bdfc98c7152653047f34feca332c.zip
Added automatic detection of libcef (will help zoon #510, #451, #302 and probably other too)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/include/debug.h1
-rwxr-xr-xsrc/librarian/library.c4
-rwxr-xr-xsrc/main.c10
-rw-r--r--src/tools/rcfile.c1
4 files changed, 16 insertions, 0 deletions
diff --git a/src/include/debug.h b/src/include/debug.h
index f4461243..e2e75ee1 100755
--- a/src/include/debug.h
+++ b/src/include/debug.h
@@ -33,6 +33,7 @@ extern int arm64_crc32;
 extern int arm64_atomics;
 #endif
 #endif
+extern int box64_libcef;
 extern int dlsym_error;    // log dlsym error
 extern int cycle_log;      // if using rolling logs
 #ifdef HAVE_TRACE
diff --git a/src/librarian/library.c b/src/librarian/library.c
index 3cfb2bee..48919220 100755
--- a/src/librarian/library.c
+++ b/src/librarian/library.c
@@ -306,6 +306,10 @@ static int loadEmulatedLib(const char* libname, library_t *lib, box64context_t*
             box64_dynarec_strongmem = 1;
         }
         #endif
+        if(libname && box64_libcef && strstr(libname, "libcef.so")) {
+            printf_log(LOG_INFO, "libcef detected, using malloc_hack_2\n");
+            box64_malloc_hack = 2;
+        }
         return 1;
     }
     return 0;
diff --git a/src/main.c b/src/main.c
index e6c29568..20e5bd35 100755
--- a/src/main.c
+++ b/src/main.c
@@ -73,6 +73,7 @@ int arm64_atomics = 0;
 #else   //DYNAREC
 int box64_dynarec = 0;
 #endif
+int box64_libcef = 1;
 int dlsym_error = 0;
 int cycle_log = 0;
 #ifdef HAVE_TRACE
@@ -627,6 +628,15 @@ void LoadLogEnv()
 #endif
 #endif
     // Other BOX64 env. var.
+    p = getenv("BOX64_LIBCEF");
+    if(p) {
+        if(strlen(p)==1) {
+            if(p[0]>='0' && p[0]<='1')
+                box64_libcef = p[0]-'0';
+        }
+        if(!box64_libcef)
+            printf_log(LOG_INFO, "Dynarec will not detect libcef\n");
+    }
     p = getenv("BOX64_LOAD_ADDR");
     if(p) {
         if(sscanf(p, "0x%zx", &box64_load_addr)!=1)
diff --git a/src/tools/rcfile.c b/src/tools/rcfile.c
index b21b6e9d..ff4eb754 100644
--- a/src/tools/rcfile.c
+++ b/src/tools/rcfile.c
@@ -79,6 +79,7 @@ ENTRYSTRING_(BOX64_BASH, bash)                          \
 ENTRYINT(BOX64_JITGDB, jit_gdb, 0, 2, 2)                \
 ENTRYBOOL(BOX64_NOSANDBOX, box64_nosandbox)             \
 ENTRYBOOL(BOX64_EXIT, want_exit)                        \
+ENTRYBOOL(BOX64_LIBCEF, box64_libcef)                   \
 ENTRYINT(BOX64_MALLOC_HACK, box64_malloc_hack, 0, 2, 2) \
 
 #ifdef HAVE_TRACE