Changeset View
Changeset View
Standalone View
Standalone View
head/sys/amd64/amd64/efirt_machdep.c
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | |||||
#include <machine/fpu.h> | #include <machine/fpu.h> | ||||
#include <machine/efi.h> | #include <machine/efi.h> | ||||
#include <machine/metadata.h> | #include <machine/metadata.h> | ||||
#include <machine/md_var.h> | #include <machine/md_var.h> | ||||
#include <machine/smp.h> | #include <machine/smp.h> | ||||
#include <machine/vmparam.h> | #include <machine/vmparam.h> | ||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
#include <vm/vm_extern.h> | |||||
#include <vm/vm_map.h> | #include <vm/vm_map.h> | ||||
#include <vm/vm_object.h> | #include <vm/vm_object.h> | ||||
#include <vm/vm_page.h> | #include <vm/vm_page.h> | ||||
#include <vm/vm_pager.h> | #include <vm/vm_pager.h> | ||||
static pml4_entry_t *efi_pml4; | static pml4_entry_t *efi_pml4; | ||||
static vm_object_t obj_1t1_pt; | static vm_object_t obj_1t1_pt; | ||||
static vm_page_t efi_pml4_page; | static vm_page_t efi_pml4_page; | ||||
▲ Show 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
int | int | ||||
efi_arch_enter(void) | efi_arch_enter(void) | ||||
{ | { | ||||
pmap_t curpmap; | pmap_t curpmap; | ||||
curpmap = PCPU_GET(curpmap); | curpmap = PCPU_GET(curpmap); | ||||
PMAP_LOCK_ASSERT(curpmap, MA_OWNED); | PMAP_LOCK_ASSERT(curpmap, MA_OWNED); | ||||
curthread->td_md.md_efirt_dis_pf = vm_fault_disable_pagefaults(); | |||||
/* | /* | ||||
* IPI TLB shootdown handler invltlb_pcid_handler() reloads | * IPI TLB shootdown handler invltlb_pcid_handler() reloads | ||||
* %cr3 from the curpmap->pm_cr3, which would disable runtime | * %cr3 from the curpmap->pm_cr3, which would disable runtime | ||||
* segments mappings. Block the handler's action by setting | * segments mappings. Block the handler's action by setting | ||||
* curpmap to impossible value. See also comment in | * curpmap to impossible value. See also comment in | ||||
* pmap.c:pmap_activate_sw(). | * pmap.c:pmap_activate_sw(). | ||||
*/ | */ | ||||
Show All 18 Lines | efi_arch_leave(void) | ||||
curpmap = &curproc->p_vmspace->vm_pmap; | curpmap = &curproc->p_vmspace->vm_pmap; | ||||
if (pmap_pcid_enabled && !invpcid_works) | if (pmap_pcid_enabled && !invpcid_works) | ||||
PCPU_SET(curpmap, curpmap); | PCPU_SET(curpmap, curpmap); | ||||
load_cr3(curpmap->pm_cr3 | (pmap_pcid_enabled ? | load_cr3(curpmap->pm_cr3 | (pmap_pcid_enabled ? | ||||
curpmap->pm_pcids[PCPU_GET(cpuid)].pm_pcid : 0)); | curpmap->pm_pcids[PCPU_GET(cpuid)].pm_pcid : 0)); | ||||
if (!pmap_pcid_enabled) | if (!pmap_pcid_enabled) | ||||
invltlb(); | invltlb(); | ||||
vm_fault_enable_pagefaults(curthread->td_md.md_efirt_dis_pf); | |||||
} | } | ||||
/* XXX debug stuff */ | /* XXX debug stuff */ | ||||
static int | static int | ||||
efi_time_sysctl_handler(SYSCTL_HANDLER_ARGS) | efi_time_sysctl_handler(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
struct efi_tm tm; | struct efi_tm tm; | ||||
int error, val; | int error, val; | ||||
Show All 16 Lines |