-/* $OpenBSD: vmm_machdep.c,v 1.15 2024/01/11 17:13:48 jan Exp $ */
+/* $OpenBSD: vmm_machdep.c,v 1.16 2024/01/31 05:49:33 guenther Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
/* Restore any guest PKRU state. */
if (vmm_softc->sc_md.pkru_enabled)
- wrpkru(vcpu->vc_pkru);
+ wrpkru(0, vcpu->vc_pkru);
ret = vmx_enter_guest(&vcpu->vc_control_pa,
&vcpu->vc_gueststate,
/* Restore host PKRU state. */
if (vmm_softc->sc_md.pkru_enabled) {
vcpu->vc_pkru = rdpkru(0);
- wrpkru(PGK_VALUE);
+ wrpkru(0, PGK_VALUE);
}
lidt(&idtr);
/* Restore any guest PKRU state. */
if (vmm_softc->sc_md.pkru_enabled)
- wrpkru(vcpu->vc_pkru);
+ wrpkru(0, vcpu->vc_pkru);
KASSERT(vmcb->v_intercept1 & SVM_INTERCEPT_INTR);
wrmsr(MSR_AMD_VM_HSAVE_PA, vcpu->vc_svm_hsa_pa);
/* Restore host PKRU state. */
if (vmm_softc->sc_md.pkru_enabled) {
vcpu->vc_pkru = rdpkru(0);
- wrpkru(PGK_VALUE);
+ wrpkru(0, PGK_VALUE);
}
/*
-/* $OpenBSD: cpufunc.h,v 1.39 2023/01/30 02:32:01 dv Exp $ */
+/* $OpenBSD: cpufunc.h,v 1.40 2024/01/31 05:49:33 guenther Exp $ */
/* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */
/*-
}
static __inline void
-wrpkru(uint32_t pkru)
+wrpkru(u_int ecx, uint32_t pkru)
{
- uint32_t ecx = 0, edx = 0;
- __asm volatile("wrpkru" : : "a" (pkru), "c" (ecx), "d" (edx));
+ uint32_t edx = 0;
+ asm volatile("wrpkru" : : "a" (pkru), "c" (ecx), "d" (edx));
}
static __inline void