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.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20180413133041.29509.59064.stgit@pasha-VirtualBox>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
Pavel Dovgalyuk 2018-04-13 16:30:41 +03:00 committed by Laurent Vivier
parent 38e83a71d0
commit 000761dc0c
1 changed files with 18 additions and 15 deletions

View File

@ -287,6 +287,8 @@ static inline void do_stack_frame(CPUM68KState *env, uint32_t *sp,
uint16_t format, uint16_t sr,
uint32_t addr, uint32_t retaddr)
{
if (m68k_feature(env, M68K_FEATURE_QUAD_MULDIV)) {
/* all except 68000 */
CPUState *cs = CPU(m68k_env_get_cpu(env));
switch (format) {
case 4:
@ -303,6 +305,7 @@ static inline void do_stack_frame(CPUM68KState *env, uint32_t *sp,
}
*sp -= 2;
cpu_stw_kernel(env, *sp, (format << 12) + (cs->exception_index << 2));
}
*sp -= 4;
cpu_stl_kernel(env, *sp, retaddr);
*sp -= 2;