Commit cd1980bf96 for qemu.org
commit cd1980bf96ccc227c3daf237eb0041f6307f6bf0
Author: Peter Maydell <peter.maydell@linaro.org>
Date: Thu Oct 22 13:58:58 2026 +0100
target/mips: Convert to translate_for_debug
Convert mips to providing the translate_for_debug method rather
than the deprecated get_phys_addr_debug method.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20261022125858.310252-6-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index 759a4e93a0..c5193dbc8e 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/internal.h b/target/mips/internal.h
index 0c9b1335eb..a302fc0c20 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/system/physaddr.c b/target/mips/system/physaddr.c
index 746dbf8aa4..6f11e70ba8 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;
}