summary refs log tree commit diff stats
path: root/linux-user/mips/cpu_loop.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2023-09-28 21:55:20 +0200
committerRichard Henderson <richard.henderson@linaro.org>2023-10-18 15:32:16 -0700
commit6fad9b4bb91dcc824f9c00a36ee843883b58313b (patch)
treef4cd35611ee0b219b1430288f07e7c8770eb5093 /linux-user/mips/cpu_loop.c
parente6e66b03287331abc6f184456dbc6d25505590ec (diff)
downloadfocaccia-qemu-6fad9b4bb91dcc824f9c00a36ee843883b58313b.tar.gz
focaccia-qemu-6fad9b4bb91dcc824f9c00a36ee843883b58313b.zip
linux-user/mips: fix abort on integer overflow
QEMU mips userspace emulation crashes with "qemu: unhandled CPU exception
0x15 - aborting" when one of the integer arithmetic instructions detects
an overflow.

This patch fixes it so that it delivers SIGFPE with FPE_INTOVF instead.

Cc: qemu-stable@nongnu.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Message-Id: <3ef979a8-3ee1-eb2d-71f7-d788ff88dd11@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'linux-user/mips/cpu_loop.c')
-rw-r--r--linux-user/mips/cpu_loop.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c
index 8735e58bad..990b03e727 100644
--- a/linux-user/mips/cpu_loop.c
+++ b/linux-user/mips/cpu_loop.c
@@ -180,7 +180,9 @@ done_syscall:
             }
             force_sig_fault(TARGET_SIGFPE, si_code, env->active_tc.PC);
             break;
-
+	case EXCP_OVERFLOW:
+            force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTOVF, env->active_tc.PC);
+            break;
         /* The code below was inspired by the MIPS Linux kernel trap
          * handling code in arch/mips/kernel/traps.c.
          */