Skip to content

Commit 7831811

Browse files
mcaylandvivier
authored andcommitted
target/m68k: fix physical address translation in m68k_cpu_get_phys_page_debug()
The result of the get_physical_address() function should be combined with the offset of the original page access before being returned. Otherwise the m68k_cpu_get_phys_page_debug() function can round to the wrong page causing incorrect lookups in gdbstub and various "Disassembler disagrees with translator over instruction decoding" warnings to appear at translation time. Fixes: 88b2fef ("target/m68k: add MC68040 MMU") Signed-off-by: Mark Cave-Ayland <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Laurent Vivier <[email protected]> Message-Id: <[email protected]> Signed-off-by: Laurent Vivier <[email protected]>
1 parent 64f0ad8 commit 7831811

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

target/m68k/helper.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,10 +820,14 @@ hwaddr m68k_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
820820
if (env->sr & SR_S) {
821821
access_type |= ACCESS_SUPER;
822822
}
823+
823824
if (get_physical_address(env, &phys_addr, &prot,
824825
addr, access_type, &page_size) != 0) {
825826
return -1;
826827
}
828+
829+
addr &= TARGET_PAGE_MASK;
830+
phys_addr += addr & (page_size - 1);
827831
return phys_addr;
828832
}
829833

0 commit comments

Comments
 (0)