VirtualBox

source: vbox/trunk/src/VBox/VMM/SELMInternal.h@ 98

Last change on this file since 98 was 98, checked in by vboxsync, 18 years ago

Reapply fixed 17508 changeset

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.4 KB
Line 
1/* $Id: SELMInternal.h 98 2007-01-17 13:47:34Z vboxsync $ */
2/** @file
3 * SELM - Internal header file.
4 */
5
6/*
7 * Copyright (C) 2006 InnoTek Systemberatung GmbH
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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22#ifndef __SELMInternal_h__
23#define __SELMInternal_h__
24
25#include <VBox/cdefs.h>
26#include <VBox/types.h>
27#include <VBox/stam.h>
28#include <VBox/cpum.h>
29
30
31#if !defined(IN_SELM_R3) && !defined(IN_SELM_R0) && !defined(IN_SELM_GC)
32# error "Not in SELM! This is an internal header!"
33#endif
34
35/** @defgroup grp_selm_int Internals
36 * @ingroup grp_selm
37 * @internal
38 * @{
39 */
40
41/** Number of GDTs we need for internal use */
42#define MAX_NEEDED_HYPERVISOR_GDTS 5
43
44/** The number of GDTS allocated for our GDT. (full size) */
45#define SELM_GDT_ELEMENTS 8192
46
47/**
48 * Converts a SELM pointer into a VM pointer.
49 * @returns Pointer to the VM structure the SELM is part of.
50 * @param pSELM Pointer to SELM instance data.
51 */
52#define SELM2VM(pSELM) ( (PVM)((char*)pSELM - pSELM->offVM) )
53
54
55
56/**
57 * SELM Data (part of VM)
58 */
59typedef struct SELM
60{
61 /** Offset to the VM structure.
62 * See SELM2VM(). */
63 RTINT offVM;
64
65 /** The Flat CS selector used by the VMM inside the GC. */
66 RTSEL SelCS;
67 /** The Flat DS selector used by the VMM inside the GC. */
68 RTSEL SelDS;
69 /** The 64-bit mode CS selector used by the VMM inside the GC. */
70 RTSEL SelCS64;
71 /** The TSS selector used by the VMM inside the GC. */
72 RTSEL SelTSS;
73 /** The TSS selector for taking trap 08 (\#DF). */
74 RTSEL SelTSSTrap08;
75
76 /** Pointer to the GCs - HC Ptr.
77 * This size is governed by SELM_GDT_ELEMENTS. */
78 HCPTRTYPE(PVBOXDESC) paGdtHC;
79 /** Pointer to the GCs - GC Ptr.
80 * This is not initialized until the first relocation because it's used to
81 * check if the shadow GDT virtual handler requires deregistration. */
82 GCPTRTYPE(PVBOXDESC) paGdtGC;
83 /** Current (last) Guest's GDTR. */
84 VBOXGDTR GuestGdtr;
85 /** The current (last) effective Guest GDT size. */
86 RTUINT cbEffGuestGdtLimit;
87
88 /** HC Pointer to the LDT shadow area placed in Hypervisor memory arena. */
89 HCPTRTYPE(void *) HCPtrLdt;
90 /** GC Pointer to the LDT shadow area placed in Hypervisor memory arena. */
91 GCPTRTYPE(void *) GCPtrLdt;
92 /** GC Pointer to the current Guest's LDT. */
93 RTGCPTR GCPtrGuestLdt;
94 /** Current LDT limit, both Guest and Shadow. */
95 RTUINT cbLdtLimit;
96 /** Current LDT offset relative to pvLdt*. */
97 RTUINT offLdtHyper;
98
99#if HC_ARCH_BITS == 32
100 /** TSS alignment padding. */
101 RTUINT auPadding[2];
102#endif
103 /** TSS. (This is 16 byte aligned!) */
104 VBOXTSS Tss;
105 /** @todo I/O bitmap & interrupt redirection table. */
106
107 /** TSS for trap 08 (\#DF). */
108 VBOXTSS TssTrap08;
109 /** TSS for trap 0a (\#TS). */
110 VBOXTSS TssTrap0a;
111
112 /** GC Pointer to the TSS shadow area (Tss) placed in Hypervisor memory arena. */
113 RTGCPTR GCPtrTss;
114 /** GC Pointer to the current Guest's TSS. */
115 RTGCPTR GCPtrGuestTss;
116 /** The size of the guest TSS. */
117 RTUINT cbGuestTss;
118 /** Set if it's a 32-bit TSS. */
119 bool fGuestTss32Bit;
120 /** The size of the Guest's TSS part we're monitoring. */
121 RTUINT cbMonitoredGuestTss;
122 /** GC shadow TSS selector */
123 RTSEL GCSelTss;
124
125 /** Indicates that the Guest GDT access handler have been registered. */
126 bool fGDTRangeRegistered;
127
128 /** Indicates whether LDT/GDT/TSS monitoring and syncing is disabled. */
129 bool fDisableMonitoring;
130
131 /** Indicates whether the TSS stack selector & base address need to be refreshed. */
132 bool fSyncTSSRing0Stack;
133
134 /** SELMR3UpdateFromCPUM() profiling. */
135 STAMPROFILE StatUpdateFromCPUM;
136 /** SELMR3SyncTSS() profiling. */
137 STAMPROFILE StatTSSSync;
138
139 /** GC: The number of handled write to the Guest's GDT. */
140 STAMCOUNTER StatGCWriteGuestGDTHandled;
141 /** GC: The number of unhandled write to the Guest's GDT. */
142 STAMCOUNTER StatGCWriteGuestGDTUnhandled;
143 /** GC: The number of times write to Guest's LDT was detected. */
144 STAMCOUNTER StatGCWriteGuestLDT;
145 /** GC: The number of handled write to the Guest's TSS. */
146 STAMCOUNTER StatGCWriteGuestTSSHandled;
147 /** GC: The number of handled write to the Guest's TSS where we detected a change. */
148 STAMCOUNTER StatGCWriteGuestTSSHandledChanged;
149 /** GC: The number of unhandled write to the Guest's TSS. */
150 STAMCOUNTER StatGCWriteGuestTSSUnhandled;
151} SELM, *PSELM;
152
153__BEGIN_DECLS
154
155SELMGCDECL(int) selmgcGuestGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
156SELMGCDECL(int) selmgcGuestLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
157SELMGCDECL(int) selmgcGuestTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
158
159SELMGCDECL(int) selmgcShadowGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
160SELMGCDECL(int) selmgcShadowLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
161SELMGCDECL(int) selmgcShadowTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
162
163__END_DECLS
164
165#ifdef IN_RING3
166
167#endif
168
169/** @} */
170
171#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