Skip to content

Commit 1a7f95f

Browse files
committed
arm64: Fix DMAP handling in arm64_get_writable_addr()
PHYS_TO_DMAP_PAGE expects a page-aligned physical address.
1 parent 93f173d commit 1a7f95f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sys/arm64/arm64/machdep.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,8 @@ arm64_get_writable_addr(void *addr, void **out)
465465
* If it is within the DMAP region and is writable use that.
466466
*/
467467
if (PHYS_IN_DMAP_RANGE(pa)) {
468-
addr = (void *)PHYS_TO_DMAP_PAGE(pa);
468+
addr = (void *)((uintptr_t)PHYS_TO_DMAP_PAGE(trunc_page(pa)) +
469+
((vm_offset_t)addr & PAGE_MASK));
469470
if (PAR_SUCCESS(arm64_address_translate_s1e1w(
470471
(vm_offset_t)addr))) {
471472
*out = addr;

0 commit comments

Comments
 (0)