about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2025-01-11 19:03:55 +0800
committerGitHub <noreply@github.com>2025-01-11 12:03:55 +0100
commit2b66675a08f7f56eb5840330247484f56cdf685a (patch)
tree0af5cd2ebf5cc9f4cb32f089404893608c589039 /src
parent93638ac95a2be960bb825f1f4d817b2b7e9b0738 (diff)
downloadbox64-2b66675a08f7f56eb5840330247484f56cdf685a.tar.gz
box64-2b66675a08f7f56eb5840330247484f56cdf685a.zip
[RV64_DYNAREC] Fixed a 16bit SHR pastpath edge case (#2251)
Diffstat (limited to 'src')
-rw-r--r--src/dynarec/rv64/dynarec_rv64_66.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/dynarec/rv64/dynarec_rv64_66.c b/src/dynarec/rv64/dynarec_rv64_66.c
index 1de9a9b7..45a3a3a9 100644
--- a/src/dynarec/rv64/dynarec_rv64_66.c
+++ b/src/dynarec/rv64/dynarec_rv64_66.c
@@ -1124,9 +1124,13 @@ uintptr_t dynarec64_66(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
                             // save an srli instruction...
                             wback = TO_NAT((nextop & 7) + (rex.b << 3));
                             u8 = (F8) & 0x1f;
-                            SLLI(x1, wback, 48);
-                            SRLI(x1, x1, 48 + u8);
-                            ed = x1;
+                            if (u8 > 15) {
+                                ed = xZR;
+                            } else {
+                                SLLI(x1, wback, 48);
+                                SRLI(x1, x1, 48 + u8);
+                                ed = x1;
+                            }
                             wb1 = 0;
                             EWBACK;
                             if (dyn->insts[ninst].nat_flags_fusion) NAT_FLAGS_OPS(ed, xZR);