]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - arch/x86/kvm/vmx/vmenter.S
KVM: VMX: Create a stack frame in vCPU-run
[mirror_ubuntu-jammy-kernel.git] / arch / x86 / kvm / vmx / vmenter.S
CommitLineData
453eafbe
SC
1/* SPDX-License-Identifier: GPL-2.0 */
2#include <linux/linkage.h>
3#include <asm/asm.h>
4
5 .text
6
7/**
8 * vmx_vmenter - VM-Enter the current loaded VMCS
9 *
10 * %RFLAGS.ZF: !VMCS.LAUNCHED, i.e. controls VMLAUNCH vs. VMRESUME
11 *
12 * Returns:
13 * %RFLAGS.CF is set on VM-Fail Invalid
14 * %RFLAGS.ZF is set on VM-Fail Valid
15 * %RFLAGS.{CF,ZF} are cleared on VM-Success, i.e. VM-Exit
16 *
17 * Note that VMRESUME/VMLAUNCH fall-through and return directly if
18 * they VM-Fail, whereas a successful VM-Enter + VM-Exit will jump
19 * to vmx_vmexit.
20 */
21ENTRY(vmx_vmenter)
22 /* EFLAGS.ZF is set if VMCS.LAUNCHED == 0 */
23 je 2f
24
251: vmresume
26 ret
27
282: vmlaunch
29 ret
30
313: cmpb $0, kvm_rebooting
32 jne 4f
33 call kvm_spurious_fault
344: ret
35
36 .pushsection .fixup, "ax"
375: jmp 3b
38 .popsection
39
40 _ASM_EXTABLE(1b, 5b)
41 _ASM_EXTABLE(2b, 5b)
42
43ENDPROC(vmx_vmenter)
44
45/**
46 * vmx_vmexit - Handle a VMX VM-Exit
47 *
48 * Returns:
49 * %RFLAGS.{CF,ZF} are cleared on VM-Success, i.e. VM-Exit
50 *
51 * This is vmx_vmenter's partner in crime. On a VM-Exit, control will jump
52 * here after hardware loads the host's state, i.e. this is the destination
53 * referred to by VMCS.HOST_RIP.
54 */
55ENTRY(vmx_vmexit)
56 ret
57ENDPROC(vmx_vmexit)