VirtualBox

source: vbox/trunk/src/VBox/VMM/include/TRPMInternal.h@ 80651

Last change on this file since 80651 was 80015, checked in by vboxsync, 5 years ago

VMM: Kicking out raw-mode (work in progress) - TRPM. bugref:9517

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 4.0 KB
Line 
1/* $Id: TRPMInternal.h 80015 2019-07-26 16:46:49Z vboxsync $ */
2/** @file
3 * TRPM - Internal header file.
4 */
5
6/*
7 * Copyright (C) 2006-2019 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#ifndef VMM_INCLUDED_SRC_include_TRPMInternal_h
19#define VMM_INCLUDED_SRC_include_TRPMInternal_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include <VBox/cdefs.h>
25#include <VBox/types.h>
26#include <VBox/vmm/stam.h>
27#include <VBox/vmm/cpum.h>
28#include <VBox/vmm/pgm.h>
29
30RT_C_DECLS_BEGIN
31
32
33/** @defgroup grp_trpm_int Internals
34 * @ingroup grp_trpm
35 * @internal
36 * @{
37 */
38
39/** First interrupt handler. Used for validating input. */
40#define TRPM_HANDLER_INT_BASE 0x20
41
42
43/** @name TRPMGCTrapIn* flags.
44 * The lower bits are offsets into the CPUMCTXCORE structure.
45 * @{ */
46/** The mask for the operation. */
47#define TRPM_TRAP_IN_OP_MASK 0xffff
48/** Traps on MOV GS, eax. */
49#define TRPM_TRAP_IN_MOV_GS 1
50/** Traps on MOV FS, eax. */
51#define TRPM_TRAP_IN_MOV_FS 2
52/** Traps on MOV ES, eax. */
53#define TRPM_TRAP_IN_MOV_ES 3
54/** Traps on MOV DS, eax. */
55#define TRPM_TRAP_IN_MOV_DS 4
56/** Traps on IRET. */
57#define TRPM_TRAP_IN_IRET 5
58/** Set if this is a V86 resume. */
59#define TRPM_TRAP_IN_V86 RT_BIT(30)
60/** @} */
61
62
63/**
64 * TRPM Data (part of VM)
65 *
66 * @note This used to be a big deal when we had raw-mode, now it's a dud. :-)
67 */
68typedef struct TRPM
69{
70#ifdef VBOX_WITH_STATISTICS
71 /** Statistics for interrupt handlers (allocated on the hypervisor heap) - R3
72 * pointer. */
73 R3PTRTYPE(PSTAMCOUNTER) paStatForwardedIRQR3;
74#endif
75 uint64_t u64Dummy;
76} TRPM;
77
78/** Pointer to TRPM Data. */
79typedef TRPM *PTRPM;
80
81
82/**
83 * Per CPU data for TRPM.
84 */
85typedef struct TRPMCPU
86{
87 /** Active Interrupt or trap vector number.
88 * If not UINT32_MAX this indicates that we're currently processing a
89 * interrupt, trap, fault, abort, whatever which have arrived at that
90 * vector number.
91 */
92 uint32_t uActiveVector;
93
94 /** Active trap type. */
95 TRPMEVENT enmActiveType;
96
97 /** Errorcode for the active interrupt/trap. */
98 RTGCUINT uActiveErrorCode; /**< @todo don't use RTGCUINT */
99
100 /** CR2 at the time of the active exception. */
101 RTGCUINTPTR uActiveCR2;
102
103 /** Saved trap vector number. */
104 RTGCUINT uSavedVector; /**< @todo don't use RTGCUINT */
105
106 /** Saved errorcode. */
107 RTGCUINT uSavedErrorCode;
108
109 /** Saved cr2. */
110 RTGCUINTPTR uSavedCR2;
111
112 /** Saved trap type. */
113 TRPMEVENT enmSavedType;
114
115 /** Instruction length for software interrupts and software exceptions
116 * (\#BP, \#OF) */
117 uint8_t cbInstr;
118
119 /** Saved instruction length. */
120 uint8_t cbSavedInstr;
121
122 /** Padding. */
123 uint8_t au8Padding[2];
124
125 /** Previous trap vector # - for debugging. */
126 RTGCUINT uPrevVector;
127} TRPMCPU;
128
129/** Pointer to TRPMCPU Data. */
130typedef TRPMCPU *PTRPMCPU;
131
132
133#ifdef IN_RING0
134
135/**
136 * Calls the interrupt gate as if we received an interrupt while in Ring-0.
137 *
138 * @param uIP The interrupt gate IP.
139 * @param SelCS The interrupt gate CS.
140 * @param RSP The interrupt gate RSP. ~0 if no stack switch should take place. (only AMD64)
141 */
142DECLASM(void) trpmR0DispatchHostInterrupt(RTR0UINTPTR uIP, RTSEL SelCS, RTR0UINTPTR RSP);
143
144/**
145 * Issues a software interrupt to the specified interrupt vector.
146 *
147 * @param uActiveVector The vector number.
148 */
149DECLASM(void) trpmR0DispatchHostInterruptSimple(RTUINT uActiveVector);
150
151#endif /* IN_RING0 */
152
153/** @} */
154
155RT_C_DECLS_END
156
157#endif /* !VMM_INCLUDED_SRC_include_TRPMInternal_h */
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