linux-user/sh4: Deliver SIGILL on invalid instruction
PATCH v2 1/1 linux-user/sh4: Deliver SIGILL on invalid instruction
On invalid instruction, deliver SIGILL rather than crashing the whole process unconditionally.
Signed-off-by Mikulas Patocka <[email protected]>
--- linux-user/sh4/cpu_loop.c | 7 +++++++ 1 file changed, 7 insertions(+)
linux-user/sh4/cpu_loop.c +7 -0
@@ -64,6 +64,13 @@ void cpu_loop(CPUSH4State *env)cpu_exec_step_atomic (cs); arch_interrupt = false;break ; +case 0x180 : +/* Illegal instruction */ +/* fallthrough */ +case 0x1a0 : +/* Illegal instruction in delay slot */ +force_sig_fault (TARGET_SIGILL ,TARGET_ILL_ILLOPC , env->pc); +break ;default :fprintf (stderr,"Unhandled trap: 0x%x\n" , trapnr);cpu_dump_state (cs, stderr,0 );
Quoted 19 lines · Mikulas Patocka
On invalid instruction, deliver SIGILL rather than crashing the whole process unconditionally.
Signed-off-by Mikulas Patocka <[email protected]>--- linux-user/sh4/cpu_loop.c | 7 +++++++ 1 file changed, 7 insertions(+)Index:
qemu/linux-user/sh4/cpu_loop.c
===================================================================linux-user/sh4/cpu_loop.c +0
-0@@ -64,6 +64,13 @@ void cpu_loop(CPUSH4State *env)cpu_exec_step_atomic (cs); arch_interrupt = false;break ;
linux-user/sh4/cpu_loop.c void cpu_loop(CPUSH4State *env) · line 76
Quoted 10 lines
linux-user/sh4/cpu_loop.c +7
-0+case 0x180 : +/* Illegal instruction */ +/* fallthrough */ +case 0x1a0 : +/* Illegal instruction in delay slot */ +force_sig_fault (TARGET_SIGILL ,TARGET_ILL_ILLOPC , env->pc); +break ;default :fprintf (stderr,"Unhandled trap: 0x%x\n" , trapnr);cpu_dump_state (cs, stderr,0 );
Reviewed-by Richard Henderson <[email protected]>
r~
Quoted 20 lines · Mikulas Patocka
On invalid instruction, deliver SIGILL rather than crashing the whole process unconditionally.
Signed-off-by Mikulas Patocka <[email protected]>--- linux-user/sh4/cpu_loop.c | 7 +++++++ 1 file changed, 7 insertions(+)Index:
qemu/linux-user/sh4/cpu_loop.c
===================================================================linux-user/sh4/cpu_loop.c +0
-0@@ -64,6 +64,13 @@ void cpu_loop(CPUSH4State *env)cpu_exec_step_atomic (cs); arch_interrupt = false;break ;
linux-user/sh4/cpu_loop.c void cpu_loop(CPUSH4State *env) · line 76
Quoted 10 lines
linux-user/sh4/cpu_loop.c +7
-0+case 0x180 : +/* Illegal instruction */ +/* fallthrough */ +case 0x1a0 : +/* Illegal instruction in delay slot */ +force_sig_fault (TARGET_SIGILL ,TARGET_ILL_ILLOPC , env->pc); +break ;default :fprintf (stderr,"Unhandled trap: 0x%x\n" , trapnr);cpu_dump_state (cs, stderr,0 );
Reviewed-by Yoshinori Sato <[email protected]>
Signature · 1 line
Yosinori Sato