HWACCMInternal.h revision b45d66c0e496e2fd861479202f3d43aad592bd14
/* $Id$ */
/** @file
* HWACCM - Internal header file.
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#ifndef ___HWACCMInternal_h
#define ___HWACCMInternal_h
/** @defgroup grp_hwaccm_int Internal
* @ingroup grp_hwaccm
* @internal
* @{
*/
/**
* Converts a HWACCM pointer into a VM pointer.
* @returns Pointer to the VM structure the EM is part of.
* @param pHWACCM Pointer to HWACCM instance data.
*/
/** Maximum number of exit reason statistics counters. */
#define MAX_EXITREASON_STAT 0x100
#define MASK_EXITREASON_STAT 0xff
/** @name Changed flags
* These flags are used to keep track of which important registers that
* have been changed since last they were reset.
* @{
*/
#define HWACCM_CHANGED_GUEST_FPU RT_BIT(0)
#define HWACCM_CHANGED_ALL ( HWACCM_CHANGED_GUEST_SEGMENT_REGS \
/** @} */
/** @name Intercepted traps
* Traps that need to be intercepted so we can correctly dispatch them to the guest if required.
* Currently #NM and #PF only
*/
#ifdef VBOX_STRICT
#define HWACCM_VMX_TRAP_MASK RT_BIT(0) | RT_BIT(7) | RT_BIT(14) | RT_BIT(6) | RT_BIT(11) | RT_BIT(12) | RT_BIT(13) | RT_BIT(16)
#else
#endif
/** @} */
/** Maxium resume loops allowed in ring 0 (safety precaution) */
#define HWACCM_MAX_RESUME_LOOPS 1024
/** HWACCM SSM version
*/
#define HWACCM_SSM_VERSION 3
/**
* HWACCM VM Instance data.
* Changes to this must checked against the padding of the cfgm union in VM!
*/
typedef struct HWACCM
{
/** Offset to the VM structure.
* See HWACCM2VM(). */
/** Set when we've initialized VMX or SVM. */
bool fInitialized;
bool fActive;
/** Set when hardware acceleration is allowed. */
bool fAllowed;
/** HWACCM_CHANGED_* flags. */
/** Old style FPU reporting trap mask override performed (optimization) */
struct
{
/** Set by the ring-0 driver to indicate VMX is supported by the CPU. */
bool fSupported;
/** Set when we've enabled VMX. */
bool fEnabled;
/** Set if we can use VMXResume to execute guest code. */
bool fResumeVM;
/** R0 memory object for the VM control structure (VMCS). */
/** Physical address of the VM control structure (VMCS). */
/** Virtual address of the VM control structure (VMCS). */
/** R0 memory object for the TSS page used for real mode emulation. */
/** Physical address of the TSS page used for real mode emulation. */
/** Virtual address of the TSS page used for real mode emulation. */
/** Host CR4 value (set by ring-0 VMX init) */
/** Current VMX_VMCS_CTRL_PROC_EXEC_CONTROLS. */
/** Current CR0 mask. */
/** Current CR4 mask. */
/** VMX MSR values */
struct
{
} msr;
/* Last instruction error */
} vmx;
struct
{
/** Set by the ring-0 driver to indicate SVM is supported by the CPU. */
bool fSupported;
/** Set when we've enabled SVM. */
bool fEnabled;
/** Set if we don't have to flush the TLB on VM entry. */
bool fResumeVM;
/** Set if erratum 170 affects the AMD cpu. */
bool fAlwaysFlushTLB;
/** Set if we need to flush the TLB during the world switch. */
bool fForceTLBFlush;
/** R0 memory object for the VM control block (VMCB). */
/** Physical address of the VM control block (VMCB). */
/** Virtual address of the VM control block (VMCB). */
/** R0 memory object for the host VM control block (VMCB). */
/** Physical address of the host VM control block (VMCB). */
/** Virtual address of the host VM control block (VMCB). */
/** R0 memory object for the IO bitmap (12kb). */
/** Physical address of the IO bitmap (12kb). */
/** Virtual address of the IO bitmap. */
/** R0 memory object for the MSR bitmap (8kb). */
/** Physical address of the MSR bitmap (8kb). */
/** Virtual address of the MSR bitmap. */
R0PTRTYPE(void *) pMSRBitmap;
/** SVM revision. */
/** Maximum ASID allowed. */
} svm;
struct
{
} cpuid;
/* Event injection state. */
struct
{
} Event;
/** Saved error from detection */
/** HWACCMR0Init was run */
bool fHWACCMR0Init;
/** Currenty shadow paging mode. */
} HWACCM;
/** Pointer to HWACCM VM instance data. */
#ifdef IN_RING0
#ifdef VBOX_STRICT
#else
#define HWACCMDumpRegs(a) do { } while (0)
#define HWACCMR0DumpDescriptor(a, b, c) do { } while (0)
#endif
#endif
/** @} */
#endif