* [PATCH] target/m68k: don't word align SP in stack frame if M68K_FEATURE_UNALIGNED_DATA feature enabled
@ 2022-01-08 18:04 Mark Cave-Ayland
2022-01-08 21:43 ` Laurent Vivier
0 siblings, 1 reply; 2+ messages in thread
From: Mark Cave-Ayland @ 2022-01-08 18:04 UTC (permalink / raw)
To: laurent, qemu-devel
Commit a9431a03f7 ("target/m68k: add M68K_FEATURE_UNALIGNED_DATA feature") added
a new feature for processors from the 68020 onwards which do not require data
accesses to be word aligned.
Unfortunately the original commit missed an additional case whereby the SP is
still word aligned when setting up an additional format 1 stack frame so add the
necessary M68K_FEATURE_UNALIGNED_DATA feature guard.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fixes: a9431a03f7 ("target/m68k: add M68K_FEATURE_UNALIGNED_DATA feature")
---
target/m68k/op_helper.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
index ab6b559fd3..59d8d5a09e 100644
--- a/target/m68k/op_helper.c
+++ b/target/m68k/op_helper.c
@@ -429,7 +429,10 @@ static void m68k_interrupt_all(CPUM68KState *env, int is_hw)
oldsr = sr;
env->aregs[7] = sp;
cpu_m68k_set_sr(env, sr &= ~SR_M);
- sp = env->aregs[7] & ~1;
+ sp = env->aregs[7];
+ if (!m68k_feature(env, M68K_FEATURE_UNALIGNED_DATA)) {
+ sp &= ~1;
+ }
do_stack_frame(env, &sp, 1, oldsr, 0, retaddr);
} else {
do_stack_frame(env, &sp, 0, oldsr, 0, retaddr);
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] target/m68k: don't word align SP in stack frame if M68K_FEATURE_UNALIGNED_DATA feature enabled
2022-01-08 18:04 [PATCH] target/m68k: don't word align SP in stack frame if M68K_FEATURE_UNALIGNED_DATA feature enabled Mark Cave-Ayland
@ 2022-01-08 21:43 ` Laurent Vivier
0 siblings, 0 replies; 2+ messages in thread
From: Laurent Vivier @ 2022-01-08 21:43 UTC (permalink / raw)
To: Mark Cave-Ayland, qemu-devel
Le 08/01/2022 à 19:04, Mark Cave-Ayland a écrit :
> Commit a9431a03f7 ("target/m68k: add M68K_FEATURE_UNALIGNED_DATA feature") added
> a new feature for processors from the 68020 onwards which do not require data
> accesses to be word aligned.
>
> Unfortunately the original commit missed an additional case whereby the SP is
> still word aligned when setting up an additional format 1 stack frame so add the
> necessary M68K_FEATURE_UNALIGNED_DATA feature guard.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Fixes: a9431a03f7 ("target/m68k: add M68K_FEATURE_UNALIGNED_DATA feature")
> ---
> target/m68k/op_helper.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
> index ab6b559fd3..59d8d5a09e 100644
> --- a/target/m68k/op_helper.c
> +++ b/target/m68k/op_helper.c
> @@ -429,7 +429,10 @@ static void m68k_interrupt_all(CPUM68KState *env, int is_hw)
> oldsr = sr;
> env->aregs[7] = sp;
> cpu_m68k_set_sr(env, sr &= ~SR_M);
> - sp = env->aregs[7] & ~1;
> + sp = env->aregs[7];
> + if (!m68k_feature(env, M68K_FEATURE_UNALIGNED_DATA)) {
> + sp &= ~1;
> + }
> do_stack_frame(env, &sp, 1, oldsr, 0, retaddr);
> } else {
> do_stack_frame(env, &sp, 0, oldsr, 0, retaddr);
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-08 21:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-08 18:04 [PATCH] target/m68k: don't word align SP in stack frame if M68K_FEATURE_UNALIGNED_DATA feature enabled Mark Cave-Ayland
2022-01-08 21:43 ` Laurent Vivier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.