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 @@ -254,7 +254,7 @@ vm_page_init_page(m, va, -1); m->order = VM_NFREEORDER + 1; /* invalid */ m->pool = VM_NFREEPOOL + 1; /* invalid */ - pmap_page_set_memattr(m, mode); + pmap_page_set_memattr_noflush(m, mode); } } VM_OBJECT_WUNLOCK(obj_1t1_pt); diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -9379,6 +9379,23 @@ panic("memory attribute change on the direct map failed"); } +void +pmap_page_set_memattr_noflush(vm_page_t m, vm_memattr_t ma) +{ + int error; + + m->md.pat_mode = ma; + + if ((m->flags & PG_FICTITIOUS) != 0) + return; + PMAP_LOCK(kernel_pmap); + error = pmap_change_props_locked(PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)), + PAGE_SIZE, PROT_NONE, m->md.pat_mode, 0); + PMAP_UNLOCK(kernel_pmap); + if (error != 0) + panic("memory attribute change on the direct map failed"); +} + /* * Changes the specified virtual address range's memory type to that given by * the parameter "mode". The specified virtual address range must be diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -499,6 +499,7 @@ bool pmap_not_in_di(void); boolean_t pmap_page_is_mapped(vm_page_t m); void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma); +void pmap_page_set_memattr_noflush(vm_page_t m, vm_memattr_t ma); void pmap_pinit_pml4(vm_page_t); void pmap_pinit_pml5(vm_page_t); bool pmap_ps_enabled(pmap_t pmap); diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -195,7 +195,7 @@ extern inthand_t IDTVEC(rsvd_pti), IDTVEC(rsvd); volatile char *lapic_map; -vm_paddr_t lapic_paddr; +vm_paddr_t lapic_paddr = DEFAULT_APIC_BASE; int x2apic_mode; int lapic_eoi_suppression; static int lapic_timer_tsc_deadline;