mirror of
https://github.com/openbsd/src.git
synced 2026-04-26 07:05:54 +00:00
SEV-ES: Implement wbinvd in the trap handler
When MP is enabled, OpenBSD uses the WBINVD instruction. With SEV-ES, this causes a VC trap if the hypervisor has the WBINVD intercept enabled. In the trap handler, simply forward the WBINVD exit to the hypervisor. From Sebastian Sturm ok mlarkin hshoexer
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: trap.c,v 1.115 2025/10/22 14:31:24 hshoexer Exp $ */
|
||||
/* $OpenBSD: trap.c,v 1.116 2025/11/26 13:48:57 sf Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
@@ -445,6 +445,16 @@ vctrap(struct trapframe *frame, int user, int *sig, int *code)
|
||||
}
|
||||
panic("unexpected MMIO in kernelspace");
|
||||
/* NOTREACHED */
|
||||
case SVM_VMEXIT_WBINVD:
|
||||
/*
|
||||
* There is no special GHCB request for WBNOINVD.
|
||||
* Signal WBINVD to emulate WBNOINVD.
|
||||
*/
|
||||
if (*rip == 0xf3)
|
||||
frame->tf_rip += 3;
|
||||
else
|
||||
frame->tf_rip += 2;
|
||||
break;
|
||||
default:
|
||||
panic("invalid exit code 0x%llx", ghcb_regs.exitcode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user