VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMRC/IOMRC.cpp@ 50653

Last change on this file since 50653 was 45305, checked in by vboxsync, 11 years ago

IOM: Adding pVCpu to a lot of calls and moving the lookup caches from VM to VMCPU.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.4 KB
Line 
1/* $Id: IOMRC.cpp 45305 2013-04-03 11:15:02Z vboxsync $ */
2/** @file
3 * IOM - Input / Output Monitor - Raw-Mode Context.
4 */
5
6/*
7 * Copyright (C) 2006-2012 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19/*******************************************************************************
20* Header Files *
21*******************************************************************************/
22#define LOG_GROUP LOG_GROUP_IOM
23#include <VBox/vmm/iom.h>
24#include <VBox/vmm/cpum.h>
25#include <VBox/vmm/pgm.h>
26#include <VBox/vmm/selm.h>
27#include <VBox/vmm/mm.h>
28#include <VBox/vmm/em.h>
29#include <VBox/vmm/pgm.h>
30#include <VBox/vmm/trpm.h>
31#include "IOMInternal.h"
32#include <VBox/vmm/vm.h>
33
34#include <VBox/dis.h>
35#include <VBox/disopcode.h>
36#include <VBox/param.h>
37#include <VBox/err.h>
38#include <iprt/assert.h>
39#include <VBox/log.h>
40#include <iprt/asm.h>
41#include <iprt/string.h>
42
43
44
45/**
46 * Attempts to service an IN/OUT instruction.
47 *
48 * The \#GP trap handler in RC will call this function if the opcode causing
49 * the trap is a in or out type instruction. (Call it indirectly via EM that
50 * is.)
51 *
52 * @returns Strict VBox status code. Informational status codes other than the one documented
53 * here are to be treated as internal failure. Use IOM_SUCCESS() to check for success.
54 * @retval VINF_SUCCESS Success.
55 * @retval VINF_EM_FIRST-VINF_EM_LAST Success with some exceptions (see IOM_SUCCESS()), the
56 * status code must be passed on to EM.
57 * @retval VINF_EM_RESCHEDULE_REM The exception was dispatched and cannot be executed in raw-mode. (TRPMRaiseXcptErr)
58 * @retval VINF_EM_RAW_EMULATE_INSTR Defer the read to the REM.
59 * @retval VINF_IOM_R3_IOPORT_READ Defer the read to ring-3.
60 * @retval VINF_EM_RAW_GUEST_TRAP The exception was left pending. (TRPMRaiseXcptErr)
61 * @retval VINF_TRPM_XCPT_DISPATCHED The exception was raised and dispatched for raw-mode execution. (TRPMRaiseXcptErr)
62 *
63 * @param pVM The virtual machine handle.
64 * @param pVCpu Pointer to the virtual CPU structure of the caller.
65 * @param pRegFrame Pointer to CPUMCTXCORE guest registers structure.
66 * @param pCpu Disassembler CPU state.
67 */
68VMMRCDECL(VBOXSTRICTRC) IOMRCIOPortHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)
69{
70 switch (pCpu->pCurInstr->uOpcode)
71 {
72 case OP_IN:
73 return IOMInterpretIN(pVM, pVCpu, pRegFrame, pCpu);
74
75 case OP_OUT:
76 return IOMInterpretOUT(pVM, pVCpu, pRegFrame, pCpu);
77
78 case OP_INSB:
79 case OP_INSWD:
80 return IOMInterpretINS(pVM, pVCpu, pRegFrame, pCpu);
81
82 case OP_OUTSB:
83 case OP_OUTSWD:
84 return IOMInterpretOUTS(pVM, pVCpu, pRegFrame, pCpu);
85
86 /*
87 * The opcode wasn't know to us, freak out.
88 */
89 default:
90 AssertMsgFailed(("Unknown I/O port access opcode %d.\n", pCpu->pCurInstr->uOpcode));
91 return VERR_IOM_IOPORT_UNKNOWN_OPCODE;
92 }
93}
94
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use