From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <laurent@vivier.eu>,
Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Subject: [Qemu-devel] [PULL 1/1] m68k: fix exception stack frame for 68000
Date: Sun, 15 Apr 2018 11:46:38 +0200 [thread overview]
Message-ID: <20180415094638.3278-2-laurent@vivier.eu> (raw)
In-Reply-To: <20180415094638.3278-1-laurent@vivier.eu>
From: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
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>
---
target/m68k/op_helper.c | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
index 3a7f7f2219..8d09ed91c4 100644
--- a/target/m68k/op_helper.c
+++ b/target/m68k/op_helper.c
@@ -287,22 +287,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;
--
2.14.3
next prev parent reply other threads:[~2018-04-15 9:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-15 9:46 [Qemu-devel] [PULL 0/1] m68k fixes for 2.12-rc4 Laurent Vivier
2018-04-15 9:46 ` Laurent Vivier [this message]
2018-04-16 10:50 ` Peter Maydell
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=20180415094638.3278-2-laurent@vivier.eu \
--to=laurent@vivier.eu \
--cc=Pavel.Dovgaluk@ispras.ru \
--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).