From: Peter Maydell <[email protected]> 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 <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-ID: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- hw/i386/vapic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/vapic.c b/hw/i386/vapic.c index 1acb9f91b2a..3738031a055 100644 --- a/hw/i386/vapic.c +++ b/hw/i386/vapic.c @@ -309,7 +309,7 @@ static int update_rom_mapping(VAPICROMState *s, CPUX86State *env, target_ulong i if (paddr == -1) { return -1; } - paddr += rom_state_vaddr & ~TARGET_PAGE_MASK; + paddr |= rom_state_vaddr & ~TARGET_PAGE_MASK; if (paddr != s->rom_state_paddr) { return -1; } -- 2.53.0
