Skip to content

Commit

Permalink
[DYNAREC] Small changes on pagesize and hotpage
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed Dec 2, 2022
1 parent 9f3ea84 commit 86dbf08
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/custommem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 2 additions & 3 deletions src/dynarec/dynarec_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/include/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 86dbf08

Please sign in to comment.