linux-user/xtensa: Use force_sig_fault
Use the new function instead of setting up a target_siginfo_t and calling queue_signal. Fill in the missing PC for SIGTRAP. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220107213243.212806-25-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
ac80d8b151
commit
2dd4634963
@ -126,7 +126,6 @@ static void xtensa_underflow12(CPUXtensaState *env)
|
|||||||
void cpu_loop(CPUXtensaState *env)
|
void cpu_loop(CPUXtensaState *env)
|
||||||
{
|
{
|
||||||
CPUState *cs = env_cpu(env);
|
CPUState *cs = env_cpu(env);
|
||||||
target_siginfo_t info;
|
|
||||||
abi_ulong ret;
|
abi_ulong ret;
|
||||||
int trapnr;
|
int trapnr;
|
||||||
|
|
||||||
@ -163,14 +162,12 @@ void cpu_loop(CPUXtensaState *env)
|
|||||||
case EXC_USER:
|
case EXC_USER:
|
||||||
switch (env->sregs[EXCCAUSE]) {
|
switch (env->sregs[EXCCAUSE]) {
|
||||||
case ILLEGAL_INSTRUCTION_CAUSE:
|
case ILLEGAL_INSTRUCTION_CAUSE:
|
||||||
|
force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC,
|
||||||
|
env->sregs[EPC1]);
|
||||||
|
break;
|
||||||
case PRIVILEGED_CAUSE:
|
case PRIVILEGED_CAUSE:
|
||||||
info.si_signo = TARGET_SIGILL;
|
force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC,
|
||||||
info.si_errno = 0;
|
env->sregs[EPC1]);
|
||||||
info.si_code =
|
|
||||||
env->sregs[EXCCAUSE] == ILLEGAL_INSTRUCTION_CAUSE ?
|
|
||||||
TARGET_ILL_ILLOPC : TARGET_ILL_PRVOPC;
|
|
||||||
info._sifields._sigfault._addr = env->sregs[EPC1];
|
|
||||||
queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SYSCALL_CAUSE:
|
case SYSCALL_CAUSE:
|
||||||
@ -219,11 +216,8 @@ void cpu_loop(CPUXtensaState *env)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case INTEGER_DIVIDE_BY_ZERO_CAUSE:
|
case INTEGER_DIVIDE_BY_ZERO_CAUSE:
|
||||||
info.si_signo = TARGET_SIGFPE;
|
force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTDIV,
|
||||||
info.si_errno = 0;
|
env->sregs[EPC1]);
|
||||||
info.si_code = TARGET_FPE_INTDIV;
|
|
||||||
info._sifields._sigfault._addr = env->sregs[EPC1];
|
|
||||||
queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -232,10 +226,8 @@ void cpu_loop(CPUXtensaState *env)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXCP_DEBUG:
|
case EXCP_DEBUG:
|
||||||
info.si_signo = TARGET_SIGTRAP;
|
force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT,
|
||||||
info.si_errno = 0;
|
env->sregs[EPC1]);
|
||||||
info.si_code = TARGET_TRAP_BRKPT;
|
|
||||||
queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
|
|
||||||
break;
|
break;
|
||||||
case EXC_DEBUG:
|
case EXC_DEBUG:
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user