[01/12] target-lm32: fix debug memory access

Submitted by Michael Walle on March 6, 2013, 9:59 p.m.

Details

Message ID 1362607209-12232-2-git-send-email-michael@walle.cc
State New
Headers show

Commit Message

Michael Walle March 6, 2013, 9:59 p.m.
CPU models which have the LM32_FLAG_IGNORE_MSB flag set will shadow the
lower 2GB to the upper 2GB memory space. This will fix the debug memory
access used by qemu console and GDB to match this behaviour.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 target-lm32/helper.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

diff --git a/target-lm32/helper.c b/target-lm32/helper.c
index 47ae7e7..ef04643 100644
--- a/target-lm32/helper.c
+++ b/target-lm32/helper.c
@@ -39,7 +39,12 @@  int cpu_lm32_handle_mmu_fault(CPULM32State *env, target_ulong address, int rw,
 
 hwaddr cpu_get_phys_page_debug(CPULM32State *env, target_ulong addr)
 {
-    return addr & TARGET_PAGE_MASK;
+    addr &= TARGET_PAGE_MASK;
+    if (env->flags & LM32_FLAG_IGNORE_MSB) {
+        return addr & 0x7fffffff;
+    } else {
+        return addr;
+    }
 }
 
 void do_interrupt(CPULM32State *env)