iom.h revision 62984798ef379bf4be6c0ecbb3e61d3d8e30dcec
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync/** @file
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * IOM - Input / Output Monitor.
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync */
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync/*
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * Copyright (C) 2006-2010 Oracle Corporation
e64031e20c39650a7bc902a3e1aba613b9415deevboxsync *
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * available from http://www.virtualbox.org. This file is free software;
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * General Public License (GPL) as published by the Free Software
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync *
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * The contents of this file may alternatively be used under the terms
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * of the Common Development and Distribution License Version 1.0
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * VirtualBox OSE distribution, in which case the provisions of the
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * CDDL are applicable instead of those of the GPL.
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync *
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * You may elect to license modified versions of this file under the
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * terms and conditions of either the GPL or the CDDL or both.
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync */
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync#ifndef ___VBox_vmm_iom_h
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsync#define ___VBox_vmm_iom_h
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync#include <VBox/types.h>
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync#include <VBox/dis.h>
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsyncRT_C_DECLS_BEGIN
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** @defgroup grp_iom The Input / Ouput Monitor API
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * @{
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** @def IOM_NO_PDMINS_CHECKS
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * Until all devices have been fully adjusted to PDM style, the pPdmIns
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * parameter is not checked by IOM.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @todo Check this again, now.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync */
7af218a7441de38fc9e814919db04bae3e917664vboxsync#define IOM_NO_PDMINS_CHECKS
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync/**
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * Macro for checking if an I/O or MMIO emulation call succeeded.
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync *
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * This macro shall only be used with the IOM APIs where it's mentioned
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * in the return value description. And there it must be used to correctly
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * determine if the call succeeded and things like the RIP needs updating.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync *
1c822ec4298d5d20b0fb1cc20346c5d4e4e596bfvboxsync *
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @returns Success indicator (true/false).
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync *
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @param rc The status code. This may be evaluated
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * more than once!
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync *
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @remark To avoid making assumptions about the layout of the
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * VINF_EM_FIRST...VINF_EM_LAST range we're checking
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * explicitly for each for exach the exceptions.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * However, for efficieny we ASSUME that the
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * VINF_EM_LAST is smaller than most of the relevant
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * status codes. We also ASSUME that the
1c822ec4298d5d20b0fb1cc20346c5d4e4e596bfvboxsync * VINF_EM_RESCHEDULE_REM status code is the most
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * frequent status code we'll enounter in this range.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync *
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @todo Will have to add VINF_EM_DBG_HYPER_BREAKPOINT if the
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * I/O port and MMIO breakpoints should trigger before
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * the I/O is done. Currently, we don't implement these
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * kind of breakpoints.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync#define IOM_SUCCESS(rc) ( (rc) == VINF_SUCCESS \
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync || ( (rc) <= VINF_EM_LAST \
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync && (rc) != VINF_EM_RESCHEDULE_REM \
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync && (rc) >= VINF_EM_FIRST \
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync && (rc) != VINF_EM_RESCHEDULE_RAW \
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync && (rc) != VINF_EM_RESCHEDULE_HM \
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync ) \
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync )
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** @name IOMMMIO_FLAGS_XXX
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @{ */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** Pass all reads thru unmodified. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync#define IOMMMIO_FLAGS_READ_PASSTHRU UINT32_C(0x00000000)
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** All read accesses are DWORD sized (32-bit). */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync#define IOMMMIO_FLAGS_READ_DWORD UINT32_C(0x00000001)
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** All read accesses are DWORD (32-bit) or QWORD (64-bit) sized.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * Only accesses that are both QWORD sized and aligned are performed as QWORD.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * All other access will be done DWORD fashion (because it is way simpler). */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync#define IOMMMIO_FLAGS_READ_DWORD_QWORD UINT32_C(0x00000002)
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** The read access mode mask. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync#define IOMMMIO_FLAGS_READ_MODE UINT32_C(0x00000003)
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** Pass all writes thru unmodified. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync#define IOMMMIO_FLAGS_WRITE_PASSTHRU UINT32_C(0x00000000)
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** All write accesses are DWORD (32-bit) sized and unspecified bytes are
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * written as zero. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync#define IOMMMIO_FLAGS_WRITE_DWORD_ZEROED UINT32_C(0x00000010)
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** All write accesses are either DWORD (32-bit) or QWORD (64-bit) sized,
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * missing bytes will be written as zero. Only accesses that are both QWORD
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * sized and aligned are performed as QWORD, all other accesses will be done
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * DWORD fashion (because it's way simpler). */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync#define IOMMMIO_FLAGS_WRITE_DWORD_QWORD_ZEROED UINT32_C(0x00000020)
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** All write accesses are DWORD (32-bit) sized and unspecified bytes are
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * read from the device first as DWORDs.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @remarks This isn't how it happens on real hardware, but it allows
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * simplifications of devices where reads doesn't change the device
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * state in any way. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync#define IOMMMIO_FLAGS_WRITE_DWORD_READ_MISSING UINT32_C(0x00000030)
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** All write accesses are DWORD (32-bit) or QWORD (64-bit) sized and
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * unspecified bytes are read from the device first as DWORDs. Only accesses
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * that are both QWORD sized and aligned are performed as QWORD, all other
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * accesses will be done DWORD fashion (because it's way simpler).
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @remarks This isn't how it happens on real hardware, but it allows
7af218a7441de38fc9e814919db04bae3e917664vboxsync * simplifications of devices where reads doesn't change the device
7af218a7441de38fc9e814919db04bae3e917664vboxsync * state in any way. */
7af218a7441de38fc9e814919db04bae3e917664vboxsync#define IOMMMIO_FLAGS_WRITE_DWORD_QWORD_READ_MISSING UINT32_C(0x00000040)
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** The read access mode mask. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync#define IOMMMIO_FLAGS_WRITE_MODE UINT32_C(0x00000070)
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync
7af218a7441de38fc9e814919db04bae3e917664vboxsync/** Whether to do a DBGSTOP on complicated reads.
7af218a7441de38fc9e814919db04bae3e917664vboxsync * What this includes depends on the read mode, but generally all misaligned
7af218a7441de38fc9e814919db04bae3e917664vboxsync * reads as well as word and byte reads and maybe qword reads. */
7af218a7441de38fc9e814919db04bae3e917664vboxsync#define IOMMMIO_FLAGS_DBGSTOP_ON_COMPLICATED_READ UINT32_C(0x00000100)
7af218a7441de38fc9e814919db04bae3e917664vboxsync/** Whether to do a DBGSTOP on complicated writes.
7af218a7441de38fc9e814919db04bae3e917664vboxsync * This depends on the write mode, but generally all writes where we have to
7af218a7441de38fc9e814919db04bae3e917664vboxsync * supply bytes (zero them or read them). */
7af218a7441de38fc9e814919db04bae3e917664vboxsync#define IOMMMIO_FLAGS_DBGSTOP_ON_COMPLICATED_WRITE UINT32_C(0x00000200)
7af218a7441de38fc9e814919db04bae3e917664vboxsync
7af218a7441de38fc9e814919db04bae3e917664vboxsync/** Mask of valid flags. */
7af218a7441de38fc9e814919db04bae3e917664vboxsync#define IOMMMIO_FLAGS_VALID_MASK UINT32_C(0x00000373)
7af218a7441de38fc9e814919db04bae3e917664vboxsync/** @} */
7af218a7441de38fc9e814919db04bae3e917664vboxsync
7af218a7441de38fc9e814919db04bae3e917664vboxsync
7af218a7441de38fc9e814919db04bae3e917664vboxsync/**
7af218a7441de38fc9e814919db04bae3e917664vboxsync * Port I/O Handler for IN operations.
7af218a7441de38fc9e814919db04bae3e917664vboxsync *
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @returns VINF_SUCCESS or VINF_EM_*.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @returns VERR_IOM_IOPORT_UNUSED if the port is really unused and a ~0 value should be returned.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync *
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param pDevIns The device instance.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param pvUser User argument.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param uPort Port number used for the IN operation.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param pu32 Where to store the result. This is always a 32-bit
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * variable regardless of what @a cb might say.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param cb Number of bytes read.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @remarks Caller enters the device critical section.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync */
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsynctypedef DECLCALLBACK(int) FNIOMIOPORTIN(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb);
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync/** Pointer to a FNIOMIOPORTIN(). */
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsynctypedef FNIOMIOPORTIN *PFNIOMIOPORTIN;
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync/**
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * Port I/O Handler for string IN operations.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync *
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @returns VINF_SUCCESS or VINF_EM_*.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @returns VERR_IOM_IOPORT_UNUSED if the port is really unused and a ~0 value should be returned.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync *
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param pDevIns The device instance.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param pvUser User argument.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param uPort Port number used for the IN operation.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param pGCPtrDst Pointer to the destination buffer (GC, incremented appropriately).
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param pcTransfers Pointer to the number of transfer units to read, on return remaining transfer units.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param cb Size of the transfer unit (1, 2 or 4 bytes).
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @remarks Caller enters the device critical section.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync */
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsynctypedef DECLCALLBACK(int) FNIOMIOPORTINSTRING(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, RTGCPTR *pGCPtrDst, PRTGCUINTREG pcTransfers, unsigned cb);
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync/** Pointer to a FNIOMIOPORTINSTRING(). */
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsynctypedef FNIOMIOPORTINSTRING *PFNIOMIOPORTINSTRING;
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync/**
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * Port I/O Handler for OUT operations.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync *
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @returns VINF_SUCCESS or VINF_EM_*.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync *
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param pDevIns The device instance.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param pvUser User argument.
7af218a7441de38fc9e814919db04bae3e917664vboxsync * @param uPort Port number used for the OUT operation.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param u32 The value to output.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param cb The value size in bytes.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @remarks Caller enters the device critical section.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync */
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsynctypedef DECLCALLBACK(int) FNIOMIOPORTOUT(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb);
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync/** Pointer to a FNIOMIOPORTOUT(). */
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsynctypedef FNIOMIOPORTOUT *PFNIOMIOPORTOUT;
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync/**
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * Port I/O Handler for string OUT operations.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync *
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @returns VINF_SUCCESS or VINF_EM_*.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync *
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param pDevIns The device instance.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param pvUser User argument.
7af218a7441de38fc9e814919db04bae3e917664vboxsync * @param uPort Port number used for the OUT operation.
7af218a7441de38fc9e814919db04bae3e917664vboxsync * @param pGCPtrSrc Pointer to the source buffer (GC, incremented appropriately).
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @param pcTransfers Pointer to the number of transfer units to write, on return remaining transfer units.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @param cb Size of the transfer unit (1, 2 or 4 bytes).
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @remarks Caller enters the device critical section.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsynctypedef DECLCALLBACK(int) FNIOMIOPORTOUTSTRING(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, RTGCPTR *pGCPtrSrc, PRTGCUINTREG pcTransfers, unsigned cb);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** Pointer to a FNIOMIOPORTOUTSTRING(). */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsynctypedef FNIOMIOPORTOUTSTRING *PFNIOMIOPORTOUTSTRING;
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/**
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * Memory mapped I/O Handler for read operations.
7af218a7441de38fc9e814919db04bae3e917664vboxsync *
7af218a7441de38fc9e814919db04bae3e917664vboxsync * @returns VBox status code.
7af218a7441de38fc9e814919db04bae3e917664vboxsync *
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @param pDevIns The device instance.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @param pvUser User argument.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @param GCPhysAddr Physical address (in GC) where the read starts.
7af218a7441de38fc9e814919db04bae3e917664vboxsync * @param pv Where to store the result.
7af218a7441de38fc9e814919db04bae3e917664vboxsync * @param cb Number of bytes read.
7af218a7441de38fc9e814919db04bae3e917664vboxsync * @remarks Caller enters the device critical section.
7af218a7441de38fc9e814919db04bae3e917664vboxsync */
7af218a7441de38fc9e814919db04bae3e917664vboxsynctypedef DECLCALLBACK(int) FNIOMMMIOREAD(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb);
7af218a7441de38fc9e814919db04bae3e917664vboxsync/** Pointer to a FNIOMMMIOREAD(). */
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsynctypedef FNIOMMMIOREAD *PFNIOMMMIOREAD;
7af218a7441de38fc9e814919db04bae3e917664vboxsync
7af218a7441de38fc9e814919db04bae3e917664vboxsync/**
7af218a7441de38fc9e814919db04bae3e917664vboxsync * Port I/O Handler for write operations.
7af218a7441de38fc9e814919db04bae3e917664vboxsync *
7af218a7441de38fc9e814919db04bae3e917664vboxsync * @returns VBox status code.
7af218a7441de38fc9e814919db04bae3e917664vboxsync *
7af218a7441de38fc9e814919db04bae3e917664vboxsync * @param pDevIns The device instance.
7af218a7441de38fc9e814919db04bae3e917664vboxsync * @param pvUser User argument.
7af218a7441de38fc9e814919db04bae3e917664vboxsync * @param GCPhysAddr Physical address (in GC) where the read starts.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param pv Where to fetch the result.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param cb Number of bytes to write.
7af218a7441de38fc9e814919db04bae3e917664vboxsync * @remarks Caller enters the device critical section.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync */
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsynctypedef DECLCALLBACK(int) FNIOMMMIOWRITE(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void const *pv, unsigned cb);
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync/** Pointer to a FNIOMMMIOWRITE(). */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsynctypedef FNIOMMMIOWRITE *PFNIOMMMIOWRITE;
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/**
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * Port I/O Handler for memset operations, actually for REP STOS* instructions handling.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync *
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @returns VBox status code.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync *
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @param pDevIns The device instance.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @param pvUser User argument.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @param GCPhysAddr Physical address (in GC) where the write starts.
20593760b116c90f3e439552763eef632a3bbb17vboxsync * @param u32Item Byte/Word/Dword data to fill.
20593760b116c90f3e439552763eef632a3bbb17vboxsync * @param cbItem Size of data in u32Item parameter, restricted to 1/2/4 bytes.
20593760b116c90f3e439552763eef632a3bbb17vboxsync * @param cItems Number of iterations.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @remarks Caller enters the device critical section.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync */
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsynctypedef DECLCALLBACK(int) FNIOMMMIOFILL(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, uint32_t u32Item, unsigned cbItem, unsigned cItems);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync/** Pointer to a FNIOMMMIOFILL(). */
20593760b116c90f3e439552763eef632a3bbb17vboxsynctypedef FNIOMMMIOFILL *PFNIOMMMIOFILL;
20593760b116c90f3e439552763eef632a3bbb17vboxsync
20593760b116c90f3e439552763eef632a3bbb17vboxsyncVMMDECL(VBOXSTRICTRC) IOMIOPortRead(PVM pVM, RTIOPORT Port, uint32_t *pu32Value, size_t cbValue);
20593760b116c90f3e439552763eef632a3bbb17vboxsyncVMMDECL(VBOXSTRICTRC) IOMIOPortWrite(PVM pVM, RTIOPORT Port, uint32_t u32Value, size_t cbValue);
20593760b116c90f3e439552763eef632a3bbb17vboxsyncVMMDECL(VBOXSTRICTRC) IOMInterpretOUT(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsyncVMMDECL(VBOXSTRICTRC) IOMInterpretIN(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsyncVMMDECL(VBOXSTRICTRC) IOMIOPortReadString(PVM pVM, RTIOPORT Port, PRTGCPTR pGCPtrDst, PRTGCUINTREG pcTransfers, unsigned cb);
20593760b116c90f3e439552763eef632a3bbb17vboxsyncVMMDECL(VBOXSTRICTRC) IOMIOPortWriteString(PVM pVM, RTIOPORT Port, PRTGCPTR pGCPtrSrc, PRTGCUINTREG pcTransfers, unsigned cb);
20593760b116c90f3e439552763eef632a3bbb17vboxsyncVMMDECL(VBOXSTRICTRC) IOMInterpretINS(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsyncVMMDECL(VBOXSTRICTRC) IOMInterpretINSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, DISCPUMODE enmAddrMode, uint32_t cbTransfer);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMDECL(VBOXSTRICTRC) IOMInterpretOUTS(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMDECL(VBOXSTRICTRC) IOMInterpretOUTSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, DISCPUMODE enmAddrMode, uint32_t cbTransfer);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMDECL(VBOXSTRICTRC) IOMMMIORead(PVM pVM, RTGCPHYS GCPhys, uint32_t *pu32Value, size_t cbValue);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMDECL(VBOXSTRICTRC) IOMMMIOWrite(PVM pVM, RTGCPHYS GCPhys, uint32_t u32Value, size_t cbValue);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMDECL(VBOXSTRICTRC) IOMMMIOPhysHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pCtxCore, RTGCPHYS GCPhysFault);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMDECL(VBOXSTRICTRC) IOMInterpretCheckPortIOAccess(PVM pVM, PCPUMCTXCORE pCtxCore, RTIOPORT Port, unsigned cb);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMDECL(int) IOMMMIOMapMMIO2Page(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysRemapped, uint64_t fPageFlags);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMDECL(int) IOMMMIOMapMMIOHCPage(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint64_t fPageFlags);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMDECL(int) IOMMMIOResetRegion(PVM pVM, RTGCPHYS GCPhys);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMDECL(bool) IOMIsLockOwner(PVM pVM);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync#ifdef IN_RC
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** @defgroup grp_iom_rc The IOM Raw-Mode Context API
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @ingroup grp_iom
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @{
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMRCDECL(VBOXSTRICTRC) IOMRCIOPortHandler(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** @} */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync#endif /* IN_RC */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync#ifdef IN_RING3
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** @defgroup grp_iom_r3 The IOM Host Context Ring-3 API
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @ingroup grp_iom
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @{
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMR3_INT_DECL(int) IOMR3Init(PVM pVM);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsyncVMMR3_INT_DECL(void) IOMR3Reset(PVM pVM);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMR3_INT_DECL(void) IOMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMR3_INT_DECL(int) IOMR3Term(PVM pVM);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMR3_INT_DECL(int) IOMR3IOPortRegisterR3(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts, RTHCPTR pvUser,
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync R3PTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, R3PTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync R3PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStringCallback, R3PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStringCallback,
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync const char *pszDesc);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMR3_INT_DECL(int) IOMR3IOPortRegisterRC(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts, RTRCPTR pvUser,
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync RCPTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, RCPTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync RCPTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback, RCPTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback,
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync const char *pszDesc);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsyncVMMR3_INT_DECL(int) IOMR3IOPortRegisterR0(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts, RTR0PTR pvUser,
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync R0PTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, R0PTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync R0PTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback, R0PTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback,
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsync const char *pszDesc);
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsyncVMMR3_INT_DECL(int) IOMR3IOPortDeregister(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts);
db55f7b1060a6a72704b5369a8e776c59e5e4f64vboxsync
db55f7b1060a6a72704b5369a8e776c59e5e4f64vboxsyncVMMR3_INT_DECL(int) IOMR3MmioRegisterR3(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange, RTHCPTR pvUser,
db55f7b1060a6a72704b5369a8e776c59e5e4f64vboxsync R3PTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallback,
db55f7b1060a6a72704b5369a8e776c59e5e4f64vboxsync R3PTRTYPE(PFNIOMMMIOREAD) pfnReadCallback,
db55f7b1060a6a72704b5369a8e776c59e5e4f64vboxsync R3PTRTYPE(PFNIOMMMIOFILL) pfnFillCallback,
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsync uint32_t fFlags, const char *pszDesc);
db55f7b1060a6a72704b5369a8e776c59e5e4f64vboxsyncVMMR3_INT_DECL(int) IOMR3MmioRegisterR0(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange, RTR0PTR pvUser,
db55f7b1060a6a72704b5369a8e776c59e5e4f64vboxsync R0PTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallback,
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync R0PTRTYPE(PFNIOMMMIOREAD) pfnReadCallback,
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync R0PTRTYPE(PFNIOMMMIOFILL) pfnFillCallback);
1c822ec4298d5d20b0fb1cc20346c5d4e4e596bfvboxsyncVMMR3_INT_DECL(int) IOMR3MmioRegisterRC(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange, RTGCPTR pvUser,
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync RCPTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallback,
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync RCPTRTYPE(PFNIOMMMIOREAD) pfnReadCallback,
aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32vboxsync RCPTRTYPE(PFNIOMMMIOFILL) pfnFillCallback);
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsyncVMMR3_INT_DECL(int) IOMR3MmioDeregister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t cbRange);
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync/** @} */
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync#endif /* IN_RING3 */
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync/** @} */
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsyncRT_C_DECLS_END
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync#endif
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync