From: Lucien Murray-Pitts <lucienmp.qemu@gmail.com>
To: qemu-devel@nongnu.org, Laurent Vivier <laurent@vivier.eu>,
Lucien Murray-Pitts <lucienmp.qemu@gmail.com>
Subject: [Qemu-devel] [PATCH 6/6] Added MSP detection support for stack pointer swap helpers
Date: Sun, 16 Jun 2019 23:23:07 +0900 [thread overview]
Message-ID: <20190616142307.GA71211@localhost.localdomain> (raw)
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 dont
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 <lucienmp.qemu@gmail.com>
---
target/m68k/cpu.c | 1 +
target/m68k/cpu.h | 8 +++++++-
target/m68k/helper.c | 3 ++-
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
index 50260de97d..f1610e2745 100644
--- a/target/m68k/cpu.c
+++ b/target/m68k/cpu.c
@@ -137,6 +137,7 @@ static void m68010_cpu_initfn(Object *obj)
m68k_set_feature(env, M68K_FEATURE_M68010);
m68k_set_feature(env, M68K_FEATURE_RTD);
m68k_set_feature(env, M68K_FEATURE_BKPT);
+ m68k_set_feature(env, M68K_FEATURE_MSP);
}
diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h
index 86ba19f779..7a8e4872e2 100644
--- a/target/m68k/cpu.h
+++ b/target/m68k/cpu.h
@@ -93,7 +93,13 @@ typedef struct CPUM68KState {
uint32_t pc;
uint32_t sr;
- /* SSP and USP. The current_sp is stored in aregs[7], the other here. */
+ /*
+ * The 68020/30/40 support two supervisor stacks, ISP and MSP.
+ * The 68000/10, Coldfire, and CPU32 only have USP/SSP.
+ *
+ * The current_sp is stored in aregs[7], the other here.
+ * The USP, SSP, and if used the additional ISP for 68020/30/40.
+ */
int current_sp;
uint32_t sp[3];
diff --git a/target/m68k/helper.c b/target/m68k/helper.c
index 119fc3af2b..17a4380b5b 100644
--- a/target/m68k/helper.c
+++ b/target/m68k/helper.c
@@ -474,7 +474,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;
--
2.21.0
reply other threads:[~2019-06-16 14:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190616142307.GA71211@localhost.localdomain \
--to=lucienmp.qemu@gmail.com \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).