[PATCH] target/m68k: Raise ColdFire bus access error

Eric DeVolder posted 1 patch 1 week, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261110152728.481267-1-eric._5Fdevolder@yahoo.com
Maintainers: Laurent Vivier <laurent@vivier.eu>
target/m68k/op_helper.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
[PATCH] target/m68k: Raise ColdFire bus access error
Posted by Eric DeVolder 1 week, 5 days ago
m68k_cpu_transaction_failed() now works for ColdFire
(access error vector 8). Previously it was only 68040.

Signed-off-by: Eric DeVolder <eric_devolder@yahoo.com>
---
 target/m68k/op_helper.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
index 65eb69f2b4..580f26a540 100644
--- a/target/m68k/op_helper.c
+++ b/target/m68k/op_helper.c
@@ -237,6 +237,9 @@ static void cf_interrupt_all(CPUM68KState *env, int is_hw)
 
     fmt |= 0x40000000;
     fmt |= vector << 16;
+    if (cs->exception_index == EXCP_ACCESS) {
+        fmt |= (env->mmu.ssw & 0xf) << 24;
+    }
     fmt |= sr;
 
     env->sr |= SR_S;
@@ -472,6 +475,18 @@ void m68k_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr,
 
     cpu_restore_state(cs, retaddr);
 
+    if (m68k_feature(env, M68K_FEATURE_CF_ISA_A)) {
+        if (access_type == MMU_INST_FETCH) {
+            env->mmu.ssw = 0x4;
+        } else if (access_type == MMU_DATA_STORE) {
+            env->mmu.ssw = 0x8;
+        } else {
+            env->mmu.ssw = 0xc;
+        }
+        cs->exception_index = EXCP_ACCESS;
+        cpu_loop_exit(cs);
+    }
+
     if (m68k_feature(env, M68K_FEATURE_M68040)) {
         env->mmu.mmusr = 0;
 
-- 
2.53.0