@samitouri / QOSamiQemu / commits / 1d6553ff27

hw/i386/vapic: Cope with non-page-aligned return from cpu_get_phys_page_debug()

Currently the i386 implementation of get_phys_page_debug() always returns an address aligned to a page boundary, and the vapic.c code assumes this: it adds back in the page offset after the call. Change this to OR in the page offset, so that it works whether cpu_get_phys_page_debug() returns the page address or the exact physical address. This will mean the code continues to work when we change the semantics to standardize on "return exact physical address". 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-2-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Peter Maydell committed Apr 30, 2026 at 10:37 UTC 1d6553ff276151242acb09910fc11ea27dff8294
1 file changed +1 -1
hw/i386/vapic.c
+1 -1
@@ -309,7 +309,7 @@ static int update_rom_mapping(VAPICROMState *s, CPUX86State *env, target_ulong i
309 if (paddr == -1) {
310 return -1;
311 }
312 - paddr += rom_state_vaddr & ~TARGET_PAGE_MASK;
312 + paddr |= rom_state_vaddr & ~TARGET_PAGE_MASK;
313 if (paddr != s->rom_state_paddr) {
314 return -1;
315 }