VirtualBox

source: vbox/trunk/include/VBox/vmm/hm.h@ 43706

Last change on this file since 43706 was 43387, checked in by vboxsync, 12 years ago

VMM: HM cleanup.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.7 KB
Line 
1/** @file
2 * HM - 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_hm_h
27#define ___VBox_vmm_hm_h
28
29#include <VBox/vmm/pgm.h>
30#include <VBox/vmm/cpum.h>
31#include <VBox/vmm/vmm.h>
32#include <iprt/mp.h>
33
34
35/** @defgroup grp_hm The VM Hardware Manager API
36 * @{
37 */
38
39RT_C_DECLS_BEGIN
40
41/**
42 * Query HM state (enabled/disabled)
43 *
44 * @returns 0 - disabled, 1 - enabled
45 * @param pVM The VM to operate on.
46 */
47#define HMIsEnabled(pVM) ((pVM)->fHMEnabled)
48
49 /**
50 * Check if the current CPU state is valid for emulating IO blocks in the recompiler
51 *
52 * @returns boolean
53 * @param pCtx CPU context
54 */
55#define HMCanEmulateIoBlock(pVCpu) (!CPUMIsGuestInPagedProtectedMode(pVCpu))
56#define HMCanEmulateIoBlockEx(pCtx) (!CPUMIsGuestInPagedProtectedModeEx(pCtx))
57
58VMMDECL(int) HMInvalidatePage(PVMCPU pVCpu, RTGCPTR GCVirt);
59VMMDECL(bool) HMHasPendingIrq(PVM pVM);
60
61#ifndef IN_RC
62VMMDECL(int) HMFlushTLB(PVMCPU pVCpu);
63VMMDECL(int) HMFlushTLBOnAllVCpus(PVM pVM);
64VMMDECL(int) HMInvalidatePageOnAllVCpus(PVM pVM, RTGCPTR GCVirt);
65VMMDECL(int) HMInvalidatePhysPage(PVM pVM, RTGCPHYS GCPhys);
66VMMDECL(bool) HMIsNestedPagingActive(PVM pVM);
67VMMDECL(PGMMODE) HMGetShwPagingMode(PVM pVM);
68#else
69/* Nop in GC */
70# define HMFlushTLB(pVCpu) do { } while (0)
71# define HMIsNestedPagingActive(pVM) false
72# define HMFlushTLBOnAllVCpus(pVM) do { } while (0)
73#endif
74
75#ifdef IN_RING0
76/** @defgroup grp_hm_r0 The VM Hardware Manager API
77 * @ingroup grp_hm
78 * @{
79 */
80VMMR0DECL(int) HMR0Init(void);
81VMMR0DECL(int) HMR0Term(void);
82VMMR0DECL(int) HMR0InitVM(PVM pVM);
83VMMR0DECL(int) HMR0TermVM(PVM pVM);
84VMMR0DECL(int) HMR0EnableAllCpus(PVM pVM);
85VMMR0DECL(int) HMR0EnterSwitcher(PVM pVM, VMMSWITCHER enmSwitcher, bool *pfVTxDisabled);
86VMMR0DECL(void) HMR0LeaveSwitcher(PVM pVM, bool fVTxDisabled);
87
88VMMR0DECL(void) HMR0SavePendingIOPortWrite(PVMCPU pVCpu, RTGCPTR GCPtrRip, RTGCPTR GCPtrRipNext, unsigned uPort, unsigned uAndVal, unsigned cbSize);
89VMMR0DECL(void) HMR0SavePendingIOPortRead(PVMCPU pVCpu, RTGCPTR GCPtrRip, RTGCPTR GCPtrRipNext, unsigned uPort, unsigned uAndVal, unsigned cbSize);
90
91/** @} */
92#endif /* IN_RING0 */
93
94
95#ifdef IN_RING3
96/** @defgroup grp_hm_r3 The VM Hardware Manager API
97 * @ingroup grp_hm
98 * @{
99 */
100VMMR3DECL(bool) HMR3IsEventPending(PVMCPU pVCpu);
101VMMR3DECL(int) HMR3Init(PVM pVM);
102VMMR3_INT_DECL(int) HMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
103VMMR3DECL(void) HMR3Relocate(PVM pVM);
104VMMR3DECL(int) HMR3Term(PVM pVM);
105VMMR3DECL(void) HMR3Reset(PVM pVM);
106VMMR3DECL(void) HMR3ResetCpu(PVMCPU pVCpu);
107VMMR3DECL(void) HMR3CheckError(PVM pVM, int iStatusCode);
108VMMR3DECL(bool) HMR3CanExecuteGuest(PVM pVM, PCPUMCTX pCtx);
109VMMR3DECL(void) HMR3NotifyScheduled(PVMCPU pVCpu);
110VMMR3DECL(void) HMR3NotifyEmulated(PVMCPU pVCpu);
111VMMR3DECL(bool) HMR3IsActive(PVMCPU pVCpu);
112VMMR3DECL(bool) HMR3IsNestedPagingActive(PVM pVM);
113VMMR3DECL(bool) HMR3IsAllowed(PVM pVM);
114VMMR3DECL(void) HMR3PagingModeChanged(PVM pVM, PVMCPU pVCpu, PGMMODE enmShadowMode, PGMMODE enmGuestMode);
115VMMR3DECL(bool) HMR3IsVPIDActive(PVM pVM);
116VMMR3DECL(int) HMR3InjectNMI(PVM pVM);
117VMMR3DECL(int) HMR3EmulateIoBlock(PVM pVM, PCPUMCTX pCtx);
118VMMR3DECL(VBOXSTRICTRC) HMR3RestartPendingIOInstr(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
119VMMR3DECL(int) HMR3EnablePatching(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem);
120VMMR3DECL(int) HMR3DisablePatching(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem);
121VMMR3DECL(int) HMR3PatchTprInstr(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
122VMMR3DECL(bool) HMR3IsRescheduleRequired(PVM pVM, PCPUMCTX pCtx);
123VMMR3DECL(bool) HMR3IsVmxPreemptionTimerUsed(PVM pVM);
124
125/** @} */
126#endif /* IN_RING3 */
127
128#ifdef IN_RING0
129/** @addtogroup grp_hm_r0
130 * @{
131 */
132VMMR0DECL(int) HMR0SetupVM(PVM pVM);
133VMMR0DECL(int) HMR0RunGuestCode(PVM pVM, PVMCPU pVCpu);
134VMMR0DECL(int) HMR0Enter(PVM pVM, PVMCPU pVCpu);
135VMMR0DECL(int) HMR0Leave(PVM pVM, PVMCPU pVCpu);
136VMMR0DECL(int) HMR0InvalidatePage(PVM pVM, PVMCPU pVCpu);
137VMMR0DECL(int) HMR0FlushTLB(PVM pVM);
138VMMR0DECL(bool) HMR0SuspendPending(void);
139
140# if HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS)
141VMMR0DECL(int) HMR0SaveFPUState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
142VMMR0DECL(int) HMR0SaveDebugState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
143VMMR0DECL(int) HMR0TestSwitcher3264(PVM pVM);
144# endif
145
146/** @} */
147#endif /* IN_RING0 */
148
149
150/** @} */
151RT_C_DECLS_END
152
153
154#endif
155
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette