target/m68k: Switch over exception type in m68k_interrupt_all
Replace an if ladder with a switch for clarity. Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220602013401.303699-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
79e1d527e1
commit
02ea42b36d
@ -333,7 +333,8 @@ static void m68k_interrupt_all(CPUM68KState *env, int is_hw)
|
||||
sp &= ~1;
|
||||
}
|
||||
|
||||
if (cs->exception_index == EXCP_ACCESS) {
|
||||
switch (cs->exception_index) {
|
||||
case EXCP_ACCESS:
|
||||
if (env->mmu.fault) {
|
||||
cpu_abort(cs, "DOUBLE MMU FAULT\n");
|
||||
}
|
||||
@ -391,29 +392,39 @@ static void m68k_interrupt_all(CPUM68KState *env, int is_hw)
|
||||
"ssw: %08x ea: %08x sfc: %d dfc: %d\n",
|
||||
env->mmu.ssw, env->mmu.ar, env->sfc, env->dfc);
|
||||
}
|
||||
} else if (cs->exception_index == EXCP_ADDRESS) {
|
||||
break;
|
||||
|
||||
case EXCP_ADDRESS:
|
||||
do_stack_frame(env, &sp, 2, oldsr, 0, retaddr);
|
||||
} else if (cs->exception_index == EXCP_ILLEGAL ||
|
||||
cs->exception_index == EXCP_DIV0 ||
|
||||
cs->exception_index == EXCP_CHK ||
|
||||
cs->exception_index == EXCP_TRAPCC ||
|
||||
cs->exception_index == EXCP_TRACE) {
|
||||
break;
|
||||
|
||||
case EXCP_ILLEGAL:
|
||||
case EXCP_DIV0:
|
||||
case EXCP_CHK:
|
||||
case EXCP_TRAPCC:
|
||||
case EXCP_TRACE:
|
||||
/* FIXME: addr is not only env->pc */
|
||||
do_stack_frame(env, &sp, 2, oldsr, env->pc, retaddr);
|
||||
} else if (is_hw && oldsr & SR_M &&
|
||||
cs->exception_index >= EXCP_SPURIOUS &&
|
||||
cs->exception_index <= EXCP_INT_LEVEL_7) {
|
||||
do_stack_frame(env, &sp, 0, oldsr, 0, retaddr);
|
||||
oldsr = sr;
|
||||
env->aregs[7] = sp;
|
||||
cpu_m68k_set_sr(env, sr &= ~SR_M);
|
||||
sp = env->aregs[7];
|
||||
if (!m68k_feature(env, M68K_FEATURE_UNALIGNED_DATA)) {
|
||||
sp &= ~1;
|
||||
break;
|
||||
|
||||
case EXCP_SPURIOUS ... EXCP_INT_LEVEL_7:
|
||||
if (is_hw && oldsr & SR_M) {
|
||||
do_stack_frame(env, &sp, 0, oldsr, 0, retaddr);
|
||||
oldsr = sr;
|
||||
env->aregs[7] = sp;
|
||||
cpu_m68k_set_sr(env, sr &= ~SR_M);
|
||||
sp = env->aregs[7];
|
||||
if (!m68k_feature(env, M68K_FEATURE_UNALIGNED_DATA)) {
|
||||
sp &= ~1;
|
||||
}
|
||||
do_stack_frame(env, &sp, 1, oldsr, 0, retaddr);
|
||||
break;
|
||||
}
|
||||
do_stack_frame(env, &sp, 1, oldsr, 0, retaddr);
|
||||
} else {
|
||||
/* fall through */
|
||||
|
||||
default:
|
||||
do_stack_frame(env, &sp, 0, oldsr, 0, retaddr);
|
||||
break;
|
||||
}
|
||||
|
||||
env->aregs[7] = sp;
|
||||
|
Loading…
Reference in New Issue
Block a user