65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/** @file
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * IEM - Interpreted Execution Manager.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/*
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync * Copyright (C) 2011-2012 Oracle Corporation
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync *
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * available from http://www.virtualbox.org. This file is free software;
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * you can redistribute it and/or modify it under the terms of the GNU
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * General Public License (GPL) as published by the Free Software
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync *
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * The contents of this file may alternatively be used under the terms
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * of the Common Development and Distribution License Version 1.0
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * VirtualBox OSE distribution, in which case the provisions of the
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * CDDL are applicable instead of those of the GPL.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync *
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * You may elect to license modified versions of this file under the
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * terms and conditions of either the GPL or the CDDL or both.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#ifndef ___VBox_vmm_iem_h
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#define ___VBox_vmm_iem_h
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#include <VBox/types.h>
a75c803e0b9f358a664e831c5deced4152847d66vboxsync#include <VBox/vmm/trpm.h>
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsync#include <iprt/assert.h>
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncRT_C_DECLS_BEGIN
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/** @defgroup grp_iem The Interpreted Execution Manager API.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * @{
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsync/**
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsync * Operand or addressing mode.
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsync */
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsynctypedef enum IEMMODE
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsync{
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsync IEMMODE_16BIT = 0,
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsync IEMMODE_32BIT,
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsync IEMMODE_64BIT
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsync} IEMMODE;
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsyncAssertCompileSize(IEMMODE, 4);
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
dde097c859b85aecb07cfe40f3359a0e90e7b206vboxsync/** @name IEM status codes.
dde097c859b85aecb07cfe40f3359a0e90e7b206vboxsync *
dde097c859b85aecb07cfe40f3359a0e90e7b206vboxsync * Not quite sure how this will play out in the end, just aliasing safe status
dde097c859b85aecb07cfe40f3359a0e90e7b206vboxsync * codes for now.
dde097c859b85aecb07cfe40f3359a0e90e7b206vboxsync *
dde097c859b85aecb07cfe40f3359a0e90e7b206vboxsync * @{ */
dde097c859b85aecb07cfe40f3359a0e90e7b206vboxsync#define VINF_IEM_RAISED_XCPT VINF_EM_RESCHEDULE
dde097c859b85aecb07cfe40f3359a0e90e7b206vboxsync/** @} */
dde097c859b85aecb07cfe40f3359a0e90e7b206vboxsync
dde097c859b85aecb07cfe40f3359a0e90e7b206vboxsync
a75c803e0b9f358a664e831c5deced4152847d66vboxsyncVMMDECL(VBOXSTRICTRC) IEMExecOne(PVMCPU pVCpu);
f3c5829ad9f0e1ea5b425d8bba8691925295ef50vboxsyncVMMDECL(VBOXSTRICTRC) IEMExecOneEx(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, uint32_t *pcbWritten);
040eebbbf0272a4d453d065b43f48d42ef65e85dvboxsyncVMMDECL(VBOXSTRICTRC) IEMExecOneWithPrefetchedByPC(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, uint64_t OpcodeBytesPC,
040eebbbf0272a4d453d065b43f48d42ef65e85dvboxsync const void *pvOpcodeBytes, size_t cbOpcodeBytes);
8de87f7db22211252c825b454da596a978fc5b05vboxsyncVMMDECL(VBOXSTRICTRC) IEMExecOneBypassEx(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, uint32_t *pcbWritten);
8de87f7db22211252c825b454da596a978fc5b05vboxsyncVMMDECL(VBOXSTRICTRC) IEMExecOneBypassWithPrefetchedByPC(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, uint64_t OpcodeBytesPC,
8de87f7db22211252c825b454da596a978fc5b05vboxsync const void *pvOpcodeBytes, size_t cbOpcodeBytes);
ceec4276710e550e3d28840e12501f4da1e8ad7bvboxsyncVMMDECL(VBOXSTRICTRC) IEMExecLots(PVMCPU pVCpu);
ab4300c9ac4361b720413deb095f04fccc481169vboxsyncVMMDECL(VBOXSTRICTRC) IEMInjectTrpmEvent(PVMCPU pVCpu);
ab4300c9ac4361b720413deb095f04fccc481169vboxsyncVMM_INT_DECL(VBOXSTRICTRC) IEMInjectTrap(PVMCPU pVCpu, uint8_t u8TrapNo, TRPMEVENT enmType, uint16_t uErrCode, RTGCPTR uCr2,
ab4300c9ac4361b720413deb095f04fccc481169vboxsync uint8_t cbInstr);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
ceec4276710e550e3d28840e12501f4da1e8ad7bvboxsyncVMM_INT_DECL(int) IEMBreakpointSet(PVM pVM, RTGCPTR GCPtrBp);
ceec4276710e550e3d28840e12501f4da1e8ad7bvboxsyncVMM_INT_DECL(int) IEMBreakpointClear(PVM pVM, RTGCPTR GCPtrBp);
ceec4276710e550e3d28840e12501f4da1e8ad7bvboxsync
f3c5829ad9f0e1ea5b425d8bba8691925295ef50vboxsync/** @name Given Instruction Interpreters
f3c5829ad9f0e1ea5b425d8bba8691925295ef50vboxsync * @{ */
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsyncVMM_INT_DECL(VBOXSTRICTRC) IEMExecStringIoWrite(PVMCPU pVCpu, uint8_t cbValue, IEMMODE enmAddrMode,
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsync bool fRepPrefix, uint8_t cbInstr, uint8_t iEffSeg);
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsyncVMM_INT_DECL(VBOXSTRICTRC) IEMExecStringIoRead(PVMCPU pVCpu, uint8_t cbValue, IEMMODE enmAddrMode,
45983ad0361cdc6b336c585eaf2ebd59f8d93cdavboxsync bool fRepPrefix, uint8_t cbInstr);
dde097c859b85aecb07cfe40f3359a0e90e7b206vboxsyncVMM_INT_DECL(VBOXSTRICTRC) IEMExecDecodedMovCRxWrite(PVMCPU pVCpu, uint8_t cbInstr, uint8_t iCrReg, uint8_t iGReg);
dde097c859b85aecb07cfe40f3359a0e90e7b206vboxsyncVMM_INT_DECL(VBOXSTRICTRC) IEMExecDecodedMovCRxRead(PVMCPU pVCpu, uint8_t cbInstr, uint8_t iGReg, uint8_t iCrReg);
dde097c859b85aecb07cfe40f3359a0e90e7b206vboxsyncVMM_INT_DECL(VBOXSTRICTRC) IEMExecDecodedClts(PVMCPU pVCpu, uint8_t cbInstr);
dde097c859b85aecb07cfe40f3359a0e90e7b206vboxsyncVMM_INT_DECL(VBOXSTRICTRC) IEMExecDecodedLmsw(PVMCPU pVCpu, uint8_t cbInstr, uint16_t uValue);
53b2cc239d6598a070c89f35be14772f71f81777vboxsyncVMM_INT_DECL(VBOXSTRICTRC) IEMExecDecodedXsetbv(PVMCPU pVCpu, uint8_t cbInstr);
f3c5829ad9f0e1ea5b425d8bba8691925295ef50vboxsync/** @} */
f3c5829ad9f0e1ea5b425d8bba8691925295ef50vboxsync
e41f0459369a6d814aa36bf4def225482fc56026vboxsync#if defined(IEM_VERIFICATION_MODE) && defined(IN_RING3)
e41f0459369a6d814aa36bf4def225482fc56026vboxsyncVMM_INT_DECL(void) IEMNotifyMMIORead(PVM pVM, RTGCPHYS GCPhys, size_t cbValue);
e41f0459369a6d814aa36bf4def225482fc56026vboxsyncVMM_INT_DECL(void) IEMNotifyMMIOWrite(PVM pVM, RTGCPHYS GCPhys, uint32_t u32Value, size_t cbValue);
e41f0459369a6d814aa36bf4def225482fc56026vboxsyncVMM_INT_DECL(void) IEMNotifyIOPortRead(PVM pVM, RTIOPORT Port, size_t cbValue);
e41f0459369a6d814aa36bf4def225482fc56026vboxsyncVMM_INT_DECL(void) IEMNotifyIOPortWrite(PVM pVM, RTIOPORT Port, uint32_t u32Value, size_t cbValue);
e41f0459369a6d814aa36bf4def225482fc56026vboxsyncVMM_INT_DECL(void) IEMNotifyIOPortReadString(PVM pVM, RTIOPORT Port, RTGCPTR GCPtrDst, RTGCUINTREG cTransfers, size_t cbValue);
e41f0459369a6d814aa36bf4def225482fc56026vboxsyncVMM_INT_DECL(void) IEMNotifyIOPortWriteString(PVM pVM, RTIOPORT Port, RTGCPTR GCPtrSrc, RTGCUINTREG cTransfers, size_t cbValue);
e41f0459369a6d814aa36bf4def225482fc56026vboxsync#endif
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
c1d279fc0865b91a40b30eda02ed14f6533fe1a4vboxsync/** @defgroup grp_iem_r3 The IEM Host Context Ring-3 API.
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync * @{
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncVMMR3DECL(int) IEMR3Init(PVM pVM);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncVMMR3DECL(int) IEMR3Term(PVM pVM);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncVMMR3DECL(void) IEMR3Relocate(PVM pVM);
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/** @} */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync/** @} */
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsyncRT_C_DECLS_END
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync#endif
65c72795ab90d3daefa759b716fbb5c6352c7a56vboxsync