From a0c939f81e445661bde72de3c124821e4fdea005 Mon Sep 17 00:00:00 2001 From: yuerengan Date: Fri, 29 May 2026 16:42:17 +0800 Subject: [PATCH 1/2] Fix: Incorrect behavior when LIBLASX2LSX_INTERPRET_MODE is "emu" or "one" Previously, setting the environment variable LIBLASX2LSX_INTERPRET_MODE to "emu" or "one" would mistakenly trigger the block mode path instead of the intended mode. This commit corrects the logic to properly handle these values. Signed-off-by: yuerengan --- src/interpret/lasx_interpret.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interpret/lasx_interpret.c b/src/interpret/lasx_interpret.c index 9bfef84..8069f65 100644 --- a/src/interpret/lasx_interpret.c +++ b/src/interpret/lasx_interpret.c @@ -130,7 +130,7 @@ extern int lasx_interpret_mode; bool lasx_emu_create_interpret_block(ucontext_t *uc) { - if (interpreter == NULL) return false; + if (interpreter == NULL || !lasx_interpret_mode) return false; interpret_lock(); From 7010c472c6181219f206ede0b6ac1679958ff5dd Mon Sep 17 00:00:00 2001 From: yuerengan Date: Sat, 30 May 2026 16:26:33 +0800 Subject: [PATCH 2/2] Fix: SIGILL raised by jiscr1, retrying succeeds The jiscr1 instruction sometimes triggers an illegal instruction(SIGILL) error. However, re-executing the same instruction can succeed. The root cause has not been identified yet. This is a temporary workaround. Signed-off-by: yuerengan --- src/emu/sigill_hook.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/emu/sigill_hook.c b/src/emu/sigill_hook.c index cad5edc..dc5e81a 100644 --- a/src/emu/sigill_hook.c +++ b/src/emu/sigill_hook.c @@ -51,13 +51,18 @@ void sigill_handler(int sig, siginfo_t *info, void *context) { // 获取当前触发异常的指令地址 #if defined(__loongarch__) + unsigned long pc_val = ucontext->uc_mcontext.__pc; + unsigned int instr = *(unsigned int *)pc_val; + + if ((instr & 0x48000300) == 0x48000300) { + //重新执行jiscr1 + return; + } + if (lasx_emu_create_interpret_fragment(ucontext)) { return; } if (lasx_emu_create_interpret_block(ucontext)) { return; } - unsigned long pc_val = ucontext->uc_mcontext.__pc; - unsigned int instr = *(unsigned int *)pc_val; - if(lasx_emu_create_interpret(ucontext, instr)) { return; }