1 | /* $Id: HWSVMR0.h 45786 2013-04-26 22:35:59Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * HM SVM (AMD-V) - Internal header file.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2012 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ___VMMR0_HWSVMR0_h
|
---|
19 | #define ___VMMR0_HWSVMR0_h
|
---|
20 |
|
---|
21 | #include <VBox/cdefs.h>
|
---|
22 | #include <VBox/types.h>
|
---|
23 | #include <VBox/vmm/em.h>
|
---|
24 | #include <VBox/vmm/stam.h>
|
---|
25 | #include <VBox/dis.h>
|
---|
26 | #include <VBox/vmm/hm.h>
|
---|
27 | #include <VBox/vmm/pgm.h>
|
---|
28 | #include <VBox/vmm/hm_svm.h>
|
---|
29 |
|
---|
30 | RT_C_DECLS_BEGIN
|
---|
31 |
|
---|
32 | /** @defgroup grp_svm_int Internal
|
---|
33 | * @ingroup grp_svm
|
---|
34 | * @internal
|
---|
35 | * @{
|
---|
36 | */
|
---|
37 |
|
---|
38 | #ifdef IN_RING0
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Enters the AMD-V session
|
---|
42 | *
|
---|
43 | * @returns VBox status code.
|
---|
44 | * @param pVM Pointer to the VM.
|
---|
45 | * @param pVCpu Pointer to the VMCPU.
|
---|
46 | * @param pCpu Pointer to the CPU info struct.
|
---|
47 | */
|
---|
48 | VMMR0DECL(int) SVMR0Enter(PVM pVM, PVMCPU pVCpu, PHMGLOBLCPUINFO pCpu);
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Leaves the AMD-V session
|
---|
52 | *
|
---|
53 | * @returns VBox status code.
|
---|
54 | * @param pVM Pointer to the VM.
|
---|
55 | * @param pVCpu Pointer to the VMCPU.
|
---|
56 | * @param pCtx Pointer to the guest CPU context.
|
---|
57 | */
|
---|
58 | VMMR0DECL(int) SVMR0Leave(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
|
---|
59 |
|
---|
60 | VMMR0DECL(int) SVMR0EnableCpu(PHMGLOBLCPUINFO pCpu, PVM pVM, void *pvPageCpu, RTHCPHYS HCPhysCpuPage, bool fEnabledBySystem);
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * Deactivates AMD-V on the current CPU
|
---|
64 | *
|
---|
65 | * @returns VBox status code.
|
---|
66 | * @param pCpu Pointer to the CPU info struct.
|
---|
67 | * @param pvPageCpu Pointer to the global CPU page.
|
---|
68 | * @param pPageCpuPhys Physical address of the global CPU page.
|
---|
69 | */
|
---|
70 | VMMR0DECL(int) SVMR0DisableCpu(PHMGLOBLCPUINFO pCpu, void *pvPageCpu, RTHCPHYS pPageCpuPhys);
|
---|
71 |
|
---|
72 | /**
|
---|
73 | * Does Ring-0 per VM AMD-V init.
|
---|
74 | *
|
---|
75 | * @returns VBox status code.
|
---|
76 | * @param pVM Pointer to the VM.
|
---|
77 | */
|
---|
78 | VMMR0DECL(int) SVMR0InitVM(PVM pVM);
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * Does Ring-0 per VM AMD-V termination.
|
---|
82 | *
|
---|
83 | * @returns VBox status code.
|
---|
84 | * @param pVM Pointer to the VM.
|
---|
85 | */
|
---|
86 | VMMR0DECL(int) SVMR0TermVM(PVM pVM);
|
---|
87 |
|
---|
88 | /**
|
---|
89 | * Sets up AMD-V for the specified VM
|
---|
90 | *
|
---|
91 | * @returns VBox status code.
|
---|
92 | * @param pVM Pointer to the VM.
|
---|
93 | */
|
---|
94 | VMMR0DECL(int) SVMR0SetupVM(PVM pVM);
|
---|
95 |
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * Runs guest code in an AMD-V VM.
|
---|
99 | *
|
---|
100 | * @returns VBox status code.
|
---|
101 | * @param pVM Pointer to the VM.
|
---|
102 | * @param pVCpu Pointer to the VMCPU.
|
---|
103 | * @param pCtx Pointer to the guest CPU context.
|
---|
104 | */
|
---|
105 | VMMR0DECL(int) SVMR0RunGuestCode(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
|
---|
106 |
|
---|
107 |
|
---|
108 | /**
|
---|
109 | * Save the host state.
|
---|
110 | *
|
---|
111 | * @returns VBox status code.
|
---|
112 | * @param pVM Pointer to the VM.
|
---|
113 | * @param pVCpu Pointer to the VMCPU.
|
---|
114 | */
|
---|
115 | VMMR0DECL(int) SVMR0SaveHostState(PVM pVM, PVMCPU pVCpu);
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * Loads the guest state.
|
---|
119 | *
|
---|
120 | * @returns VBox status code.
|
---|
121 | * @param pVM Pointer to the VM.
|
---|
122 | * @param pVCpu Pointer to the VMCPU.
|
---|
123 | * @param pCtx Pointer to the guest CPU context.
|
---|
124 | */
|
---|
125 | VMMR0DECL(int) SVMR0LoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
|
---|
126 |
|
---|
127 |
|
---|
128 | #if HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS) && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
|
---|
129 | DECLASM(int) SVMR0VMSwitcherRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu);
|
---|
130 | VMMR0DECL(int) SVMR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, HM64ON32OP enmOp, uint32_t cbParam,
|
---|
131 | uint32_t *paParam);
|
---|
132 | #endif /* HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS) && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL) */
|
---|
133 |
|
---|
134 | /**
|
---|
135 | * Prepares for and executes VMRUN (32-bit guests).
|
---|
136 | *
|
---|
137 | * @returns VBox status code.
|
---|
138 | * @param pVMCBHostPhys Physical address of host VMCB.
|
---|
139 | * @param pVMCBPhys Physical address of the VMCB.
|
---|
140 | * @param pCtx Pointer to the guest CPU context.
|
---|
141 | * @param pVM Pointer to the VM. (not used)
|
---|
142 | * @param pVCpu Pointer to the VMCPU. (not used)
|
---|
143 | */
|
---|
144 | DECLASM(int) SVMR0VMRun(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu);
|
---|
145 |
|
---|
146 |
|
---|
147 | /**
|
---|
148 | * Prepares for and executes VMRUN (64-bit guests).
|
---|
149 | *
|
---|
150 | * @returns VBox status code.
|
---|
151 | * @param pVMCBHostPhys Physical address of host VMCB.
|
---|
152 | * @param pVMCBPhys Physical address of the VMCB.
|
---|
153 | * @param pCtx Pointer to the guest CPU context.
|
---|
154 | * @param pVM Pointer to the VM. (not used)
|
---|
155 | * @param pVCpu Pointer to the VMCPU. (not used)
|
---|
156 | */
|
---|
157 | DECLASM(int) SVMR0VMRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu);
|
---|
158 |
|
---|
159 | /**
|
---|
160 | * Executes INVLPGA.
|
---|
161 | *
|
---|
162 | * @param pPageGC Virtual page to invalidate.
|
---|
163 | * @param u32ASID Tagged TLB id.
|
---|
164 | */
|
---|
165 | DECLASM(void) SVMR0InvlpgA(RTGCPTR pPageGC, uint32_t u32ASID);
|
---|
166 |
|
---|
167 | #endif /* IN_RING0 */
|
---|
168 |
|
---|
169 | /** @} */
|
---|
170 |
|
---|
171 | RT_C_DECLS_END
|
---|
172 |
|
---|
173 | #endif /* !___VMMR0_HWSVMR0_h */
|
---|
174 |
|
---|