HWACCMInternal.h revision 17ba03925269c071aa1567eb8c5a49c37a65f62f
/* $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 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.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
#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 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 BIT(0) | BIT(7) | BIT(14) | BIT(6) | BIT(11) | BIT(12) | BIT(13) | BIT(16)
#else
#endif
/** @} */
/** @name 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 VMXON page. */
/** Virtual address of the VMXON page. */
void *pVMXON;
/** 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 Host State page. */
/** Virtual address of the Host State page. */
void *pHState;
/** 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