about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-08-16 10:52:31 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-08-16 10:52:36 +0200
commit34b85b3560385d4aef73c64548e200f6bb0e264e (patch)
tree028bf801c7c3b3f8e25c2236488e8672914378b9 /src
parent7df2b6b25243a76728902ea4a9da49c773b4b123 (diff)
downloadbox64-34b85b3560385d4aef73c64548e200f6bb0e264e.tar.gz
box64-34b85b3560385d4aef73c64548e200f6bb0e264e.zip
Detect 32bits elf before loading
Diffstat (limited to 'src')
-rw-r--r--src/core.c6
-rw-r--r--src/include/debug.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/core.c b/src/core.c
index aca52b47..bfba08f8 100644
--- a/src/core.c
+++ b/src/core.c
@@ -58,6 +58,7 @@ int box64_dynarec_test = 0;
 path_collection_t box64_addlibs = {0};
 int box64_maxcpu = 0;
 int box64_maxcpu_immutable = 0;
+int box64_is32bits = 0;
 #if defined(SD845) || defined(SD888) || defined(SD8G2) || defined(TEGRAX1)
 int box64_mmap32 = 1;
 #else
@@ -2084,6 +2085,11 @@ int initialize(int argc, const char **argv, char** env, x64emu_t** emulator, elf
         FreeCollection(&ld_preload);
         return -1;
     }
+    #ifdef BOX32
+    box64_is32bits = FileIsX86ELF(my_context->fullpath);
+    if(box64_is32bits)
+        printf_log(LOG_INFO, "BOX64: Using Box32 to load 32bits elf\n");
+    #endif
     elfheader_t *elf_header = LoadAndCheckElfHeader(f, my_context->fullpath, 1);
     if(!elf_header) {
         int x86 = my_context->box86path?FileIsX86ELF(my_context->fullpath):0;
diff --git a/src/include/debug.h b/src/include/debug.h
index 1e31b437..e0f81c95 100644
--- a/src/include/debug.h
+++ b/src/include/debug.h
@@ -16,6 +16,7 @@ extern int box64_ignoreint3;
 extern int box64_rdtsc;
 extern int box64_rdtsc_1ghz;
 extern uint8_t box64_rdtsc_shift;
+extern int box64_is32bits;
 #ifdef DYNAREC
 extern int box64_dynarec_dump;
 extern int box64_dynarec_trace;