HWACCMInternal.h revision cbeafe5b35cc2bf5ab239f08d3a7b53b31ef191d
/* $Id$ */
/** @file
* HWACCM - Internal header file.
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* 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.
*/
#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;
/** Physical address of the VM control structure (VMCS). */
/** Virtual address of the VM control structure (VMCS). */
void *pVMCS;
/** 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;
/** Physical address of the VM control block (VMCB). */
/** Virtual address of the VM control block (VMCB). */
void *pVMCB;
/** Physical address of the host VM control block (VMCB). */
/** Virtual address of the host VM control block (VMCB). */
void *pVMCBHost;
/** Physical address of the IO bitmap (12kb). */
/** Virtual address of the IO bitmap. */
void *pIOBitmap;
/** Physical address of the MSR bitmap (8kb). */
/** Virtual address of the MSR bitmap. */
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