]>
Commit | Line | Data |
---|---|---|
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 | */ | |
21 | ENTRY(vmx_vmenter) | |
22 | /* EFLAGS.ZF is set if VMCS.LAUNCHED == 0 */ | |
23 | je 2f | |
24 | ||
25 | 1: vmresume | |
26 | ret | |
27 | ||
28 | 2: vmlaunch | |
29 | ret | |
30 | ||
31 | 3: cmpb $0, kvm_rebooting | |
32 | jne 4f | |
33 | call kvm_spurious_fault | |
34 | 4: ret | |
35 | ||
36 | .pushsection .fixup, "ax" | |
37 | 5: jmp 3b | |
38 | .popsection | |
39 | ||
40 | _ASM_EXTABLE(1b, 5b) | |
41 | _ASM_EXTABLE(2b, 5b) | |
42 | ||
43 | ENDPROC(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 | */ | |
55 | ENTRY(vmx_vmexit) | |
56 | ret | |
57 | ENDPROC(vmx_vmexit) |