From: Richard Henderson Date: Thu, 21 Apr 2022 15:17:29 +0000 (-0700) Subject: linux-user/nios2: Handle various SIGILL exceptions X-Git-Tag: v7.1.0-rc0~128^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3747727aad1841bd07b7c9588b6d9b32182b1121;p=thirdparty%2Fqemu.git linux-user/nios2: Handle various SIGILL exceptions We missed out on a couple of exception types that may legitimately be raised by a userland program. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-Id: <20220421151735.31996-59-richard.henderson@linaro.org> --- diff --git a/linux-user/nios2/cpu_loop.c b/linux-user/nios2/cpu_loop.c index a5e86990e2d..da77ede76bd 100644 --- a/linux-user/nios2/cpu_loop.c +++ b/linux-user/nios2/cpu_loop.c @@ -50,6 +50,18 @@ void cpu_loop(CPUNios2State *env) env->ctrl[CR_BADADDR]); break; + case EXCP_ILLEGAL: + case EXCP_UNIMPL: + /* Match kernel's handle_illegal_c(). */ + env->pc -= 4; + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->pc); + break; + case EXCP_SUPERI: + /* Match kernel's handle_supervisor_instr(). */ + env->pc -= 4; + force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, env->pc); + break; + case EXCP_TRAP: switch (env->error_code) { case 0: