about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2025-10-03 15:45:11 +0200
committerptitSeb <sebastien.chev@gmail.com>2025-10-03 15:45:11 +0200
commit7bf2caa5c4ef9662b9da66f3f895ed538692946e (patch)
tree35b83a3e08da983735a510fb2f3953480b155907
parent6ae0524da64f2456208efeaa32b52ab446fb7e7f (diff)
downloadbox64-7bf2caa5c4ef9662b9da66f3f895ed538692946e.tar.gz
box64-7bf2caa5c4ef9662b9da66f3f895ed538692946e.zip
[DYNAREC] Added BOX64_DYNAREC_NOHOTPAGE to disabled hotpage detection
-rw-r--r--docs/USAGE.md7
-rw-r--r--docs/box64.pod8
-rw-r--r--docs/gen/usage.json18
-rw-r--r--src/custommem.c2
-rw-r--r--src/emu/modrm.h6
-rw-r--r--src/include/env.h1
6 files changed, 39 insertions, 3 deletions
diff --git a/docs/USAGE.md b/docs/USAGE.md
index 3ad9b3d0..d9a26546 100644
--- a/docs/USAGE.md
+++ b/docs/USAGE.md
@@ -91,6 +91,13 @@ Allow continue running a block that is unprotected and potentially dirty.
  * 1: Allow continue to run a dynablock that write data in the same page as code. It can gets faster in loading time of some game but can also get unexpected crashes. 
  * 2: Will also, when it detect an HotPage, flag that page as NEVERCLEAN, and so it will not be write protected but Block build from that page will always be tested. It can be faster that way (but soem SMC case might not be trapped). 
 
+### BOX64_DYNAREC_NOHOTPAGE
+
+Disable detection of hot page (where code is executed and data written at the same time).
+
+ * 0: Detect hot page [Default]
+ * 1: Do not detect hot page 
+
 ### BOX64_DYNAREC_FASTNAN
 
 Enable or disable fast NaN handling. Availble in WowBox64.
diff --git a/docs/box64.pod b/docs/box64.pod
index 5afab383..a95613a5 100644
--- a/docs/box64.pod
+++ b/docs/box64.pod
@@ -197,6 +197,14 @@ Allow continue running a block that is unprotected and potentially dirty.
  * 2 : Will also, when it detect an HotPage, flag that page as NEVERCLEAN, and so it will not be write protected but Block build from that page will always be tested. It can be faster that way (but soem SMC case might not be trapped). 
 
 
+=item B<BOX64_DYNAREC_NOHOTPAGE> =I<0|1>
+
+Disable detection of hot page (where code is executed and data written at the same time).
+
+ * 0 : Detect hot page [Default]
+ * 1 : Do not detect hot page 
+
+
 =item B<BOX64_DYNAREC_DIV0> =I<0|1>
 
 Enable or disable the generation of division-by-zero exception. Availble in WowBox64.
diff --git a/docs/gen/usage.json b/docs/gen/usage.json
index 577521e8..53cc74b5 100644
--- a/docs/gen/usage.json
+++ b/docs/gen/usage.json
@@ -344,6 +344,24 @@
     ]
   },
   {
+    "name": "BOX64_DYNAREC_NOHOTPAGE",
+    "description": "Disable detection of hot page (where code is executed and data written at the same time).",
+    "category": "Performance",
+    "wine": false,
+    "options": [
+      {
+        "key": "0",
+        "description": "Detect hot page",
+        "default": true
+      },
+      {
+        "key": "1",
+        "description": "Do not detect hot page",
+        "default": false
+      }
+    ]
+  },
+  {
     "name": "BOX64_DYNAREC_DIV0",
     "description": "Enable or disable the generation of division-by-zero exception.",
     "category": "Compatibility",
diff --git a/src/custommem.c b/src/custommem.c
index c0f5c028..7c997422 100644
--- a/src/custommem.c
+++ b/src/custommem.c
@@ -2250,6 +2250,8 @@ void CheckHotPage(uintptr_t addr, uint32_t prot)
         return;
     if(prot&PROT_NEVERCLEAN && BOX64ENV(dynarec_dirty)==2)
         return;
+    if(BOX64ENV(dynarec_nohotpage))
+        return;
     uintptr_t page = addr>>12;
     // look for idx
     int idx = IdxHotPage(page);
diff --git a/src/emu/modrm.h b/src/emu/modrm.h
index d8687df4..e18212aa 100644
--- a/src/emu/modrm.h
+++ b/src/emu/modrm.h
@@ -13,9 +13,9 @@
 #define PARITY(x)   (((emu->x64emu_parity_tab[(x) / 32] >> ((x) % 32)) & 1) == 0)

 

 #ifdef DYNAREC

-#define STEP  CheckExec(emu, addr); if(step && !ACCESS_FLAG(F_TF)) return 0;

-#define STEP2 CheckExec(emu, addr); if(step && !ACCESS_FLAG(F_TF)) {R_RIP = addr; return 0;}

-#define STEP3 CheckExec(emu, addr); if(*step) (*step)++;

+#define STEP  if(step && !ACCESS_FLAG(F_TF)) return 0; else if((emu->old_ip>>12)!=(addr>>12)) CheckExec(emu, addr); 

+#define STEP2 if(step && !ACCESS_FLAG(F_TF)) {R_RIP = addr; return 0;} else if((emu->old_ip>>12)!=(addr>>12)) CheckExec(emu, addr); 

+#define STEP3 if(*step) (*step)++; else if((emu->old_ip>>12)!=(addr>>12)) CheckExec(emu, addr); 

 #else

 #define STEP

 #define STEP2

diff --git a/src/include/env.h b/src/include/env.h
index 398e1f03..3e6a7342 100644
--- a/src/include/env.h
+++ b/src/include/env.h
@@ -47,6 +47,7 @@ extern char* ftrace_name;
     INTEGER(BOX64_DYNAREC_CALLRET, dynarec_callret, 0, 0, 2, 1)               \
     BOOLEAN(BOX64_DYNAREC_DF, dynarec_df, 1, 1)                               \
     INTEGER(BOX64_DYNAREC_DIRTY, dynarec_dirty, 0, 0, 2, 0)                   \
+    BOOLEAN(BOX64_DYNAREC_NOHOTPAGE, dynarec_nohotpage, 0, 0)                 \
     BOOLEAN(BOX64_DYNAREC_DIV0, dynarec_div0, 0, 1)                           \
     INTEGER(BOX64_DYNAREC_DUMP, dynarec_dump, 0, 0, 2, 1)                     \
     STRING(BOX64_DYNAREC_DUMP_RANGE, dynarec_dump_range, 1)                   \