VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMR0/HWVMXR0.h@ 45907

Last change on this file since 45907 was 45904, checked in by vboxsync, 12 years ago

VMM/HMVMXR0: Fixes for pure 32-bit darwin hosts (not hybrid) with better identification and separation of guest-natural, host-natural fields.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.4 KB
Line 
1/* $Id: HWVMXR0.h 45904 2013-05-06 11:53:53Z vboxsync $ */
2/** @file
3 * HM VMX (VT-x) - Internal header file.
4 */
5
6/*
7 * Copyright (C) 2006-2013 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 ___HWVMXR0_h
19#define ___HWVMXR0_h
20
21RT_C_DECLS_BEGIN
22
23/** @defgroup grp_vmx_int Internal
24 * @ingroup grp_vmx
25 * @internal
26 * @{
27 */
28
29#ifdef IN_RING0
30
31VMMR0DECL(int) VMXR0Enter(PVM pVM, PVMCPU pVCpu, PHMGLOBLCPUINFO pCpu);
32VMMR0DECL(int) VMXR0Leave(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
33VMMR0DECL(int) VMXR0EnableCpu(PHMGLOBLCPUINFO pCpu, PVM pVM, void *pvPageCpu, RTHCPHYS pPageCpuPhys, bool fEnabledBySystem);
34VMMR0DECL(int) VMXR0DisableCpu(PHMGLOBLCPUINFO pCpu, void *pvPageCpu, RTHCPHYS pPageCpuPhys);
35VMMR0DECL(int) VMXR0GlobalInit(void);
36VMMR0DECL(void) VMXR0GlobalTerm(void);
37VMMR0DECL(int) VMXR0InitVM(PVM pVM);
38VMMR0DECL(int) VMXR0TermVM(PVM pVM);
39VMMR0DECL(int) VMXR0SetupVM(PVM pVM);
40VMMR0DECL(int) VMXR0SaveHostState(PVM pVM, PVMCPU pVCpu);
41VMMR0DECL(int) VMXR0LoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
42VMMR0DECL(int) VMXR0RunGuestCode(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
43DECLASM(int) VMXR0StartVM32(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache, PVM pVM, PVMCPU pVCpu);
44DECLASM(int) VMXR0StartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache, PVM pVM, PVMCPU pVCpu);
45
46# if HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS) && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
47DECLASM(int) VMXR0SwitcherStartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache, PVM pVM, PVMCPU pVCpu);
48VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, HM64ON32OP enmOp, uint32_t cbParam,
49 uint32_t *paParam);
50# endif
51
52/* Cached VMCS accesses -- defined always in the old VT-x code, defined only for 32 hosts on new code. */
53#ifdef VMX_USE_CACHED_VMCS_ACCESSES
54VMMR0DECL(int) VMXWriteCachedVmcsEx(PVMCPU pVCpu, uint32_t idxField, uint64_t u64Val);
55
56DECLINLINE(int) VMXReadCachedVmcsEx(PVMCPU pVCpu, uint32_t idxCache, RTGCUINTREG *pVal)
57{
58 Assert(idxCache <= VMX_VMCS_MAX_NESTED_PAGING_CACHE_IDX);
59 *pVal = pVCpu->hm.s.vmx.VMCSCache.Read.aFieldVal[idxCache];
60 return VINF_SUCCESS;
61}
62#endif
63
64#ifdef VBOX_WITH_OLD_VTX_CODE
65# ifdef VMX_USE_CACHED_VMCS_ACCESSES
66# define VMXReadCachedVmcs(idxField, pVal) VMXReadCachedVmcsEx(pVCpu, idxField##_CACHE_IDX, pVal)
67# else
68# define VMXReadCachedVmcs VMXReadVmcsField
69# endif
70# define VMXReadVmcs VMXReadVmcsField
71#else /* !VBOX_WITH_OLD_VTX_CODE */
72# ifdef VBOX_WITH_HYBRID_32BIT_KERNEL
73# define VMXReadVmcsHstN(idxField, pVal) HMVMX_IS_64BIT_HOST_MODE() ? \
74 VMXReadVmcs64(idxField, pVal) \
75 : VMXReadVmcs32(idxField, (uint32_t *)pVal)
76# define VMXReadVmcsGstN(idxField, pVal) (pVCpu->CTX_SUFF(pVM)->hm.s.fAllow64BitGuests) ? \
77 VMXReadVmcs64(idxField, pVal) \
78 : VMXReadVmcs32(idxField, (uint32_t *)pVal)
79# define VMXReadVmcsGstNByIdxVal(idxField, pVal) VMXReadVmcsGstN(idxField, pVal)
80# elif HC_ARCH_BITS == 32
81# define VMXReadVmcsHstN VMXReadVmcs32
82# define VMXReadVmcsGstN(idxField, pVal) VMXReadCachedVmcsEx(pVCpu, idxField##_CACHE_IDX, pVal)
83# define VMXReadVmcsGstNByIdxVal(idxField, pVal) VMXReadCachedVmcsEx(pVCpu, idxField, pVal)
84# else /* HC_ARCH_BITS == 64 */
85# define VMXReadVmcsHstN VMXReadVmcs64
86# define VMXReadVmcsGstN VMXReadVmcs64
87# define VMXReadVmcsGstNByIdxVal VMXReadVmcs64
88# endif
89#endif /* !VBOX_WITH_OLD_VTX_CODE */
90
91#endif /* IN_RING0 */
92
93/** @} */
94
95RT_C_DECLS_END
96
97#endif /* ___HWVMXR0_h */
98
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