-/* $OpenBSD: vmm_machdep.c,v 1.2 2023/04/26 15:34:31 mlarkin Exp $ */
+/* $OpenBSD: vmm_machdep.c,v 1.3 2023/04/26 15:40:51 mlarkin Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
vmx_setmsrbr(vcpu, MSR_MISC_ENABLE);
vmx_setmsrbr(vcpu, MSR_TSC);
+ /* If host supports CET, pass through access to the guest. */
+ if (rcr4() & CR4_CET)
+ vmx_setmsrbrw(vcpu, MSR_S_CET);
+
/* XXX CR0 shadow */
/* XXX CR4 shadow */
*rcx |= SEFF0ECX_PKU;
else
*rcx &= ~SEFF0ECX_PKU;
+
+ /* Expose IBT bit if we've enabled CET on the host. */
+ if (rcr4() & CR4_CET)
+ *rdx |= SEFF0EDX_IBT;
+ else
+ *rdx &= ~SEFF0EDX_IBT;
+
} else {
/* Unsupported subleaf */
DPRINTF("%s: function 0x07 (SEFF) unsupported subleaf "