VirtualBox

source: vbox/trunk/include/VBox/vmm/trpm.h@ 55461

Last change on this file since 55461 was 53615, checked in by vboxsync, 10 years ago

doxygen fixes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.3 KB
Line 
1/** @file
2 * TRPM - The Trap Monitor.
3 */
4
5/*
6 * Copyright (C) 2006-2015 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___VBox_vmm_trpm_h
27#define ___VBox_vmm_trpm_h
28
29#include <VBox/types.h>
30#include <iprt/x86.h>
31
32
33RT_C_DECLS_BEGIN
34/** @defgroup grp_trpm The Trap Monitor API
35 * @{
36 */
37
38/**
39 * Trap: error code present or not
40 */
41typedef enum
42{
43 TRPM_TRAP_HAS_ERRORCODE = 0,
44 TRPM_TRAP_NO_ERRORCODE,
45 /** The usual 32-bit paranoia. */
46 TRPM_TRAP_32BIT_HACK = 0x7fffffff
47} TRPMERRORCODE;
48
49/**
50 * TRPM event type
51 */
52/** Note: must match trpm.mac! */
53typedef enum
54{
55 TRPM_TRAP = 0,
56 TRPM_HARDWARE_INT = 1,
57 TRPM_SOFTWARE_INT = 2,
58 /** The usual 32-bit paranoia. */
59 TRPM_32BIT_HACK = 0x7fffffff
60} TRPMEVENT;
61/** Pointer to a TRPM event type. */
62typedef TRPMEVENT *PTRPMEVENT;
63/** Pointer to a const TRPM event type. */
64typedef TRPMEVENT const *PCTRPMEVENT;
65
66/**
67 * Invalid trap handler for trampoline calls
68 */
69#define TRPM_INVALID_HANDLER 0
70
71VMMDECL(int) TRPMQueryTrap(PVMCPU pVCpu, uint8_t *pu8TrapNo, PTRPMEVENT penmType);
72VMMDECL(uint8_t) TRPMGetTrapNo(PVMCPU pVCpu);
73VMMDECL(RTGCUINT) TRPMGetErrorCode(PVMCPU pVCpu);
74VMMDECL(RTGCUINTPTR) TRPMGetFaultAddress(PVMCPU pVCpu);
75VMMDECL(uint8_t) TRPMGetInstrLength(PVMCPU pVCpu);
76VMMDECL(int) TRPMResetTrap(PVMCPU pVCpu);
77VMMDECL(int) TRPMAssertTrap(PVMCPU pVCpu, uint8_t u8TrapNo, TRPMEVENT enmType);
78VMMDECL(int) TRPMAssertXcptPF(PVMCPU pVCpu, RTGCUINTPTR uCR2, RTGCUINT uErrorCode);
79VMMDECL(void) TRPMSetErrorCode(PVMCPU pVCpu, RTGCUINT uErrorCode);
80VMMDECL(void) TRPMSetFaultAddress(PVMCPU pVCpu, RTGCUINTPTR uCR2);
81VMMDECL(void) TRPMSetInstrLength(PVMCPU pVCpu, uint8_t cbInstr);
82VMMDECL(bool) TRPMIsSoftwareInterrupt(PVMCPU pVCpu);
83VMMDECL(bool) TRPMHasTrap(PVMCPU pVCpu);
84VMMDECL(int) TRPMQueryTrapAll(PVMCPU pVCpu, uint8_t *pu8TrapNo, PTRPMEVENT pEnmType, PRTGCUINT puErrorCode, PRTGCUINTPTR puCR2, uint8_t *pcbInstr);
85VMMDECL(void) TRPMSaveTrap(PVMCPU pVCpu);
86VMMDECL(void) TRPMRestoreTrap(PVMCPU pVCpu);
87VMMDECL(int) TRPMForwardTrap(PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t iGate, uint32_t cbInstr, TRPMERRORCODE enmError, TRPMEVENT enmType, int32_t iOrgTrap);
88VMMDECL(int) TRPMRaiseXcpt(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt);
89VMMDECL(int) TRPMRaiseXcptErr(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr);
90VMMDECL(int) TRPMRaiseXcptErrCR2(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr, RTGCUINTPTR uCR2);
91
92
93#ifdef IN_RING3
94/** @defgroup grp_trpm_r3 TRPM Host Context Ring 3 API
95 * @{
96 */
97VMMR3DECL(int) TRPMR3Init(PVM pVM);
98VMMR3DECL(void) TRPMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
99VMMR3DECL(void) TRPMR3ResetCpu(PVMCPU pVCpu);
100VMMR3DECL(void) TRPMR3Reset(PVM pVM);
101VMMR3DECL(int) TRPMR3Term(PVM pVM);
102VMMR3DECL(int) TRPMR3InjectEvent(PVM pVM, PVMCPU pVCpu, TRPMEVENT enmEvent);
103# ifdef VBOX_WITH_RAW_MODE
104VMMR3_INT_DECL(int) TRPMR3GetImportRC(PVM pVM, const char *pszSymbol, PRTRCPTR pRCPtrValue);
105VMMR3DECL(int) TRPMR3SyncIDT(PVM pVM, PVMCPU pVCpu);
106VMMR3DECL(bool) TRPMR3IsGateHandler(PVM pVM, RTRCPTR GCPtr);
107VMMR3DECL(uint32_t) TRPMR3QueryGateByHandler(PVM pVM, RTRCPTR GCPtr);
108VMMR3DECL(int) TRPMR3EnableGuestTrapHandler(PVM pVM, unsigned iTrap);
109VMMR3DECL(int) TRPMR3SetGuestTrapHandler(PVM pVM, unsigned iTrap, RTRCPTR pHandler);
110VMMR3DECL(RTRCPTR) TRPMR3GetGuestTrapHandler(PVM pVM, unsigned iTrap);
111# endif
112/** @} */
113#endif
114
115
116#ifdef IN_RC
117/** @defgroup grp_trpm_rc The TRPM Raw-mode Context API
118 * @{
119 */
120
121/**
122 * Guest Context temporary trap handler
123 *
124 * @returns VBox status code (appropriate for GC return).
125 * In this context VINF_SUCCESS means to restart the instruction.
126 * @param pVM VM handle.
127 * @param pRegFrame Trap register frame.
128 */
129typedef DECLCALLBACK(int) FNTRPMGCTRAPHANDLER(PVM pVM, PCPUMCTXCORE pRegFrame);
130/** Pointer to a TRPMGCTRAPHANDLER() function. */
131typedef FNTRPMGCTRAPHANDLER *PFNTRPMGCTRAPHANDLER;
132
133VMMRCDECL(int) TRPMGCSetTempHandler(PVM pVM, unsigned iTrap, PFNTRPMGCTRAPHANDLER pfnHandler);
134VMMRCDECL(void) TRPMGCHyperReturnToHost(PVM pVM, int rc);
135/** @} */
136#endif
137
138
139#ifdef IN_RING0
140/** @defgroup grp_trpm_r0 TRPM Host Context Ring 0 API
141 * @{
142 */
143VMMR0DECL(void) TRPMR0DispatchHostInterrupt(PVM pVM);
144VMMR0DECL(void) TRPMR0SetupInterruptDispatcherFrame(PVM pVM, void *pvRet);
145/** @} */
146#endif
147
148/** @} */
149RT_C_DECLS_END
150
151#endif
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