about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2025-10-19 19:06:38 +0200
committerptitSeb <sebastien.chev@gmail.com>2025-10-19 19:06:38 +0200
commit0833a07a65da8e786041666a815f2df87dccaa7e (patch)
tree9dafa7e7c7ae9358bafab3ff368866d6175267e9
parentaa4dbe72c9f7a6297a68ef4edce70a105cbd0f4c (diff)
downloadbox64-0833a07a65da8e786041666a815f2df87dccaa7e.tar.gz
box64-0833a07a65da8e786041666a815f2df87dccaa7e.zip
[DYNAREC] Introduce BOX4_DYNAREC_INTERP_SIGNAL and 1 profile that needs it
-rw-r--r--docs/USAGE.md7
-rw-r--r--docs/box64.pod8
-rw-r--r--docs/gen/usage.json18
-rw-r--r--src/include/env.h1
-rw-r--r--src/libtools/signal32.c2
-rw-r--r--src/libtools/signals.c2
-rw-r--r--system/box64.box64rc5
7 files changed, 41 insertions, 2 deletions
diff --git a/docs/USAGE.md b/docs/USAGE.md
index f8caf164..01653007 100644
--- a/docs/USAGE.md
+++ b/docs/USAGE.md
@@ -329,6 +329,13 @@ Force the use of float/double for x87 emulation. Availble in WowBox64.
  * 1: Only use Double for x87 emulation. 
  * 2: Check Precision Control low precision on x87 emulation. 
 
+### BOX64_DYNAREC_INTERP_SIGNAL
+
+Allow the use of Dynarec in Signal Handlers. Availble in WowBox64.
+
+ * 0: Allow the use of Dynarec in signal handlers. [Default]
+ * 1: Only use the Interpreter for signal handlers (as it was in v0.3.8 and earlier). 
+
 ### BOX64_EXIT
 
 Just exit, do not try to run the program.
diff --git a/docs/box64.pod b/docs/box64.pod
index f20e9f9d..06cdc8e2 100644
--- a/docs/box64.pod
+++ b/docs/box64.pod
@@ -399,6 +399,14 @@ Force the use of float/double for x87 emulation. Availble in WowBox64.
  * 2 : Check Precision Control low precision on x87 emulation. 
 
 
+=item B<BOX64_DYNAREC_INTERP_SIGNAL> =I<0|1>
+
+Allow the use of Dynarec in Signal Handlers. Availble in WowBox64.
+
+ * 0 : Allow the use of Dynarec in signal handlers. [Default]
+ * 1 : Only use the Interpreter for signal handlers (as it was in v0.3.8 and earlier). 
+
+
 =item B<BOX64_DYNACACHE> =I<0|1|2>
 
 Enable/disable the Dynamic Recompiler Cache (a.k.a DynaCache). This option defaults to 2 (to read cache if present but not generate any). DynaCache write file to home folder by default, and can grow without limit.
diff --git a/docs/gen/usage.json b/docs/gen/usage.json
index f96bb1c5..91e465cc 100644
--- a/docs/gen/usage.json
+++ b/docs/gen/usage.json
@@ -848,6 +848,24 @@
     ]
   },
   {
+    "name": "BOX64_DYNAREC_INTERP_SIGNAL",
+    "description": "Allow the use of Dynarec in Signal Handlers.",
+    "category": "Compatibility",
+    "wine": true,
+    "options": [
+      {
+        "key": "0",
+        "description": "Allow the use of Dynarec in signal handlers.",
+        "default": true
+      },
+      {
+        "key": "1",
+        "description": "Only use the Interpreter for signal handlers (as it was in v0.3.8 and earlier).",
+        "default": false
+      }
+    ]
+  },
+  {
     "name": "BOX64_DYNACACHE",
     "description": "Enable/disable the Dynamic Recompiler Cache (a.k.a DynaCache). This option defaults to 2 (to read cache if present but not generate any). DynaCache write file to home folder by default, and can grow without limit.",
     "category": "Performance",
diff --git a/src/include/env.h b/src/include/env.h
index 6b793881..546fc7fe 100644
--- a/src/include/env.h
+++ b/src/include/env.h
@@ -70,6 +70,7 @@ extern char* ftrace_name;
     BOOLEAN(BOX64_DYNAREC_WAIT, dynarec_wait, 1, 1)                           \
     INTEGER(BOX64_DYNAREC_WEAKBARRIER, dynarec_weakbarrier, 1, 0, 2, 1)       \
     INTEGER(BOX64_DYNAREC_X87DOUBLE, dynarec_x87double, 0, 0, 2, 1)           \
+    BOOLEAN(BOX64_DYNAREC_INTERP_SIGNAL, dynarec_interp_signal, 0, 1)         \
     STRING(BOX64_EMULATED_LIBS, emulated_libs, 0)                             \
     STRING(BOX64_ENV, env, 0)                                                 \
     STRING(BOX64_ENV1, env1, 0)                                               \
diff --git a/src/libtools/signal32.c b/src/libtools/signal32.c
index 99e09434..d088a9e6 100644
--- a/src/libtools/signal32.c
+++ b/src/libtools/signal32.c
@@ -699,7 +699,7 @@ void my_sigactionhandler_oldcode_32(x64emu_t* emu, int32_t sig, int simple, sigi
     int dynarec = 0;
     #ifdef DYNAREC
     if(sig!=X64_SIGSEGV && !(Locks&is_dyndump_locked) && !(Locks&is_memprot_locked))
-        dynarec = 1;
+        dynarec = BOX64ENV(dynarec_interp_signal)?0:1;
     #endif
     ret = RunFunctionHandler32(&exits, dynarec, sigcontext, my_context->signals[info2->si_signo], 3, info2->si_signo, info2, sigcontext);
     // restore old value from emu
diff --git a/src/libtools/signals.c b/src/libtools/signals.c
index 4bb29eaa..a05b6491 100644
--- a/src/libtools/signals.c
+++ b/src/libtools/signals.c
@@ -1147,7 +1147,7 @@ void my_sigactionhandler_oldcode_64(x64emu_t* emu, int32_t sig, int simple, sigi
     int dynarec = 0;
     #ifdef DYNAREC
     if(!(sig==X64_SIGSEGV || (Locks&is_dyndump_locked) || (Locks&is_memprot_locked)))
-        dynarec = 1;
+        dynarec = BOX64ENV(dynarec_interp_signal)?0:1;
     #endif
     ret = RunFunctionHandler(emu, &exits, dynarec, sigcontext, my_context->signals[info2->si_signo], 3, info2->si_signo, info2, sigcontext);
     // restore old value from emu
diff --git a/system/box64.box64rc b/system/box64.box64rc
index bfad71fc..783866d6 100644
--- a/system/box64.box64rc
+++ b/system/box64.box64rc
@@ -957,6 +957,11 @@ BOX64_DYNAREC_SAFEFLAGS=2
 BOX64_DYNAREC_BIGBLOCK=3
 BOX64_DYNAREC_CALLRET=1
 
+[VampireSurvivors.exe]
+BOX64_DYNAREC_BIGBLOCK=3
+BOX64_DYNAREC_CALLRET=1
+BOX64_DYNAREC_INTERP_SIGNAL=1    #there seems to be some race condition when signal is done with dynarec on this one
+
 [vc_redist.x64.exe]
 BOX64_DYNACACHE=0
 BOX64_DYNAREC_SAFEFLAGS=2