Changeset
target/m68k/op_helper.c |   33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
Git apply log
Switched to a new branch '20180413133041.29509.59064.stgit@pasha-VirtualBox'
Applying: m68: fix exception stack frame for 68000
To https://github.com/patchew-project/qemu
 + 11fb106...94c4fce patchew/20180413133041.29509.59064.stgit@pasha-VirtualBox -> patchew/20180413133041.29509.59064.stgit@pasha-VirtualBox (forced update)
Test passed: checkpatch

loading

Test passed: docker-mingw@fedora

loading

Test passed: docker-build@min-glib

loading

Test passed: s390x

loading

[Qemu-devel] [PATCH v2] m68: fix exception stack frame for 68000
Posted by Pavel Dovgalyuk, 6 days ago
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>

--

v2:
 - moved switch under the condition (suggested by Laurent Vivier)
---
 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 3a7f7f2..8d09ed9 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;


Re: [Qemu-devel] [PATCH v2] m68: fix exception stack frame for 68000
Posted by Laurent Vivier, 6 days ago
Le 13/04/2018 à 15:30, Pavel Dovgalyuk a écrit :
> 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>
> 
> --
> 
> v2:
>  - moved switch under the condition (suggested by Laurent Vivier)
> ---
>  target/m68k/op_helper.c |   33 ++++++++++++++++++---------------
>  1 file changed, 18 insertions(+), 15 deletions(-)
> 


Reviewed-by: Laurent Vivier <laurent@vivier.eu>