1 | /** @file
|
---|
2 | * HWACCM - Intel/AMD VM Hardware Support Manager (VMM)
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2010 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_vmm_hwaccm_h
|
---|
27 | #define ___VBox_vmm_hwaccm_h
|
---|
28 |
|
---|
29 | #include <VBox/vmm/pgm.h>
|
---|
30 | #include <VBox/vmm/cpum.h>
|
---|
31 | #include <iprt/mp.h>
|
---|
32 |
|
---|
33 |
|
---|
34 | /** @defgroup grp_hwaccm The VM Hardware Manager API
|
---|
35 | * @{
|
---|
36 | */
|
---|
37 |
|
---|
38 | RT_C_DECLS_BEGIN
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Query HWACCM state (enabled/disabled)
|
---|
42 | *
|
---|
43 | * @returns 0 - disabled, 1 - enabled
|
---|
44 | * @param pVM The VM to operate on.
|
---|
45 | */
|
---|
46 | #define HWACCMIsEnabled(pVM) ((pVM)->fHWACCMEnabled)
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * Check if the current CPU state is valid for emulating IO blocks in the recompiler
|
---|
50 | *
|
---|
51 | * @returns boolean
|
---|
52 | * @param pCtx CPU context
|
---|
53 | */
|
---|
54 | #define HWACCMCanEmulateIoBlock(pVCpu) (!CPUMIsGuestInPagedProtectedMode(pVCpu))
|
---|
55 | #define HWACCMCanEmulateIoBlockEx(pCtx) (!CPUMIsGuestInPagedProtectedModeEx(pCtx))
|
---|
56 |
|
---|
57 | VMMDECL(int) HWACCMInvalidatePage(PVMCPU pVCpu, RTGCPTR GCVirt);
|
---|
58 | VMMDECL(bool) HWACCMHasPendingIrq(PVM pVM);
|
---|
59 |
|
---|
60 | #ifndef IN_RC
|
---|
61 | VMMDECL(int) HWACCMFlushTLB(PVMCPU pVCpu);
|
---|
62 | VMMDECL(int) HWACCMFlushTLBOnAllVCpus(PVM pVM);
|
---|
63 | VMMDECL(int) HWACCMInvalidatePageOnAllVCpus(PVM pVM, RTGCPTR GCVirt);
|
---|
64 | VMMDECL(int) HWACCMInvalidatePhysPage(PVM pVM, RTGCPHYS GCPhys);
|
---|
65 | VMMDECL(bool) HWACCMIsNestedPagingActive(PVM pVM);
|
---|
66 | VMMDECL(PGMMODE) HWACCMGetShwPagingMode(PVM pVM);
|
---|
67 | #else
|
---|
68 | /* Nop in GC */
|
---|
69 | # define HWACCMFlushTLB(pVCpu) do { } while (0)
|
---|
70 | # define HWACCMIsNestedPagingActive(pVM) false
|
---|
71 | # define HWACCMFlushTLBOnAllVCpus(pVM) do { } while (0)
|
---|
72 | #endif
|
---|
73 |
|
---|
74 | #ifdef IN_RING0
|
---|
75 | /** @defgroup grp_hwaccm_r0 The VM Hardware Manager API
|
---|
76 | * @ingroup grp_hwaccm
|
---|
77 | * @{
|
---|
78 | */
|
---|
79 | VMMR0DECL(int) HWACCMR0Init(void);
|
---|
80 | VMMR0DECL(int) HWACCMR0Term(void);
|
---|
81 | VMMR0DECL(int) HWACCMR0InitVM(PVM pVM);
|
---|
82 | VMMR0DECL(int) HWACCMR0TermVM(PVM pVM);
|
---|
83 | VMMR0DECL(int) HWACCMR0EnableAllCpus(PVM pVM);
|
---|
84 | VMMR0DECL(int) HWACCMR0EnterSwitcher(PVM pVM, bool *pfVTxDisabled);
|
---|
85 | VMMR0DECL(int) HWACCMR0LeaveSwitcher(PVM pVM, bool fVTxDisabled);
|
---|
86 |
|
---|
87 | VMMR0DECL(void) HWACCMR0SavePendingIOPortWrite(PVMCPU pVCpu, RTGCPTR GCPtrRip, RTGCPTR GCPtrRipNext, unsigned uPort, unsigned uAndVal, unsigned cbSize);
|
---|
88 | VMMR0DECL(void) HWACCMR0SavePendingIOPortRead(PVMCPU pVCpu, RTGCPTR GCPtrRip, RTGCPTR GCPtrRipNext, unsigned uPort, unsigned uAndVal, unsigned cbSize);
|
---|
89 |
|
---|
90 | /** @} */
|
---|
91 | #endif /* IN_RING0 */
|
---|
92 |
|
---|
93 |
|
---|
94 | #ifdef IN_RING3
|
---|
95 | /** @defgroup grp_hwaccm_r3 The VM Hardware Manager API
|
---|
96 | * @ingroup grp_hwaccm
|
---|
97 | * @{
|
---|
98 | */
|
---|
99 | VMMR3DECL(bool) HWACCMR3IsEventPending(PVMCPU pVCpu);
|
---|
100 | VMMR3DECL(int) HWACCMR3Init(PVM pVM);
|
---|
101 | VMMR3_INT_DECL(int) HWACCMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
|
---|
102 | VMMR3DECL(void) HWACCMR3Relocate(PVM pVM);
|
---|
103 | VMMR3DECL(int) HWACCMR3Term(PVM pVM);
|
---|
104 | VMMR3DECL(void) HWACCMR3Reset(PVM pVM);
|
---|
105 | VMMR3DECL(void) HWACCMR3ResetCpu(PVMCPU pVCpu);
|
---|
106 | VMMR3DECL(void) HWACCMR3CheckError(PVM pVM, int iStatusCode);
|
---|
107 | VMMR3DECL(bool) HWACCMR3CanExecuteGuest(PVM pVM, PCPUMCTX pCtx);
|
---|
108 | VMMR3DECL(void) HWACCMR3NotifyScheduled(PVMCPU pVCpu);
|
---|
109 | VMMR3DECL(void) HWACCMR3NotifyEmulated(PVMCPU pVCpu);
|
---|
110 | VMMR3DECL(bool) HWACCMR3IsActive(PVMCPU pVCpu);
|
---|
111 | VMMR3DECL(bool) HWACCMR3IsNestedPagingActive(PVM pVM);
|
---|
112 | VMMR3DECL(bool) HWACCMR3IsAllowed(PVM pVM);
|
---|
113 | VMMR3DECL(void) HWACCMR3PagingModeChanged(PVM pVM, PVMCPU pVCpu, PGMMODE enmShadowMode, PGMMODE enmGuestMode);
|
---|
114 | VMMR3DECL(bool) HWACCMR3IsVPIDActive(PVM pVM);
|
---|
115 | VMMR3DECL(int) HWACCMR3InjectNMI(PVM pVM);
|
---|
116 | VMMR3DECL(int) HWACCMR3EmulateIoBlock(PVM pVM, PCPUMCTX pCtx);
|
---|
117 | VMMR3DECL(VBOXSTRICTRC) HWACCMR3RestartPendingIOInstr(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
|
---|
118 | VMMR3DECL(int) HWACMMR3EnablePatching(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem);
|
---|
119 | VMMR3DECL(int) HWACMMR3DisablePatching(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem);
|
---|
120 | VMMR3DECL(int) HWACCMR3PatchTprInstr(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
|
---|
121 | VMMR3DECL(bool) HWACCMR3IsRescheduleRequired(PVM pVM, PCPUMCTX pCtx);
|
---|
122 | VMMR3DECL(bool) HWACCMR3IsVmxPreemptionTimerUsed(PVM pVM);
|
---|
123 |
|
---|
124 | /** @} */
|
---|
125 | #endif /* IN_RING3 */
|
---|
126 |
|
---|
127 | #ifdef IN_RING0
|
---|
128 | /** @addtogroup grp_hwaccm_r0
|
---|
129 | * @{
|
---|
130 | */
|
---|
131 | VMMR0DECL(int) HWACCMR0SetupVM(PVM pVM);
|
---|
132 | VMMR0DECL(int) HWACCMR0RunGuestCode(PVM pVM, PVMCPU pVCpu);
|
---|
133 | VMMR0DECL(int) HWACCMR0Enter(PVM pVM, PVMCPU pVCpu);
|
---|
134 | VMMR0DECL(int) HWACCMR0Leave(PVM pVM, PVMCPU pVCpu);
|
---|
135 | VMMR0DECL(int) HWACCMR0InvalidatePage(PVM pVM, PVMCPU pVCpu);
|
---|
136 | VMMR0DECL(int) HWACCMR0FlushTLB(PVM pVM);
|
---|
137 | VMMR0DECL(bool) HWACCMR0SuspendPending();
|
---|
138 |
|
---|
139 | # if HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS)
|
---|
140 | VMMR0DECL(int) HWACCMR0SaveFPUState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
|
---|
141 | VMMR0DECL(int) HWACCMR0SaveDebugState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
|
---|
142 | VMMR0DECL(int) HWACCMR0TestSwitcher3264(PVM pVM);
|
---|
143 | # endif
|
---|
144 |
|
---|
145 | /** @} */
|
---|
146 | #endif /* IN_RING0 */
|
---|
147 |
|
---|
148 |
|
---|
149 | /** @} */
|
---|
150 | RT_C_DECLS_END
|
---|
151 |
|
---|
152 |
|
---|
153 | #endif
|
---|
154 |
|
---|