From 86dbf089ccb26c9b12f0130294d16c367a7a73c5 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 2 Dec 2022 11:51:34 +0100 Subject: [PATCH] [DYNAREC] Small changes on pagesize and hotpage --- src/custommem.c | 2 +- src/dynarec/dynarec_native.c | 5 ++--- src/include/debug.h | 2 +- src/main.c | 6 +++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/custommem.c b/src/custommem.c index a6f2693fc..ec11207d8 100644 --- a/src/custommem.c +++ b/src/custommem.c @@ -957,7 +957,7 @@ int isprotectedDB(uintptr_t addr, size_t size) } for (uintptr_t i=idx; i<=end; ++i) { uint32_t prot = memprot[i>>16].prot[i&0xffff]; - if(!(prot&PROT_DYNAREC || prot&PROT_DYNAREC_R)) { + if(!(prot&(PROT_DYNAREC|PROT_DYNAREC_R))) { dynarec_log(LOG_DEBUG, "0\n"); return 0; } diff --git a/src/dynarec/dynarec_native.c b/src/dynarec/dynarec_native.c index 2f58b2d8e..d8ac671c8 100755 --- a/src/dynarec/dynarec_native.c +++ b/src/dynarec/dynarec_native.c @@ -462,7 +462,7 @@ void* FillBlock64(dynablock_t* block, uintptr_t addr) { return NULL; } // protect the block of it goes over the 1st page - if((addr&~0xfff)!=(end&~0xfff)) // need to protect some other pages too + if((addr&~box64_pagesize)!=(end&~box64_pagesize)) // need to protect some other pages too protectDB(addr, end-addr); //end is 1byte after actual end // compute hash signature uint32_t hash = X31_hash_code((void*)addr, end-addr); @@ -592,8 +592,7 @@ void* FillBlock64(dynablock_t* block, uintptr_t addr) { if(!isprotectedDB(addr, end-addr)) { dynarec_log(LOG_DEBUG, "Warning, block unprotected while beeing processed %p:%ld, cancelling\n", block->x64_addr, block->x64_size); AddHotPage(addr); - CancelBlock64(); - return NULL; + block->need_test = 1; //protectDB(addr, end-addr); } current_helper = NULL; diff --git a/src/include/debug.h b/src/include/debug.h index c3a6a35aa..6db06b9e7 100755 --- a/src/include/debug.h +++ b/src/include/debug.h @@ -7,7 +7,7 @@ extern int box64_log; // log level extern int box64_dump; // dump elf or not extern int box64_dynarec_log; extern int box64_dynarec; -extern int box64_pagesize; +extern uintptr_t box64_pagesize; extern uintptr_t box64_load_addr; #ifdef DYNAREC extern int box64_dynarec_dump; diff --git a/src/main.c b/src/main.c index e5d2c5d71..e7bc7d399 100755 --- a/src/main.c +++ b/src/main.c @@ -40,7 +40,7 @@ int box64_log = LOG_INFO; //LOG_NONE; int box64_dump = 0; int box64_nobanner = 0; int box64_dynarec_log = LOG_NONE; -int box64_pagesize; +uintptr_t box64_pagesize; uintptr_t box64_load_addr = 0; #ifdef DYNAREC int box64_dynarec = 1; @@ -312,12 +312,12 @@ HWCAP2_ECV printf_log(LOG_INFO, " PMULL"); if(arm64_atomics) printf_log(LOG_INFO, " ATOMICS"); - printf_log(LOG_INFO, " PageSize:%d", box64_pagesize); + printf_log(LOG_INFO, " PageSize:%zd", box64_pagesize); int ncpu = getNCpu(); printf_log(LOG_INFO, " Cores:%d\n", ncpu); #elif defined(LA464) printf_log(LOG_INFO, "Dynarec for LoongArch"); - printf_log(LOG_INFO, " PageSize:%d\n", box64_pagesize); + printf_log(LOG_INFO, " PageSize:%zd\n", box64_pagesize); #else #error Unsupported architecture #endif