about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-05-02 23:27:18 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-05-02 23:27:18 +0200
commitf1da71a8fe019368826d4cd50a7fdcf55c99d849 (patch)
treece2ae924d0a0d53793882856b2b680a7855e602e
parentefd182971a1f5b1de20912c6b61c84aac598dd2d (diff)
downloadbox64-f1da71a8fe019368826d4cd50a7fdcf55c99d849.tar.gz
box64-f1da71a8fe019368826d4cd50a7fdcf55c99d849.zip
[DYNAREC] Stop a block when a unimplemented opcode is found
-rw-r--r--src/dynarec/dynarec_native_pass.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dynarec/dynarec_native_pass.c b/src/dynarec/dynarec_native_pass.c
index e03b6655..39ee7a7b 100644
--- a/src/dynarec/dynarec_native_pass.c
+++ b/src/dynarec/dynarec_native_pass.c
@@ -217,11 +217,11 @@ uintptr_t native_pass(dynarec_native_t* dyn, uintptr_t addr, int alternate, int
         int ok_to_continue = (getProtection(addr) && getProtection(addr+1));
         if(ok && (!ok_to_continue || !(*(uint16_t*)addr))) {
             if(box64_dynarec_dump) dynarec_log(LOG_NONE, "Stopping block at %p reason: %s\n", (void*)addr, ok_to_continue?"Address is not readable":"Next opcode is 00 00");
-            ok = 0;
+            ok = ok_to_continue?0:-1;
             need_epilog = 1;
         }
         if(dyn->forward) {
-            if(dyn->forward_to == addr && !need_epilog && ok_to_continue) {
+            if(dyn->forward_to == addr && !need_epilog && ok_to_continue && ok>=0) {
                 // we made it!
                 reset_n = get_first_jump(dyn, addr);
                 if(box64_dynarec_dump) dynarec_log(LOG_NONE, "Forward extend block for %d bytes %s%p -> %p (ninst %d - %d)\n", dyn->forward_to-dyn->forward, dyn->insts[dyn->forward_ninst].x64.has_callret?"(opt. call) ":"", (void*)dyn->forward, (void*)dyn->forward_to, reset_n, ninst);