Commit 733c2769be for qemu.org
commit 733c2769be668d475ce00c662373e12c2836a2a3
Author: Peter Maydell <peter.maydell@linaro.org>
Date: Thu Apr 30 10:38:05 2026 +0100
target/sparc: Use cpu_translate_for_debug()
We want to remove the cpu_get_phys_addr_debug() function; update the
sparc dump_mmu() function to use cpu_translate_for_debug() instead.
The "mmu_probe succeeds but debug translate fails" cases are probably
not possible in practice; since cpu_get_phys_addr_debug() would
return -1 in that situation we make this conversion retain that
behaviour.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260430093810.2762539-21-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff --git a/target/sparc/mmu_helper.c b/target/sparc/mmu_helper.c
index e1abd520c4..e441ffb8f7 100644
--- a/target/sparc/mmu_helper.c
+++ b/target/sparc/mmu_helper.c
@@ -360,26 +360,39 @@ void dump_mmu(CPUSPARCState *env)
unsigned int n, m, o;
hwaddr pa;
uint32_t pde;
+ TranslateForDebugResult tres;
qemu_printf("Root ptr: " HWADDR_FMT_plx ", ctx: %d\n",
(hwaddr)env->mmuregs[1] << 4, env->mmuregs[2]);
for (n = 0, va = 0; n < 256; n++, va += 16 * 1024 * 1024) {
pde = mmu_probe(env, va, 2);
if (pde) {
- pa = cpu_get_phys_addr_debug(cs, va);
+ if (!cpu_translate_for_debug(cs, va, &tres)) {
+ pa = -1;
+ } else {
+ pa = tres.physaddr;
+ }
qemu_printf("VA: " TARGET_FMT_lx ", PA: " HWADDR_FMT_plx
" PDE: " TARGET_FMT_lx "\n", va, pa, pde);
for (m = 0, va1 = va; m < 64; m++, va1 += 256 * 1024) {
pde = mmu_probe(env, va1, 1);
if (pde) {
- pa = cpu_get_phys_addr_debug(cs, va1);
+ if (!cpu_translate_for_debug(cs, va1, &tres)) {
+ pa = -1;
+ } else {
+ pa = tres.physaddr;
+ }
qemu_printf(" VA: " TARGET_FMT_lx ", PA: "
HWADDR_FMT_plx " PDE: " TARGET_FMT_lx "\n",
va1, pa, pde);
for (o = 0, va2 = va1; o < 64; o++, va2 += 4 * 1024) {
pde = mmu_probe(env, va2, 0);
if (pde) {
- pa = cpu_get_phys_addr_debug(cs, va2);
+ if (!cpu_translate_for_debug(cs, va2, &tres)) {
+ pa = -1;
+ } else {
+ pa = tres.physaddr;
+ }
qemu_printf(" VA: " TARGET_FMT_lx ", PA: "
HWADDR_FMT_plx " PTE: "
TARGET_FMT_lx "\n",