HWACCMInternal.h revision 5c0c16a890a7447da4713a5e3eac208cbff325fe
236b2935f217749893b7034e59da3e3568928acevboxsync * HWACCM - Internal header file.
236b2935f217749893b7034e59da3e3568928acevboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
236b2935f217749893b7034e59da3e3568928acevboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
236b2935f217749893b7034e59da3e3568928acevboxsync * available from http://www.virtualbox.org. This file is free software;
236b2935f217749893b7034e59da3e3568928acevboxsync * you can redistribute it and/or modify it under the terms of the GNU
236b2935f217749893b7034e59da3e3568928acevboxsync * General Public License (GPL) as published by the Free Software
236b2935f217749893b7034e59da3e3568928acevboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
236b2935f217749893b7034e59da3e3568928acevboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
236b2935f217749893b7034e59da3e3568928acevboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
236b2935f217749893b7034e59da3e3568928acevboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
236b2935f217749893b7034e59da3e3568928acevboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
236b2935f217749893b7034e59da3e3568928acevboxsync * additional information or have any questions.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync/* Enable 64 bits guest support. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync/** @defgroup grp_hwaccm_int Internal
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * @ingroup grp_hwaccm
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * @internal
236b2935f217749893b7034e59da3e3568928acevboxsync/** Maximum number of exit reason statistics counters. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync/** @name Changed flags
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * These flags are used to keep track of which important registers that
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * have been changed since last they were reset.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync#define HWACCM_CHANGED_ALL ( HWACCM_CHANGED_GUEST_SEGMENT_REGS \
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync#define HWACCM_CHANGED_ALL_GUEST ( HWACCM_CHANGED_GUEST_SEGMENT_REGS \
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync/** @name Intercepted traps
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * Traps that need to be intercepted so we can correctly dispatch them to the guest if required.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * Currently #NM and #PF only
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync#define HWACCM_VMX_TRAP_MASK RT_BIT(X86_XCPT_DE) | RT_BIT(X86_XCPT_NM) | RT_BIT(X86_XCPT_PF) | RT_BIT(X86_XCPT_UD) | RT_BIT(X86_XCPT_NP) | RT_BIT(X86_XCPT_SS) | RT_BIT(X86_XCPT_GP) | RT_BIT(X86_XCPT_MF)
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync#define HWACCM_VMX_TRAP_MASK RT_BIT(X86_XCPT_NM) | RT_BIT(X86_XCPT_PF)
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync#define HWACCM_SVM_TRAP_MASK RT_BIT(X86_XCPT_NM) | RT_BIT(X86_XCPT_PF)
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync/* All exceptions have to be intercept in emulated real-mode (minues NM & PF as they are always intercepted. */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync#define HWACCM_VMX_TRAP_MASK_REALMODE RT_BIT(X86_XCPT_DE) | RT_BIT(X86_XCPT_DB) | RT_BIT(X86_XCPT_NMI) | RT_BIT(X86_XCPT_BP) | RT_BIT(X86_XCPT_OF) | RT_BIT(X86_XCPT_BR) | RT_BIT(X86_XCPT_UD) | RT_BIT(X86_XCPT_DF) | RT_BIT(X86_XCPT_CO_SEG_OVERRUN) | RT_BIT(X86_XCPT_TS) | RT_BIT(X86_XCPT_NP) | RT_BIT(X86_XCPT_SS) | RT_BIT(X86_XCPT_GP) | RT_BIT(X86_XCPT_MF) | RT_BIT(X86_XCPT_AC) | RT_BIT(X86_XCPT_MC) | RT_BIT(X86_XCPT_XF)
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync/** Maxium resume loops allowed in ring 0 (safety precaution) */
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync/** Size for the EPT identity page table (1024 4 MB pages to cover the entire address space). */
236b2935f217749893b7034e59da3e3568928acevboxsync/** Size of the TSS structure + 2 pages for the IO bitmap + end byte. */
236b2935f217749893b7034e59da3e3568928acevboxsync#define HWACCM_VTX_TSS_SIZE (sizeof(VBOXTSS) + 2*PAGE_SIZE + 1)
bool fFlushTLB;
bool fConfigured;
volatile bool fInUse;
uint64_t u;
typedef struct HWACCM
bool fInitialized;
bool fActive;
bool fAllowed;
bool fNestedPaging;
bool fAllowNestedPaging;
bool fAllowVPID;
bool fForceTLBFlush;
bool fFPUOldStyleOverride;
bool fSupported;
bool fEnabled;
bool fResumeVM;
bool fVPID;
/** Virtual address of the identity page table used for real mode and protected mode without paging emulation in EPT mode. */
} msr;
} RealMode;
} lasterror;
} vmx;
bool fSupported;
bool fEnabled;
bool fResumeVM;
bool fAlwaysFlushTLB;
} svm;
} cpuid;
} Event;
bool fHWACCMR0Init;
#ifdef VBOX_STRICT
} HWACCM;
typedef struct HWACCMCPU
} HWACCMCPU;
#ifdef IN_RING0
#ifdef VBOX_STRICT
#define HWACCMDumpRegs(a, b) do { } while (0)
#define HWACCMR0DumpDescriptor(a, b, c) do { } while (0)
VMMR0DECL(int) HWACCMR0DummyEnableCpu(PHWACCM_CPUINFO pCpu, PVM pVM, void *pvPageCpu, RTHCPHYS pPageCpuPhys);
VMMR0DECL(int) HWACCMR0DummyDisableCpu(PHWACCM_CPUINFO pCpu, void *pvPageCpu, RTHCPHYS pPageCpuPhys);