Convert mips to providing the translate_for_debug method rather
than the deprecated get_phys_addr_debug method.

Signed-off-by: Peter Maydell <[email protected]>
---
 target/mips/internal.h        |  3 ++-
 target/mips/cpu.c             |  2 +-
 target/mips/system/physaddr.c | 13 ++++++++++---
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/target/mips/internal.h b/target/mips/internal.h
index 7dba22300b1..f054dca5f7a 100644
--- a/target/mips/internal.h
+++ b/target/mips/internal.h
@@ -118,7 +118,8 @@ enum {
 int get_physical_address(CPUMIPSState *env, hwaddr *physical,
                          int *prot, target_ulong real_address,
                          MMUAccessType access_type, int mmu_idx);
-hwaddr mips_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr);
+bool mips_cpu_translate_for_debug(CPUState *cpu, vaddr addr,
+                                  TranslateForDebugResult *result);
 
 typedef struct r4k_tlb_t r4k_tlb_t;
 struct r4k_tlb_t {
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index 0fead20d651..c618fd3d000 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -659,7 +659,7 @@ static ObjectClass *mips_cpu_class_by_name(const char 
*cpu_model)
 
 static const struct SysemuCPUOps mips_sysemu_ops = {
     .has_work = mips_cpu_has_work,
-    .get_phys_addr_debug = mips_cpu_get_phys_addr_debug,
+    .translate_for_debug = mips_cpu_translate_for_debug,
     .legacy_vmsd = &vmstate_mips_cpu,
 };
 #endif
diff --git a/target/mips/system/physaddr.c b/target/mips/system/physaddr.c
index 746dbf8aa4e..6f11e70ba80 100644
--- a/target/mips/system/physaddr.c
+++ b/target/mips/system/physaddr.c
@@ -19,6 +19,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/page-protection.h"
+#include "exec/target_page.h"
 #include "../internal.h"
 
 static int is_seg_am_mapped(unsigned int am, bool eu, int mmu_idx)
@@ -227,7 +228,8 @@ int get_physical_address(CPUMIPSState *env, hwaddr 
*physical,
     return ret;
 }
 
-hwaddr mips_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr)
+bool mips_cpu_translate_for_debug(CPUState *cs, vaddr addr,
+                                  TranslateForDebugResult *result)
 {
     CPUMIPSState *env = cpu_env(cs);
     hwaddr phys_addr;
@@ -235,7 +237,12 @@ hwaddr mips_cpu_get_phys_addr_debug(CPUState *cs, vaddr 
addr)
 
     if (get_physical_address(env, &phys_addr, &prot, addr, MMU_DATA_LOAD,
                              mips_env_mmu_index(env)) != 0) {
-        return -1;
+        return false;
     }
-    return phys_addr;
+    *result = (TranslateForDebugResult) {
+        .physaddr = phys_addr,
+        .lg_page_size = TARGET_PAGE_BITS,
+        .attrs.debug = 1,
+    };
+    return true;
 }
-- 
2.43.0


Reply via email to