diff --git a/docs/USAGE.md b/docs/USAGE.md index 245af4fa0d..dd1c6ab1a0 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -409,6 +409,12 @@ Wait for FillBlock to be ready (FillBlock builds Dynarec blocks and is not multi * 0 : Do not wait for FillBlock to ready and use Interpreter instead (might speedup a bit massive multithread or JIT programs). * 1 : Wait for FillBlock to be ready. (default, mostly faster) +#### BOX64_DYNAREC_DIRTY * + +Allow continue running a block that is unprotected and potentially dirty + * 0 : Do not allow conitnuing to run a dynablock that gets unprotected (default) + * 1 : Allow continue to run a dynablock that write data in the same page the code is. It can get faster loading time of some game but can also get unexpected crash. + ### Detection #### BOX64_DYNAREC_BLEEDING_EDGE * diff --git a/docs/box64.pod b/docs/box64.pod index f11784233a..3f5970b78e 100644 --- a/docs/box64.pod +++ b/docs/box64.pod @@ -367,6 +367,13 @@ Behavior with FillBlock is not available (FillBlock build Dynarec blocks and is * 0 : Dynarec will not wait for FillBlock to ready and use Interpreter instead (might speedup a bit massive multithread or JIT programs) * 1 : Dynarec will wait for FillBlock to be ready (Default) +=item B=I<0|1> + +Allow continue running a block that is unprotected and potentially dirty + + * 0 : Do not allow conitnuing to run a dynablock that gets unprotected (default) + * 1 : Allow continue to run a dynablock that write data in the same page the code is. It can get faster loading time of some game but can also get unexpected crash. + =item B=I<0|1|2> The GDBJIT debugging support, only available with the compilation option GDBJIT=ON, enable it with gdb command: jit-reader-load /usr/local/lib/libbox64gdbjitreader.so. diff --git a/src/core.c b/src/core.c index 530f616d2f..85c605006e 100644 --- a/src/core.c +++ b/src/core.c @@ -105,6 +105,7 @@ int box64_dynarec_gdbjit = 0; int box64_dynarec_df = 1; int box64_dynarec_perf_map = 0; int box64_dynarec_perf_map_fd = -1; +int box64_dynarec_dirty = 0; #ifdef ARM64 int arm64_asimd = 0; int arm64_aes = 0; @@ -939,6 +940,15 @@ void LoadLogEnv() if(!box64_dynarec_df) printf_log(LOG_INFO, "Dynarec will not use/generate defered flags\n"); } + p = getenv("BOX64_DYNAREC_DIRTY"); + if(p) { + if(strlen(p)==1) { + if(p[0]>='0' && p[0]<='1') + box64_dynarec_dirty = p[0]-'0'; + } + if(box64_dynarec_dirty) + printf_log(LOG_INFO, "Dynarec will allow dirty block to continu running\n"); + } p = getenv("BOX64_DYNAREC_ALIGNED_ATOMICS"); if(p) { if(strlen(p)==1) { diff --git a/src/include/debug.h b/src/include/debug.h index c710a249b3..488433924b 100644 --- a/src/include/debug.h +++ b/src/include/debug.h @@ -46,6 +46,7 @@ extern int box64_dynarec_nativeflags; extern int box64_dynarec_df; extern int box64_dynarec_perf_map; extern int box64_dynarec_perf_map_fd; +extern int box64_dynarec_dirty; #ifdef ARM64 extern int arm64_asimd; extern int arm64_aes; diff --git a/src/libtools/signals.c b/src/libtools/signals.c index 46eb4d5a03..d6aa707559 100644 --- a/src/libtools/signals.c +++ b/src/libtools/signals.c @@ -1622,7 +1622,7 @@ void my_box64signalhandler(int32_t sig, siginfo_t* info, void * ucntx) unprotectDB((uintptr_t)addr, 1, 1); // unprotect 1 byte... But then, the whole page will be unprotected if(db) CheckHotPage((uintptr_t)addr); int db_need_test = db?getNeedTest((uintptr_t)db->x64_addr):0; - if(db && ((addr>=db->x64_addr && addr<(db->x64_addr+db->x64_size)) || db_need_test)) { + if(db && ((addr>=db->x64_addr && addr<(db->x64_addr+db->x64_size)) || (db_need_test && !box64_dynarec_dirty))) { emu = getEmuSignal(emu, p, db); // dynablock got auto-dirty! need to get out of it!!! if(emu->jmpbuf) { diff --git a/src/tools/rcfile.c b/src/tools/rcfile.c index 061b9124c2..674ec52d13 100644 --- a/src/tools/rcfile.c +++ b/src/tools/rcfile.c @@ -177,6 +177,7 @@ ENTRYSTRING_(BOX64_NODYNAREC, box64_nodynarec) \ ENTRYSTRING_(BOX64_DYNAREC_TEST, box64_dynarec_test) \ ENTRYBOOL(BOX64_DYNAREC_MISSING, box64_dynarec_missing) \ ENTRYBOOL(BOX64_DYNAREC_DF, box64_dynarec_df) \ +ENTRYBOOL(BOX64_DYNAREC_DIRTY, box64_dynarec_dirty) \ #else #define SUPER3() \ @@ -206,6 +207,7 @@ IGNORE(BOX64_NODYNAREC) \ IGNORE(BOX64_DYNAREC_TEST) \ IGNORE(BOX64_DYNAREC_MISSING) \ IGNORE(BOX64_DYNAREC_DF) \ +IGNORE(BOX64_DYNAREC_DIRTY) \ #endif diff --git a/system/box64.box64rc b/system/box64.box64rc index e9f33ddd8f..687906a97f 100644 --- a/system/box64.box64rc +++ b/system/box64.box64rc @@ -437,6 +437,39 @@ BOX64_DYNAREC_STRONGMEM=1 [MMRX.exe] BOX64_DYNAREC_STRONGMEM=1 +[RockstarService.exe] +BOX64_DYNAREC_STRONGMEM=1 +BOX64_DYNAREC_FASTNAN=0 +BOX64_DYNAREC_FASTROUND=0 +BOX64_DYNAREC_SAFEFLAGS=2 +BOX64_DYNAREC_DIRTY=1 + +[SocialClubHelper.exe] +BOX64_DYNAREC_SAFEFLAGS=2 +BOX64_DYNAREC_FASTNAN=0 +BOX64_DYNAREC_FASTROUND=0 +BOX64_DYNAREC_BIGBLOCK=3 +BOX64_DYNAREC_CALLRET=1 + +[Launcher.exe] +#this is for Rockstar Launcher, but probably other launcher too... +BOX64_DYNAREC_STRONGMEM=1 +BOX64_DYNAREC_SAFEFLAGS=2 + +[PlayGTAV.exe] +BOX64_DYNAREC_STRONGMEM=1 +BOX64_DYNAREC_SAFEFLAGS=2 +BOX64_DYNAREC_FASTNAN=0 +BOX64_DYNAREC_FASTROUND=0 + +[GTA5.exe] +BOX64_DYNAREC_SAFEFLAGS=2 +BOX64_DYNAREC_STRONGMEM=1 +BOX64_DYNAREC_FASTNAN=0 +BOX64_DYNAREC_FASTROUND=0 +BOX64_DYNAREC_BIGBLOCK=3 +BOX64_DYNAREC_CALLRET=1 + [Risk of Rain 2.exe] BOX64_DYNAREC_STRONGMEM=1