From 7525a9b94c0c5733b8450c9451ca1de334f71ed8 Mon Sep 17 00:00:00 2001 From: Lucien Murray-Pitts Date: Mon, 1 Feb 2021 01:01:52 +0100 Subject: m68k: add MSP detection support for stack pointer swap helpers On m68k there are two varities of stack pointers: USP with SSP or ISP/MSP. Only the 68020/30/40 support the MSP register the stack swap helpers don't support this feature. This patch adds this support, as well as comments to CPUM68KState to make it clear how stacks are handled Signed-off-by: Lucien Murray-Pitts Signed-off-by: BALATON Zoltan Message-Id: Signed-off-by: Laurent Vivier --- target/m68k/helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'target/m68k/helper.c') diff --git a/target/m68k/helper.c b/target/m68k/helper.c index 1efd6e4f65..4185ca94ce 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -463,7 +463,8 @@ void m68k_switch_sp(CPUM68KState *env) env->sp[env->current_sp] = env->aregs[7]; if (m68k_feature(env, M68K_FEATURE_M68000)) { if (env->sr & SR_S) { - if (env->sr & SR_M) { + /* SR:Master-Mode bit unimplemented then ISP is not available */ + if (!m68k_feature(env, M68K_FEATURE_MSP) || env->sr & SR_M) { new_sp = M68K_SSP; } else { new_sp = M68K_ISP; -- cgit v1.2.3