VirtualBox

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

Last change on this file since 41823 was 41737, checked in by vboxsync, 12 years ago

DISOPCODE: s/opcode/uOpcode/

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1/* $Id: IOMRC.cpp 41737 2012-06-15 01:01:49Z 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 pRegFrame Pointer to CPUMCTXCORE guest registers structure.
65 * @param pCpu Disassembler CPU state.
66 */
67VMMRCDECL(VBOXSTRICTRC) IOMRCIOPortHandler(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)
68{
69 switch (pCpu->pCurInstr->uOpcode)
70 {
71 case OP_IN:
72 return IOMInterpretIN(pVM, pRegFrame, pCpu);
73
74 case OP_OUT:
75 return IOMInterpretOUT(pVM, pRegFrame, pCpu);
76
77 case OP_INSB:
78 case OP_INSWD:
79 return IOMInterpretINS(pVM, pRegFrame, pCpu);
80
81 case OP_OUTSB:
82 case OP_OUTSWD:
83 return IOMInterpretOUTS(pVM, pRegFrame, pCpu);
84
85 /*
86 * The opcode wasn't know to us, freak out.
87 */
88 default:
89 AssertMsgFailed(("Unknown I/O port access opcode %d.\n", pCpu->pCurInstr->uOpcode));
90 return VERR_IOM_IOPORT_UNKNOWN_OPCODE;
91 }
92}
93
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette