em.h revision bb36345fae5a2e5fec487b9c9934b64797e31ac0
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/** @file
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * EM - Execution Monitor.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/*
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Copyright (C) 2006-2010 Oracle Corporation
4bff34e37def8a90f9194d81bc345c52ba20086athurlow *
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * This file is part of VirtualBox Open Source Edition (OSE), as
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * available from http://www.virtualbox.org. This file is free software;
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * you can redistribute it and/or modify it under the terms of the GNU
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * General Public License (GPL) as published by the Free Software
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Foundation, in version 2 as it comes in the "COPYING" file of the
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow *
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * The contents of this file may alternatively be used under the terms
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * of the Common Development and Distribution License Version 1.0
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * VirtualBox OSE distribution, in which case the provisions of the
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * CDDL are applicable instead of those of the GPL.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow *
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * You may elect to license modified versions of this file under the
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * terms and conditions of either the GPL or the CDDL or both.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#ifndef ___VBox_vmm_em_h
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#define ___VBox_vmm_em_h
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#include <VBox/types.h>
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#include <VBox/vmm/trpm.h>
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlowRT_C_DECLS_BEGIN
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/** @defgroup grp_em The Execution Monitor / Manager API
430b4c467020edf2445feb0c21db01c88b86243aGordon Ross * @{
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/** Enable to allow V86 code to run in raw mode. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#define VBOX_RAW_V86
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/**
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * The Execution Manager State.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow */
4bff34e37def8a90f9194d81bc345c52ba20086athurlowtypedef enum EMSTATE
4bff34e37def8a90f9194d81bc345c52ba20086athurlow{
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Not yet started. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMSTATE_NONE = 1,
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross /** Raw-mode execution. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMSTATE_RAW,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Hardware accelerated raw-mode execution. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMSTATE_HWACC,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Recompiled mode execution. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMSTATE_REM,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Execution is halted. (waiting for interrupt) */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMSTATE_HALTED,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Application processor execution is halted. (waiting for startup IPI (SIPI)) */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMSTATE_WAIT_SIPI,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Execution is suspended. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMSTATE_SUSPENDED,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** The VM is terminating. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMSTATE_TERMINATING,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Guest debug event from raw-mode is being processed. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMSTATE_DEBUG_GUEST_RAW,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Guest debug event from hardware accelerated mode is being processed. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMSTATE_DEBUG_GUEST_HWACC,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Guest debug event from recompiled-mode is being processed. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMSTATE_DEBUG_GUEST_REM,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Hypervisor debug event being processed. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMSTATE_DEBUG_HYPER,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** The VM has encountered a fatal error. (And everyone is panicing....) */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMSTATE_GURU_MEDITATION,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Just a hack to ensure that we get a 32-bit integer. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMSTATE_MAKE_32BIT_HACK = 0x7fffffff
4bff34e37def8a90f9194d81bc345c52ba20086athurlow} EMSTATE;
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/**
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * EMInterpretInstructionCPUEx execution modes.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow */
4bff34e37def8a90f9194d81bc345c52ba20086athurlowtypedef enum
4bff34e37def8a90f9194d81bc345c52ba20086athurlow{
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Only supervisor code (CPL=0). */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMCODETYPE_SUPERVISOR,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** User-level code only. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMCODETYPE_USER,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Supervisor and user-level code (use with great care!). */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMCODETYPE_ALL,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Just a hack to ensure that we get a 32-bit integer. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMCODETYPE_32BIT_HACK = 0x7fffffff
4bff34e37def8a90f9194d81bc345c52ba20086athurlow} EMCODETYPE;
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(EMSTATE) EMGetState(PVMCPU pVCpu);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(void) EMSetState(PVMCPU pVCpu, EMSTATE enmNewState);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/** @name Callback handlers for instruction emulation functions.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * These are placed here because IOM wants to use them as well.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @{
4bff34e37def8a90f9194d81bc345c52ba20086athurlow */
4bff34e37def8a90f9194d81bc345c52ba20086athurlowtypedef DECLCALLBACK(uint32_t) FNEMULATEPARAM2UINT32(void *pvParam1, uint64_t val2);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowtypedef FNEMULATEPARAM2UINT32 *PFNEMULATEPARAM2UINT32;
4bff34e37def8a90f9194d81bc345c52ba20086athurlowtypedef DECLCALLBACK(uint32_t) FNEMULATEPARAM2(void *pvParam1, size_t val2);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowtypedef FNEMULATEPARAM2 *PFNEMULATEPARAM2;
4bff34e37def8a90f9194d81bc345c52ba20086athurlowtypedef DECLCALLBACK(uint32_t) FNEMULATEPARAM3(void *pvParam1, uint64_t val2, size_t val3);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowtypedef FNEMULATEPARAM3 *PFNEMULATEPARAM3;
4bff34e37def8a90f9194d81bc345c52ba20086athurlowtypedef DECLCALLBACK(int) FNEMULATELOCKPARAM2(void *pvParam1, uint64_t val2, RTGCUINTREG32 *pf);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowtypedef FNEMULATELOCKPARAM2 *PFNEMULATELOCKPARAM2;
4bff34e37def8a90f9194d81bc345c52ba20086athurlowtypedef DECLCALLBACK(int) FNEMULATELOCKPARAM3(void *pvParam1, uint64_t val2, size_t cb, RTGCUINTREG32 *pf);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowtypedef FNEMULATELOCKPARAM3 *PFNEMULATELOCKPARAM3;
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/** @} */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/**
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Checks if raw ring-3 execute mode is enabled.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow *
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @returns true if enabled.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @returns false if disabled.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @param pVM The VM to operate on.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#define EMIsRawRing3Enabled(pVM) (!(pVM)->fRecompileUser)
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/**
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * Checks if raw ring-0 execute mode is enabled.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow *
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @returns true if enabled.
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross * @returns false if disabled.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @param pVM The VM to operate on.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#define EMIsRawRing0Enabled(pVM) (!(pVM)->fRecompileSupervisor)
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/**
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Checks if execution with hardware assisted virtualization is enabled.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow *
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @returns true if enabled.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @returns false if disabled.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @param pVM The VM to operate on.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#define EMIsHwVirtExecutionEnabled(pVM) (!(pVM)->fRecompileSupervisor && !(pVM)->fRecompileSupervisor)
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(void) EMSetInhibitInterruptsPC(PVMCPU pVCpu, RTGCUINTPTR PC);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(RTGCUINTPTR) EMGetInhibitInterruptsPC(PVMCPU pVCpu);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretDisasOne(PVM pVM, PVMCPU pVCpu, PCCPUMCTXCORE pCtxCore, PDISCPUSTATE pCpu, unsigned *pcbInstr);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretDisasOneEx(PVM pVM, PVMCPU pVCpu, RTGCUINTPTR GCPtrInstr, PCCPUMCTXCORE pCtxCore,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow PDISCPUSTATE pDISState, unsigned *pcbInstr);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(VBOXSTRICTRC) EMInterpretInstruction(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(VBOXSTRICTRC) EMInterpretInstructionCPU(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDISState, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, EMCODETYPE enmCodeType, uint32_t *pcbSize);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretCpuId(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretRdtsc(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretRdpmc(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretRdtscp(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(VBOXSTRICTRC) EMInterpretInvlpg(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCPTR pAddrGC);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretIret(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(VBOXSTRICTRC) EMInterpretMWait(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretMonitor(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretDRxWrite(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t DestRegDrx, uint32_t SrcRegGen);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretDRxRead(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t DestRegGen, uint32_t SrcRegDrx);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretCRxWrite(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t DestRegCrx, uint32_t SrcRegGen);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretCRxRead(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t DestRegGen, uint32_t SrcRegCrx);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretLMSW(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint16_t u16Data);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretCLTS(PVM pVM, PVMCPU pVCpu);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(VBOXSTRICTRC) EMInterpretPortIO(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, PDISCPUSTATE pCpu, uint32_t cbOp);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretRdmsr(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMInterpretWrmsr(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(bool) EMShouldContinueAfterHalt(PVMCPU pVCpu, PCPUMCTX pCtx);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/** @name Assembly routines
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @{ */
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateCmp(uint32_t u32Param1, uint64_t u64Param2, size_t cb);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateAnd(void *pvParam1, uint64_t u64Param2, size_t cb);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateInc(void *pvParam1, size_t cb);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateDec(void *pvParam1, size_t cb);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateOr(void *pvParam1, uint64_t u64Param2, size_t cb);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMEmulateLockOr(void *pvParam1, uint64_t u64Param2, size_t cbSize, RTGCUINTREG32 *pf);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateXor(void *pvParam1, uint64_t u64Param2, size_t cb);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMEmulateLockXor(void *pvParam1, uint64_t u64Param2, size_t cbSize, RTGCUINTREG32 *pf);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateAdd(void *pvParam1, uint64_t u64Param2, size_t cb);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMEmulateLockAnd(void *pvParam1, uint64_t u64Param2, size_t cbSize, RTGCUINTREG32 *pf);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateSub(void *pvParam1, uint64_t u64Param2, size_t cb);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateAdcWithCarrySet(void *pvParam1, uint64_t u64Param2, size_t cb);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateBtr(void *pvParam1, uint64_t u64Param2);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMEmulateLockBtr(void *pvParam1, uint64_t u64Param2, RTGCUINTREG32 *pf);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateBts(void *pvParam1, uint64_t u64Param2);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateBtc(void *pvParam1, uint64_t u64Param2);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateCmpXchg(void *pvParam1, uint64_t *pu32Param2, uint64_t u32Param3, size_t cbSize);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateLockCmpXchg(void *pvParam1, uint64_t *pu64Param2, uint64_t u64Param3, size_t cbSize);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateCmpXchg8b(void *pu32Param1, uint32_t *pEAX, uint32_t *pEDX, uint32_t uEBX, uint32_t uECX);
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon RossVMMDECL(uint32_t) EMEmulateLockCmpXchg8b(void *pu32Param1, uint32_t *pEAX, uint32_t *pEDX, uint32_t uEBX, uint32_t uECX);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateXAdd(void *pvParam1, void *pvParam2, size_t cbOp);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(uint32_t) EMEmulateLockXAdd(void *pvParam1, void *pvParam2, size_t cbOp);
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon Ross/** @} */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/** @name REM locking routines
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @{ */
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(void) EMRemUnlock(PVM pVM);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(void) EMRemLock(PVM pVM);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(bool) EMRemIsLockOwner(PVM pVM);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMDECL(int) EMRemTryLock(PVM pVM);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/** @} */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#ifdef IN_RING3
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/** @defgroup grp_em_r3 The EM Host Context Ring-3 API
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @ingroup grp_em
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @{
4bff34e37def8a90f9194d81bc345c52ba20086athurlow */
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon RossVMMR3DECL(int) EMR3Init(PVM pVM);
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon RossVMMR3DECL(void) EMR3Relocate(PVM pVM);
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon RossVMMR3DECL(void) EMR3ResetCpu(PVMCPU pVCpu);
613a2f6ba31e891e3d947a356daf5e563d43c1ceGordon RossVMMR3DECL(void) EMR3Reset(PVM pVM);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMR3DECL(int) EMR3Term(PVM pVM);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMR3DECL(DECLNORETURN(void)) EMR3FatalError(PVMCPU pVCpu, int rc);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMR3DECL(int) EMR3ExecuteVM(PVM pVM, PVMCPU pVCpu);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMR3DECL(int) EMR3CheckRawForcedActions(PVM pVM, PVMCPU pVCpu);
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMR3DECL(int) EMR3Interpret(PVM pVM);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/**
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * Command argument for EMR3RawSetMode().
4bff34e37def8a90f9194d81bc345c52ba20086athurlow *
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * It's possible to extend this interface to change several
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * execution modes at once should the need arise.
4bff34e37def8a90f9194d81bc345c52ba20086athurlow */
4bff34e37def8a90f9194d81bc345c52ba20086athurlowtypedef enum EMEXECPOLICY
4bff34e37def8a90f9194d81bc345c52ba20086athurlow{
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** The customary invalid zero entry. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMEXECPOLICY_INVALID = 0,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Whether to recompile ring-0 code or execute it in raw/hm. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMEXECPOLICY_RECOMPILE_RING0,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** Whether to recompile ring-3 code or execute it in raw/hm. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMEXECPOLICY_RECOMPILE_RING3,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** End of valid value (not included). */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMEXECPOLICY_END,
4bff34e37def8a90f9194d81bc345c52ba20086athurlow /** The customary 32-bit type blowup. */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow EMEXECPOLICY_32BIT_HACK = 0x7fffffff
4bff34e37def8a90f9194d81bc345c52ba20086athurlow} EMEXECPOLICY;
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMR3DECL(int) EMR3SetExecutionPolicy(PVM pVM, EMEXECPOLICY enmPolicy, bool fEnforce);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/** @} */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#endif /* IN_RING3 */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#ifdef IN_RC
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/** @defgroup grp_em_gc The EM Guest Context API
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @ingroup grp_em
4bff34e37def8a90f9194d81bc345c52ba20086athurlow * @{
4bff34e37def8a90f9194d81bc345c52ba20086athurlow */
4bff34e37def8a90f9194d81bc345c52ba20086athurlowVMMRCDECL(int) EMGCTrap(PVM pVM, unsigned uTrap, PCPUMCTXCORE pRegFrame);
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/** @} */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#endif /* IN_RC */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow/** @} */
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlowRT_C_DECLS_END
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow#endif
4bff34e37def8a90f9194d81bc345c52ba20086athurlow
4bff34e37def8a90f9194d81bc345c52ba20086athurlow