From a577fac1c59e159d86c722beeee2f149b38de39e Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 18 Jan 2024 11:59:39 +0100 Subject: [DYNAREC] Test when changing page on building a dynablock if it's safe --- src/dynarec/dynarec_native_pass.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/dynarec/dynarec_native_pass.c b/src/dynarec/dynarec_native_pass.c index 5686e322..75fa35e1 100644 --- a/src/dynarec/dynarec_native_pass.c +++ b/src/dynarec/dynarec_native_pass.c @@ -26,6 +26,12 @@ #error No STEP defined #endif +#if STEP == 0 +#ifndef PROT_READ +#define PROT_READ 0x1 +#endif +#endif + uintptr_t native_pass(dynarec_native_t* dyn, uintptr_t addr, int alternate, int is32bits) { int ok = 1; @@ -50,7 +56,19 @@ uintptr_t native_pass(dynarec_native_t* dyn, uintptr_t addr, int alternate, int int stopblock = 2+(FindElfAddress(my_context, addr)?0:1); // if block is in elf_memory, it can be extended with box64_dynarec_bigblock==2, else it needs 3 // ok, go now INIT; + #if STEP == 0 + uintptr_t cur_page = (addr)&~box64_pagesize; + #endif while(ok) { + #if STEP == 0 + if(cur_page != (addr)&~box64_pagesize) { + cur_page = (addr)&~box64_pagesize; + if(!(getProtection(addr)&PROT_READ)) { + need_epilog = 1; + break; + } + } + #endif ip = addr; if (reset_n!=-1) { dyn->last_ip = 0; -- cgit 1.4.1