hw/core: Implement cpu_get_phys_addr_attrs_debug() with cpu_translate_for_debug()
Implement cpu_get_phys_addr_attrs_debug() with cpu_translate_for_debug(), so that CPUs can implement only the translate_for_debug method and have all of the wrapper functions cpu_translate_for_debug(), cpu_get_phys_addr_attrs_debug() and cpu_get_phys_addr_debug() work. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20260430093810.2762539-17-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Peter Maydell committed
Apr 30, 2026 at 10:38 UTC
00f3bd934523278c46b887979a19233ecb4b0e0b
1 file changed
+6
-11
hw/core/cpu-system.c
+6
-11
@@ -90,19 +90,14 @@ bool cpu_translate_for_debug(CPUState *cpu, vaddr addr,
90
hwaddr cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr,
91
MemTxAttrs *attrs)
92
{
93
- hwaddr paddr;
93
+ TranslateForDebugResult result;
94
95
- if (cpu->cc->sysemu_ops->get_phys_addr_attrs_debug) {
96
- paddr = cpu->cc->sysemu_ops->get_phys_addr_attrs_debug(cpu, addr,
97
- attrs);
98
- } else {
99
- /* Fallback for CPUs which don't implement the _attrs_ hook */
100
- *attrs = MEMTXATTRS_UNSPECIFIED;
101
- paddr = cpu->cc->sysemu_ops->get_phys_addr_debug(cpu, addr);
95
+ if (!cpu_translate_for_debug(cpu, addr, &result)) {
96
+ return -1;
97
}
103
- /* Indicate that this is a debug access. */
104
- attrs->debug = 1;
105
- return paddr;
98
+
99
+ *attrs = result.attrs;
100
+ return result.physaddr;
101
}
102
103
hwaddr cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr)