Skip to content

Commit d7d5601

Browse files
iii-irth7680
authored andcommitted
linux-user/microblaze: Handle privileged exception
Follow what kernel's full_exception() is doing. Reviewed-by: Richard Henderson <[email protected]> Signed-off-by: Ilya Leoshkevich <[email protected]> Message-Id: <[email protected]> Signed-off-by: Richard Henderson <[email protected]>
1 parent df8a688 commit d7d5601

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

linux-user/microblaze/cpu_loop.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525

2626
void cpu_loop(CPUMBState *env)
2727
{
28+
int trapnr, ret, si_code, sig;
2829
CPUState *cs = env_cpu(env);
29-
int trapnr, ret, si_code;
3030

3131
while (1) {
3232
cpu_exec_start(cs);
@@ -76,6 +76,7 @@ void cpu_loop(CPUMBState *env)
7676
env->iflags &= ~(IMM_FLAG | D_FLAG);
7777
switch (env->esr & 31) {
7878
case ESR_EC_DIVZERO:
79+
sig = TARGET_SIGFPE;
7980
si_code = TARGET_FPE_INTDIV;
8081
break;
8182
case ESR_EC_FPU:
@@ -84,6 +85,7 @@ void cpu_loop(CPUMBState *env)
8485
* if there's no recognized bit set. Possibly this
8586
* implies that si_code is 0, but follow the structure.
8687
*/
88+
sig = TARGET_SIGFPE;
8789
si_code = env->fsr;
8890
if (si_code & FSR_IO) {
8991
si_code = TARGET_FPE_FLTINV;
@@ -97,13 +99,17 @@ void cpu_loop(CPUMBState *env)
9799
si_code = TARGET_FPE_FLTRES;
98100
}
99101
break;
102+
case ESR_EC_PRIVINSN:
103+
sig = SIGILL;
104+
si_code = ILL_PRVOPC;
105+
break;
100106
default:
101107
fprintf(stderr, "Unhandled hw-exception: 0x%x\n",
102108
env->esr & ESR_EC_MASK);
103109
cpu_dump_state(cs, stderr, 0);
104110
exit(EXIT_FAILURE);
105111
}
106-
force_sig_fault(TARGET_SIGFPE, si_code, env->pc);
112+
force_sig_fault(sig, si_code, env->pc);
107113
break;
108114

109115
case EXCP_DEBUG:

0 commit comments

Comments
 (0)