diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-01-18 11:59:39 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-01-18 11:59:39 +0100 |
| commit | a577fac1c59e159d86c722beeee2f149b38de39e (patch) | |
| tree | 9bc565bff3d70c7790cae3825a0a46eb2c8c1999 /src/dynarec/dynarec_native_pass.c | |
| parent | d08abf05ffea3b1c686358c5c8a78aa8489e6ef9 (diff) | |
| download | box64-a577fac1c59e159d86c722beeee2f149b38de39e.tar.gz box64-a577fac1c59e159d86c722beeee2f149b38de39e.zip | |
[DYNAREC] Test when changing page on building a dynablock if it's safe
Diffstat (limited to 'src/dynarec/dynarec_native_pass.c')
| -rw-r--r-- | src/dynarec/dynarec_native_pass.c | 18 |
1 files changed, 18 insertions, 0 deletions
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; |