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