IOMAll.cpp revision f538fba0545047f77ad6b186d678330b5402825f
0N/A * available from http://www.virtualbox.org. This file is free software;
0N/A * Clara, CA 95054 USA or visit http://www.sun.com if you need
392N/A#include "IOMInternal.h"
0N/Abool iomGetRegImmData(PDISCPUSTATE pCpu, PCOP_PARAMETER pParam, PCPUMCTXCORE pRegFrame, uint64_t *pu64Data, unsigned *pcbSize)
0N/A if (pParam->flags & (USE_BASE | USE_INDEX | USE_SCALE | USE_DISPLACEMENT8 | USE_DISPLACEMENT16 | USE_DISPLACEMENT32))
0N/A AssertFailed();
0N/Abool iomSaveDataToReg(PDISCPUSTATE pCpu, PCOP_PARAMETER pParam, PCPUMCTXCORE pRegFrame, uint64_t u64Data)
0N/A if (pParam->flags & (USE_BASE | USE_INDEX | USE_SCALE | USE_DISPLACEMENT8 | USE_DISPLACEMENT16 | USE_DISPLACEMENT32 | USE_DISPLACEMENT64 | USE_IMMEDIATE8 | USE_IMMEDIATE16 | USE_IMMEDIATE32 | USE_IMMEDIATE32_SX8 | USE_IMMEDIATE16_SX8))
#ifdef VBOX_WITH_STATISTICS
switch (cb)
#ifdef VBOX_WITH_STATISTICS
if (pStats)
if ( !pRange
if (pRange)
#ifdef IN_GC
AssertMsg(!pRange || MMHyperIsInsideArea(pVM, (RTGCPTR)(RTRCUINTPTR)pRange), ("pRange = %VGv\n", pRange)); /** @todo r=bird: there is a macro for this which skips the #if'ing. */
if (pRange)
#ifndef IN_RING3
# ifdef VBOX_WITH_STATISTICS
if (pStats)
return VINF_IOM_HC_IOPORT_READ;
#ifdef VBOX_WITH_STATISTICS
if (pStats)
#ifdef VBOX_WITH_STATISTICS
if (pStats)
# ifndef IN_RING3
switch (cbValue)
return VERR_IOM_INVALID_IOPORT_SIZE;
return rc;
#ifndef IN_RING3
if (pRangeR3)
# ifdef VBOX_WITH_STATISTICS
if (pStats)
return VINF_IOM_HC_IOPORT_READ;
#ifdef VBOX_WITH_STATISTICS
if (pStats)
# ifndef IN_RING3
return VINF_IOM_HC_IOPORT_READ;
if (pStats)
switch (cbValue)
return VERR_IOM_INVALID_IOPORT_SIZE;
Log3(("IOMIOPortRead: Port=%RTiop *pu32=%08RX32 cb=%d rc=VINF_SUCCESS\n", Port, *pu32Value, cbValue));
return VINF_SUCCESS;
* @param pcTransfers Pointer to the number of transfer units to read, on return remaining transfer units.
IOMDECL(int) IOMIOPortReadString(PVM pVM, RTIOPORT Port, PRTGCPTR pGCPtrDst, PRTGCUINTREG pcTransfers, unsigned cb)
#ifdef LOG_ENABLED
#ifdef VBOX_WITH_STATISTICS
if (pStats)
if ( !pRange
if (pRange)
#ifdef IN_GC
Assert(!pRange || MMHyperIsInsideArea(pVM, (RTGCPTR)(RTRCUINTPTR)pRange)); /** @todo r=bird: there is a macro for this which skips the #if'ing. */
if (pRange)
#ifndef IN_RING3
# ifdef VBOX_WITH_STATISTICS
if (pStats)
return VINF_IOM_HC_IOPORT_READ;
#ifdef VBOX_WITH_STATISTICS
if (pStats)
int rc = pRange->pfnInStrCallback(pRange->pDevIns, pRange->pvUser, Port, pGCPtrDst, pcTransfers, cb);
#ifdef VBOX_WITH_STATISTICS
if (pStats)
# ifndef IN_RING3
return rc;
#ifndef IN_RING3
if (pRangeR3)
# ifdef VBOX_WITH_STATISTICS
if (pStats)
return VINF_IOM_HC_IOPORT_READ;
#ifdef VBOX_WITH_STATISTICS
if (pStats)
# ifndef IN_RING3
return VINF_IOM_HC_IOPORT_READ;
if (pStats)
Log3(("IOMIOPortReadStr: Port=%RTiop pGCPtrDst=%p pcTransfer=%p:{%#x->%#x} cb=%d rc=VINF_SUCCESS\n",
return VINF_SUCCESS;
/** @todo bird: When I get time, I'll remove the GC tree and link the GC entries to the ring-3 node. */
#ifdef VBOX_WITH_STATISTICS
if (pStats)
if ( !pRange
if (pRange)
#ifdef IN_GC
if (pRange)
#ifndef IN_RING3
# ifdef VBOX_WITH_STATISTICS
if (pStats)
return VINF_IOM_HC_IOPORT_WRITE;
#ifdef VBOX_WITH_STATISTICS
if (pStats)
#ifdef VBOX_WITH_STATISTICS
if (pStats)
# ifndef IN_RING3
return rc;
#ifndef IN_RING3
if (pRangeR3)
# ifdef VBOX_WITH_STATISTICS
if (pStats)
return VINF_IOM_HC_IOPORT_WRITE;
#ifdef VBOX_WITH_STATISTICS
if (pStats)
# ifndef IN_RING3
return VINF_IOM_HC_IOPORT_WRITE;
if (pStats)
return VINF_SUCCESS;
* @param pcTransfers Pointer to the number of transfer units to write, on return remaining transfer units.
IOMDECL(int) IOMIOPortWriteString(PVM pVM, RTIOPORT Port, PRTGCPTR pGCPtrSrc, PRTGCUINTREG pcTransfers, unsigned cb)
#ifdef LOG_ENABLED
#ifdef VBOX_WITH_STATISTICS
if (pStats)
if ( !pRange
if (pRange)
#ifdef IN_GC
Assert(!pRange || MMHyperIsInsideArea(pVM, (RTGCPTR)(RTRCUINTPTR)pRange)); /** @todo r=bird: there is a macro for this which skips the #if'ing. */
if (pRange)
#ifndef IN_RING3
# ifdef VBOX_WITH_STATISTICS
if (pStats)
return VINF_IOM_HC_IOPORT_WRITE;
#ifdef VBOX_WITH_STATISTICS
if (pStats)
int rc = pRange->pfnOutStrCallback(pRange->pDevIns, pRange->pvUser, Port, pGCPtrSrc, pcTransfers, cb);
#ifdef VBOX_WITH_STATISTICS
if (pStats)
# ifndef IN_RING3
return rc;
#ifndef IN_RING3
if (pRangeR3)
# ifdef VBOX_WITH_STATISTICS
if (pStats)
return VINF_IOM_HC_IOPORT_WRITE;
#ifdef VBOX_WITH_STATISTICS
if (pStats)
# ifndef IN_RING3
return VINF_IOM_HC_IOPORT_WRITE;
if (pStats)
Log3(("IOMIOPortWriteStr: Port=%RTiop pGCPtrSrc=%p pcTransfer=%p:{%#x->%#x} cb=%d rc=VINF_SUCCESS\n",
return VINF_SUCCESS;
* @retval VINF_TRPM_XCPT_DISPATCHED The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
* @retval VINF_EM_RESCHEDULE_REM The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
IOMDECL(int) IOMInterpretCheckPortIOAccess(PVM pVM, PCPUMCTXCORE pCtxCore, RTIOPORT Port, unsigned cb)
if ( ( cpl > 0
bool fCanHaveIOBitmap;
if ( !fCanHaveIOBitmap
Log(("iomInterpretCheckPortIOAccess: Port=%RTiop cb=%d cbTss=%#x fCanHaveIOBitmap=%RTbool -> #GP(0)\n",
rc = PGMPhysInterpretedRead(pVM, pCtxCore, &offIOPB, GCPtrTss + RT_OFFSETOF(VBOXTSS, offIoBitmap), sizeof(offIOPB));
return rc;
return rc;
return VINF_SUCCESS;
* @retval VINF_TRPM_XCPT_DISPATCHED The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
* @retval VINF_EM_RESCHEDULE_REM The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
#ifdef IN_GC
unsigned cbSize = 0;
AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || VBOX_FAILURE(rc), ("%Vrc\n", rc));
return rc;
* @retval VINF_TRPM_XCPT_DISPATCHED The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
* @retval VINF_EM_RESCHEDULE_REM The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
#ifdef IN_GC
unsigned cbSize = 0;
AssertMsg(rc == VINF_SUCCESS || rc == VINF_IOM_HC_IOPORT_WRITE || (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST) || VBOX_FAILURE(rc), ("%Vrc\n", rc));
AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || VBOX_FAILURE(rc), ("%Vrc\n", rc));
return rc;