diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2023-02-19 23:54:00 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2023-02-19 23:54:00 +0100 |
| commit | d06ff478d188eb4a077041e4b2b628f75ed9eaf8 (patch) | |
| tree | afeb72b0d96281ae9f53497e86baf98fac718da9 /src/dynarec/dynablock.c | |
| parent | 83db04cdce694727c9b3bbb680b54feaae51d98a (diff) | |
| download | box64-d06ff478d188eb4a077041e4b2b628f75ed9eaf8.tar.gz box64-d06ff478d188eb4a077041e4b2b628f75ed9eaf8.zip | |
[DYNAREC] Introduced BOX64_DYNAREC_FASTPAGE to use an alternate way to handle HotPages (faster but crashy)
Diffstat (limited to 'src/dynarec/dynablock.c')
| -rwxr-xr-x | src/dynarec/dynablock.c | 15 |
1 files changed, 13 insertions, 2 deletions
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)) { |