mirror of https://github.com/xemu-project/xemu.git
linux-user/microblaze: Handle privileged exception
Follow what kernel's full_exception() is doing. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20230214140829.45392-4-iii@linux.ibm.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
df8a688032
commit
d7d5601c78
|
@ -25,8 +25,8 @@
|
||||||
|
|
||||||
void cpu_loop(CPUMBState *env)
|
void cpu_loop(CPUMBState *env)
|
||||||
{
|
{
|
||||||
|
int trapnr, ret, si_code, sig;
|
||||||
CPUState *cs = env_cpu(env);
|
CPUState *cs = env_cpu(env);
|
||||||
int trapnr, ret, si_code;
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
cpu_exec_start(cs);
|
cpu_exec_start(cs);
|
||||||
|
@ -76,6 +76,7 @@ void cpu_loop(CPUMBState *env)
|
||||||
env->iflags &= ~(IMM_FLAG | D_FLAG);
|
env->iflags &= ~(IMM_FLAG | D_FLAG);
|
||||||
switch (env->esr & 31) {
|
switch (env->esr & 31) {
|
||||||
case ESR_EC_DIVZERO:
|
case ESR_EC_DIVZERO:
|
||||||
|
sig = TARGET_SIGFPE;
|
||||||
si_code = TARGET_FPE_INTDIV;
|
si_code = TARGET_FPE_INTDIV;
|
||||||
break;
|
break;
|
||||||
case ESR_EC_FPU:
|
case ESR_EC_FPU:
|
||||||
|
@ -84,6 +85,7 @@ void cpu_loop(CPUMBState *env)
|
||||||
* if there's no recognized bit set. Possibly this
|
* if there's no recognized bit set. Possibly this
|
||||||
* implies that si_code is 0, but follow the structure.
|
* implies that si_code is 0, but follow the structure.
|
||||||
*/
|
*/
|
||||||
|
sig = TARGET_SIGFPE;
|
||||||
si_code = env->fsr;
|
si_code = env->fsr;
|
||||||
if (si_code & FSR_IO) {
|
if (si_code & FSR_IO) {
|
||||||
si_code = TARGET_FPE_FLTINV;
|
si_code = TARGET_FPE_FLTINV;
|
||||||
|
@ -97,13 +99,17 @@ void cpu_loop(CPUMBState *env)
|
||||||
si_code = TARGET_FPE_FLTRES;
|
si_code = TARGET_FPE_FLTRES;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ESR_EC_PRIVINSN:
|
||||||
|
sig = SIGILL;
|
||||||
|
si_code = ILL_PRVOPC;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unhandled hw-exception: 0x%x\n",
|
fprintf(stderr, "Unhandled hw-exception: 0x%x\n",
|
||||||
env->esr & ESR_EC_MASK);
|
env->esr & ESR_EC_MASK);
|
||||||
cpu_dump_state(cs, stderr, 0);
|
cpu_dump_state(cs, stderr, 0);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
force_sig_fault(TARGET_SIGFPE, si_code, env->pc);
|
force_sig_fault(sig, si_code, env->pc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXCP_DEBUG:
|
case EXCP_DEBUG:
|
||||||
|
|
Loading…
Reference in New Issue