diff --git a/libc/calls/munmap-metal.c b/libc/calls/munmap-metal.c index 1b7f9e991..2497e2568 100644 --- a/libc/calls/munmap-metal.c +++ b/libc/calls/munmap-metal.c @@ -27,7 +27,7 @@ noasan int sys_munmap_metal(void *addr, size_t size) { for (i = 0; i < size; i += 4096) { e = __get_virtual(mm, __get_pml4t(), (uint64_t)addr + i, false); if (e) *e = ~(PAGE_V | PAGE_RSRV); - invlpg(e); + invlpg((uint64_t)addr + i); } return 0; } diff --git a/libc/intrin/directmap-metal.c b/libc/intrin/directmap-metal.c index e4e52b5ac..bd3a4afd8 100644 --- a/libc/intrin/directmap-metal.c +++ b/libc/intrin/directmap-metal.c @@ -62,6 +62,7 @@ noasan struct DirectMap sys_mmap_metal(void *paddr, size_t size, int prot, page |= PAGE_V; if (!(prot & PROT_EXEC)) page |= PAGE_XD; *pte = page; + invlpg(addr + i); } else { addr = -1; break;