From 4610f451e99610043461401f4c9acd3de408a02d Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sun, 19 Feb 2023 14:50:01 +0100 Subject: Improved convertion to/from 80bits double, and added BOX64_X87_NO80BITS to not handle them --- src/include/debug.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/include/debug.h') diff --git a/src/include/debug.h b/src/include/debug.h index 7251c728..06ec0d8c 100755 --- a/src/include/debug.h +++ b/src/include/debug.h @@ -47,6 +47,7 @@ extern uint64_t start_cnt; extern int box64_nosandbox; extern int box64_dummy_crashhandler; extern int box64_sse_flushto0; +extern int box64_x87_no80bits; extern int allow_missing_libs; extern int box64_mapclean; extern int box64_prefer_wrapped; -- cgit 1.4.1 From d06ff478d188eb4a077041e4b2b628f75ed9eaf8 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sun, 19 Feb 2023 23:54:00 +0100 Subject: [DYNAREC] Introduced BOX64_DYNAREC_FASTPAGE to use an alternate way to handle HotPages (faster but crashy) --- docs/USAGE.md | 7 ++++++- src/dynarec/dynablock.c | 15 +++++++++++++-- src/include/debug.h | 1 + src/main.c | 10 ++++++++++ src/tools/rcfile.c | 8 +++++--- 5 files changed, 35 insertions(+), 6 deletions(-) (limited to 'src/include/debug.h') diff --git a/docs/USAGE.md b/docs/USAGE.md index 17fadb61..92913438 100755 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -175,7 +175,12 @@ Optimisation of CALL/RET opcodes (not compatible with jit/dynarec/smc) #### BOX64_DYNAREC_HOTPAGE * Handling of HotPage (Page beeing both executed and writen) * 0 : Don't track hotpage -* 1-255 : Trak HotPage, and disable execution of a page beeing writen for N attempts (default is 16) +* 1-255 : Track HotPage, and disable execution of a page beeing writen for N attempts (default is 16) + +#### BOX64_DYNAREC_FASTPAGE * +Will use a faster handling of HotPage (Page beeing both executed and writen) +* 0 : use regular hotpage (Default) +* 1 : Use faster hotpage, taking the risk of running obsolete JIT code (might be faster, but more prone to crash) #### BOX64_DYNAREC_BLEEDING_EDGE * Detect MonoBleedingEdge and apply conservative settings diff --git a/src/dynarec/dynablock.c b/src/dynarec/dynablock.c index 6ff5e53c..9529a91c 100755 --- a/src/dynarec/dynablock.c +++ b/src/dynarec/dynablock.c @@ -205,8 +205,19 @@ dynablock_t* DBGetBlock(x64emu_t* emu, uintptr_t addr, int create) dynablock_t *db = internalDBGetBlock(emu, addr, addr, create, 1); if(db && db->done && db->block && db->need_test) { if(AreaInHotPage((uintptr_t)db->x64_addr, (uintptr_t)db->x64_addr + db->x64_size - 1)) { - dynarec_log(LOG_INFO, "Not running block %p from %p:%p with for %p because it's in a hotpage\n", db, db->x64_addr, db->x64_addr+db->x64_size-1, (void*)addr); - return NULL; + if(box64_dynarec_fastpage) { + uint32_t hash = X31_hash_code(db->x64_addr, db->x64_size); + if(hash==db->hash) // seems ok, run it without reprotecting it + return db; + db->done = 0; // invalidating the block, it's already not good + dynarec_log(LOG_DEBUG, "Invalidating block %p from %p:%p (hash:%X/%X) for %p\n", db, db->x64_addr, db->x64_addr+db->x64_size-1, hash, db->hash, (void*)addr); + // Free db, it's now invalid! + FreeDynablock(db, 1); + return NULL; // not building a new one, it's still a hotpage + } else { + dynarec_log(LOG_INFO, "Not running block %p from %p:%p with for %p because it's in a hotpage\n", db, db->x64_addr, db->x64_addr+db->x64_size-1, (void*)addr); + return NULL; + } } uint32_t hash = X31_hash_code(db->x64_addr, db->x64_size); if(mutex_trylock(&my_context->mutex_dyndump)) { diff --git a/src/include/debug.h b/src/include/debug.h index 06ec0d8c..b9729787 100755 --- a/src/include/debug.h +++ b/src/include/debug.h @@ -23,6 +23,7 @@ extern int box64_dynarec_safeflags; extern int box64_dynarec_callret; extern int box64_dynarec_bleeding_edge; extern int box64_dynarec_hotpage; +extern int box64_dynarec_fastpage; extern int box64_dynarec_wait; #ifdef ARM64 extern int arm64_asimd; diff --git a/src/main.c b/src/main.c index b8ee9f4b..55a18473 100755 --- a/src/main.c +++ b/src/main.c @@ -57,6 +57,7 @@ int box64_dynarec_fastround = 1; int box64_dynarec_safeflags = 1; int box64_dynarec_callret = 0; int box64_dynarec_hotpage = 16; +int box64_dynarec_fastpage = 0; int box64_dynarec_bleeding_edge = 1; int box64_dynarec_wait = 1; uintptr_t box64_nodynarec_start = 0; @@ -563,6 +564,15 @@ void LoadLogEnv() else printf_log(LOG_INFO, "Dynarec will not tag HotPage\n"); } + p = getenv("BOX64_DYNAREC_FASTPAGE"); + if(p) { + if(strlen(p)==1) { + if(p[0]>='0' && p[0]<='1') + box64_dynarec_fastpage = p[0]-'0'; + } + if(box64_dynarec_fastpage) + printf_log(LOG_INFO, "Dynarec will use Fast HotPage\n"); + } p = getenv("BOX64_NODYNAREC"); if(p) { if (strchr(p,'-')) { diff --git a/src/tools/rcfile.c b/src/tools/rcfile.c index e3789a20..60e1a1e5 100644 --- a/src/tools/rcfile.c +++ b/src/tools/rcfile.c @@ -112,7 +112,8 @@ ENTRYINT(BOX64_DYNAREC_SAFEFLAGS, box64_dynarec_safeflags, 0, 2, 2) \ ENTRYBOOL(BOX64_DYNAREC_CALLRET, box64_dynarec_callret) \ ENTRYBOOL(BOX64_DYNAREC_BLEEDING_EDGE, box64_dynarec_bleeding_edge) \ ENTRYINT(BOX64_DYNAREC_HOTPAGE, box64_dynarec_hotpage, 0, 255, 8) \ -ENTRYBOOL(box64_dynarec_wait, box64_dynarec_wait) \ +ENTRYBOOL(BOX64_DYNAREC_FASTPAGE, box64_dynarec_fastpage) \ +ENTRYBOOL(BOX64_DYNAREC_WAIT, box64_dynarec_wait) \ ENTRYSTRING_(BOX64_NODYNAREC, box64_nodynarec) \ #else @@ -129,7 +130,8 @@ IGNORE(BOX64_DYNAREC_SAFEFLAGS) \ IGNORE(BOX64_DYNAREC_CALLRET) \ IGNORE(BOX64_DYNAREC_BLEEDING_EDGE) \ IGNORE(BOX64_DYNAREC_HOTPAGE) \ -IGNORE(BOX64_DYNAREC_wait) \ +IGNORE(BOX64_DYNAREC_FASTPAGE) \ +IGNORE(BOX64_DYNAREC_WAIT) \ IGNORE(BOX64_NODYNAREC) \ #endif @@ -354,7 +356,7 @@ void LoadRCFile(const char* filename) if(0) ; SUPER() else if(len && current_name) { - printf_log(LOG_INFO, "Warning, unsupported %s=%s for [%s] in %s", key, val, current_name, filename); + printf_log(LOG_INFO, "Warning, unsupported %s=%s for [%s] in %s\n", key, val, current_name, filename); } #undef ENTRYBOOL #undef CENTRYBOOL -- cgit 1.4.1