diff --git a/sys/amd64/amd64/efirt_machdep.c b/sys/amd64/amd64/efirt_machdep.c --- a/sys/amd64/amd64/efirt_machdep.c +++ b/sys/amd64/amd64/efirt_machdep.c @@ -190,6 +190,7 @@ vm_offset_t va; uint64_t idx; int bits, i, mode; + bool map_pz = true; obj_1t1_pt = vm_pager_allocate(OBJT_PHYS, NULL, ptoa(1 + NPML4EPG + NPML4EPG * NPDPEPG + NPML4EPG * NPDPEPG * NPDEPG), @@ -272,6 +273,22 @@ } } VM_OBJECT_WUNLOCK(obj_1t1_pt); + if (p->md_phys == 0) + map_pz = false; + } + + /* + * Some BIOSes tend to access phys 0 during efirt calls, + * so map it if we haven't yet. + */ + if (map_pz) { + VM_OBJECT_WLOCK(obj_1t1_pt); + pte = efi_1t1_pte(0); + /* Assume Write-Back */ + bits = pmap_cache_bits(kernel_pmap, VM_MEMATTR_WRITE_BACK, + false) | X86_PG_RW | X86_PG_V; + pte_store(pte, bits); + VM_OBJECT_WUNLOCK(obj_1t1_pt); } return (true);