diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-03-19 02:30:22 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-03-19 02:30:22 +0100 |
| commit | 81ca016581003c6eea67b88af071af7d22d7e9c5 (patch) | |
| tree | 7741437c48bcc0a02129a56aedcfb803a29aa9c3 /src | |
| parent | cd8bda7a29a2ef15d939890cacab02efb84e0158 (diff) | |
| download | box64-81ca016581003c6eea67b88af071af7d22d7e9c5.tar.gz box64-81ca016581003c6eea67b88af071af7d22d7e9c5.zip | |
[DYNAREC] This should fix some issue with dynarec, like #1366 (but should be revisited soon, to many bytes writen there)
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynarec/dynarec_native.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/dynarec/dynarec_native.c b/src/dynarec/dynarec_native.c index 84e5d3dc..77badf62 100644 --- a/src/dynarec/dynarec_native.c +++ b/src/dynarec/dynarec_native.c @@ -393,6 +393,11 @@ static int updateNeed(dynarec_native_t* dyn, int ninst, uint8_t need) { } void* current_helper = NULL; +static int static_jmps[MAX_INSTS+2]; +static uintptr_t static_next[MAX_INSTS+2]; +static uint64_t static_table64[(MAX_INSTS+3)/4]; +static instruction_native_t static_insts[MAX_INSTS+2] = {0}; +// TODO: ninst could be a uint16_t instead of an int, that could same some temp. memory void CancelBlock64(int need_lock) { @@ -401,6 +406,7 @@ void CancelBlock64(int need_lock) dynarec_native_t* helper = (dynarec_native_t*)current_helper; current_helper = NULL; if(helper) { + memset(static_insts, 0, sizeof(static_insts)); if(helper->dynablock && helper->dynablock->actual_block) { FreeDynarecMap((uintptr_t)helper->dynablock->actual_block); helper->dynablock->actual_block = NULL; @@ -438,12 +444,6 @@ void* CreateEmptyBlock(dynablock_t* block, uintptr_t addr) { return block; } -static int static_jmps[MAX_INSTS+2]; -static uintptr_t static_next[MAX_INSTS+2]; -static uint64_t static_table64[(MAX_INSTS+3)/4]; -static instruction_native_t static_insts[MAX_INSTS+2] = {0}; -// TODO: ninst could be a uint16_t instead of an int, that could same some temp. memory - void* FillBlock64(dynablock_t* block, uintptr_t addr, int alternate, int is32bits) { /* A Block must have this layout: @@ -674,6 +674,7 @@ void* FillBlock64(dynablock_t* block, uintptr_t addr, int alternate, int is32bit } // ok, free the helper now //dynaFree(helper.insts); + memset(static_insts, 0, sizeof(static_insts)); helper.insts = NULL; if(insts_rsize/sizeof(instsize_t)<helper.insts_size) { printf_log(LOG_NONE, "BOX64: Warning, insts_size difference in block between pass2 (%zu) and pass3 (%zu), allocated: %zu\n", oldinstsize, helper.insts_size, insts_rsize/sizeof(instsize_t)); |