HMInternal.h revision 5803cf4f0545c65d43221b7d13c78b1600924f1b
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * HM - Internal header file.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Copyright (C) 2006-2012 Oracle Corporation
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * available from http://www.virtualbox.org. This file is free software;
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * you can redistribute it and/or modify it under the terms of the GNU
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * General Public License (GPL) as published by the Free Software
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync#if HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBRID_32BIT_KERNEL) || defined (VBOX_WITH_64_BITS_GUESTS)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync/* Enable 64 bits guest support. */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync/* The MSR auto load/store does not work for KERNEL_GS_BASE MSR, thus we
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * handle this MSR manually. See @bugref{6208}. This is clearly visible while
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * booting Solaris 11 (11.1 b19) VMs with 2 Cpus.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Note: don't forget to update the assembly files while modifying this!
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync/** @defgroup grp_hm_int Internal
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @ingroup grp_hm
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * @internal
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync/** Maximum number of exit reason statistics counters. */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync/** @name Changed flags
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * These flags are used to keep track of which important registers that
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * have been changed since last they were reset.
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync#define HM_CHANGED_ALL_GUEST ( HM_CHANGED_GUEST_SEGMENT_REGS \
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync#define HM_CHANGED_ALL (HM_CHANGED_ALL_GUEST | HM_CHANGED_HOST_CONTEXT)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync/** Maximum number of page flushes we are willing to remember before considering a full TLB flush. */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync/** Size for the EPT identity page table (1024 4 MB pages to cover the entire address space). */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync/** Size of the TSS structure + 2 pages for the IO bitmap + end byte. */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync#define HM_VTX_TSS_SIZE (sizeof(VBOXTSS) + 2*PAGE_SIZE + 1)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync/** Total guest mapped memory needed. */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync#define HM_VTX_TOTAL_DEVHEAP_MEM (HM_EPT_IDENTITY_PG_TABLE_SIZE + HM_VTX_TSS_SIZE)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync/** Enable for TPR guest patching. */
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync/** HM SSM version
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync * Global per-cpu information. (host)
96a93b5e6bd7da64f6be955c9fd7569b80c8ae2evboxsync /** The CPU ID. */
bool fFlushAsidBeforeUse;
bool fConfigured;
bool fIgnoreAMDVInUseError;
volatile bool fInUse;
HMPENDINGIO_INVALID = 0,
} HMPENDINGIO;
} HMTPRINSTR;
} HMTPRPATCH;
typedef struct HM
bool fInitialized;
bool fAllowed;
bool fNestedPaging;
bool fAllowNestedPaging;
bool fLargePages;
bool fAllow64BitGuests;
bool fHasIoApic;
bool fTRPPatchingAllowed;
bool fGlobalInit;
bool fTPRPatchingActive;
#if HC_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS) && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
bool fSupported;
bool fEnabled;
bool fVpid;
bool fAllowVpid;
bool fUnrestrictedGuest;
bool fUsePreemptTimer;
/** Virtual address of the identity page table used for real mode and protected mode without paging emulation in EPT mode. */
#ifdef VBOX_WITH_CRASHDUMP_MAGIC
} msr;
} vmx;
bool fSupported;
bool fEnabled;
bool fAlwaysFlushTLB;
bool fIgnoreInUseError;
} svm;
} cpuid;
bool fHMR0Init;
} HM;
typedef struct VMCSCACHE
#ifdef VBOX_WITH_CRASHDUMP_MAGIC
} Write;
} Read;
#ifdef DEBUG
} TestIn;
} TestOut;
} ScratchPad;
} VMCSCACHE;
typedef DECLCALLBACK(int) FNHMVMXSTARTVM(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache, PVM pVM, PVMCPU pVCpu);
typedef DECLCALLBACK(int) FNHMSVMVMRUN(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu);
typedef struct HMCPU
bool fFPUOldStyleOverride;
bool fResumeVM;
bool fForceTLBFlush;
bool fActive;
volatile bool fCheckedTLBFlush;
} RealMode;
} lasterror;
} vmx;
} svm;
} Event;
bool fEnabled;
unsigned uPort;
unsigned uAndVal;
unsigned cbSize;
} Port;
} PendingIO;
unsigned cPages;
} TlbShootdown;
#if HC_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS) && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
#if HC_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS) && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
#ifdef VBOX_WITH_STATISTICS
} HMCPU;
#ifdef IN_RING0
#ifdef VBOX_STRICT
# define HMDumpRegs(a, b ,c) do { } while (0)
# define HMR0DumpDescriptor(a, b, c) do { } while (0)
# ifdef VBOX_WITH_KERNEL_USING_XMM
DECLASM(int) hmR0VMXStartVMWrapXMM(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache, PVM pVM, PVMCPU pVCpu, PFNHMVMXSTARTVM pfnStartVM);
DECLASM(int) hmR0SVMRunWrapXMM(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu, PFNHMSVMVMRUN pfnVMRun);
# ifdef VBOX_WITH_HYBRID_32BIT_KERNEL