EMInternal.h revision ceec4276710e550e3d28840e12501f4da1e8ad7b
/* $Id$ */
/** @file
* EM - Internal header file.
*/
/*
* Copyright (C) 2006-2007 Oracle Corporation
*
* 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 ___EMInternal_h
#define ___EMInternal_h
#include <setjmp.h>
/** @defgroup grp_em_int Internal
* @ingroup grp_em
* @internal
* @{
*/
/** The saved state version. */
#define EM_SAVED_STATE_VERSION 4
#define EM_SAVED_STATE_VERSION_PRE_MWAIT 3
#define EM_SAVED_STATE_VERSION_PRE_SMP 2
/**
* MWait state flags.
*/
/* MWait activated. */
#define EMMWAIT_FLAG_ACTIVE RT_BIT(0)
/* MWait will continue when an interrupt is pending even when IF=0. */
/* Monitor instruction was executed previously. */
/** EM time slice in ms; used for capping execution time. */
#define EM_TIME_SLICE 100
/**
* Cli node structure
*/
typedef struct CLISTAT
{
/** The key is the cli address. */
/** Padding. */
#endif
/** Occurrences. */
#ifdef IN_RING3
#endif
/**
* Excessive EM statistics.
*/
typedef struct EMSTATS
{
/** GC: Profiling of EMInterpretInstruction(). */
/** HC: Profiling of EMInterpretInstruction(). */
/** @name Interpreter Instruction statistics.
* @{
*/
/** @} */
/** @name Privileged Instructions Ending Up In HC.
* @{ */
/** @} */
} EMSTATS;
/** Pointer to the excessive EM statistics. */
/**
* Converts a EM pointer into a VM pointer.
* @returns Pointer to the VM structure the EM is part of.
* @param pEM Pointer to EM instance data.
*/
/**
* EM VM Instance data.
* Changes to this must checked against the padding of the cfgm union in VM!
*/
typedef struct EM
{
/** Offset to the VM structure.
* See EM2VM(). */
/** Id of the VCPU that last executed code in the recompiler. */
#ifdef VBOX_WITH_REM
/** REM critical section.
* This protects recompiler usage
*/
#endif
} EM;
/** Pointer to EM VM instance data. */
/**
* EM VMCPU Instance data.
*/
typedef struct EMCPU
{
/** Offset to the VM structure.
* See EMCPU2VM(). */
/** Execution Manager State. */
/** Previous Execution Manager State. */
/** Force raw-mode execution.
* This is used to prevent REM from trying to execute patch code.
* The flag is cleared upon entering emR3RawExecute() and updated in certain return paths. */
bool fForceRAW;
/** Inhibit interrupts for this instruction. Valid only when VM_FF_INHIBIT_INTERRUPTS is set. */
/** Pointer to the PATM status structure. (R3 Ptr) */
/** Pointer to the guest CPUM state. (R3 Ptr) */
#if GC_ARCH_BITS == 64
#endif
/** Start of the current time slice in ms. */
/** Start of the current time slice in thread execution time (ms). */
/** Current time slice value. */
/* MWait halt state. */
struct
{
} mwait;
union
{
/** Padding used in the other rings.
* This must be larger than jmp_buf on any supported platform. */
#ifdef IN_RING3
/** Long buffer jump for fatal VM errors.
* It will jump to before the outer EM loop is entered. */
#endif
} u;
/** For saving stack space, the disassembler state is allocated here instead of
* on the stack.
union
{
/** The disassembler scratch space. */
/** Padding. */
};
/** @name Execution profiling.
* @{ */
/** @} */
/** R3: Profiling of emR3RawExecuteIOInstruction. */
/** R3: Profiling of emR3RawPrivileged. */
/** R3: Number of time emR3HwAccExecute is called. */
/** More statistics (R3). */
/** More statistics (R0). */
/** More statistics (RC). */
#if HC_ARCH_BITS == 64
#endif
/** Tree for keeping track of cli occurrences (debug only). */
#if 0
/** 64-bit Visual C++ rounds the struct size up to 16 byte. */
#endif
} EMCPU;
/** Pointer to EM VM instance data. */
/** @} */
#endif