mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-24 15:18:08 +00:00
m68k: fix exception stack frame for 68000
68000 CPUs do not save format in the exception stack frame. This patch adds feature checking to prevent format saving for 68000. m68k_ret() already includes this modification, this patch fixes the exception processing function too. Backports commit 000761dc0c97d70e7314db3e8f52783880325a22 from qemu
This commit is contained in:
parent
9517a002da
commit
fe353764e9
1 changed files with 18 additions and 15 deletions
|
@ -280,22 +280,25 @@ static inline void do_stack_frame(CPUM68KState *env, uint32_t *sp,
|
|||
uint16_t format, uint16_t sr,
|
||||
uint32_t addr, uint32_t retaddr)
|
||||
{
|
||||
CPUState *cs = CPU(m68k_env_get_cpu(env));
|
||||
switch (format) {
|
||||
case 4:
|
||||
*sp -= 4;
|
||||
cpu_stl_kernel(env, *sp, env->pc);
|
||||
*sp -= 4;
|
||||
cpu_stl_kernel(env, *sp, addr);
|
||||
break;
|
||||
case 3:
|
||||
case 2:
|
||||
*sp -= 4;
|
||||
cpu_stl_kernel(env, *sp, addr);
|
||||
break;
|
||||
if (m68k_feature(env, M68K_FEATURE_QUAD_MULDIV)) {
|
||||
/* all except 68000 */
|
||||
CPUState *cs = CPU(m68k_env_get_cpu(env));
|
||||
switch (format) {
|
||||
case 4:
|
||||
*sp -= 4;
|
||||
cpu_stl_kernel(env, *sp, env->pc);
|
||||
*sp -= 4;
|
||||
cpu_stl_kernel(env, *sp, addr);
|
||||
break;
|
||||
case 3:
|
||||
case 2:
|
||||
*sp -= 4;
|
||||
cpu_stl_kernel(env, *sp, addr);
|
||||
break;
|
||||
}
|
||||
*sp -= 2;
|
||||
cpu_stw_kernel(env, *sp, (format << 12) + (cs->exception_index << 2));
|
||||
}
|
||||
*sp -= 2;
|
||||
cpu_stw_kernel(env, *sp, (format << 12) + (cs->exception_index << 2));
|
||||
*sp -= 4;
|
||||
cpu_stl_kernel(env, *sp, retaddr);
|
||||
*sp -= 2;
|
||||
|
|
Loading…
Reference in a new issue