vmm(4): save and restore guest pkru.
authordv <dv@openbsd.org>
Mon, 30 Jan 2023 02:32:01 +0000 (02:32 +0000)
committerdv <dv@openbsd.org>
Mon, 30 Jan 2023 02:32:01 +0000 (02:32 +0000)
commit89e94d1090757fbfd3f57bbf4417e877dede8a35
tree35ea7f2bf0e4df9c78539b1edb83e72a5c32f2e2
parentfb41201ee8edf8ffafd5d23e3f703579b85ad89d
vmm(4): save and restore guest pkru.

Take a simple approach for saving and restoring PKRU if the host
has PKE support enabled. Uses explicit rdpkru/wrpkru instructions
for now instead of xsave.

This functionality is still gated behind amd64 pmap checking for
operation under a hypervisor as well as vmm masking the cpuid bit
for PKU.

"if your diff is good, then commit it" -deraadt@
sys/arch/amd64/amd64/vmm.c
sys/arch/amd64/include/cpufunc.h
sys/arch/amd64/include/vmmvar.h