VirtualBox

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

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

Attempt to fix assertion

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.7 KB
Line 
1/* $Id: SELMInternal.h 1410 2007-03-12 09:55:12Z 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/** aHyperSel index to retrieve hypervisor selectors */
48/** The TSS selector used by the VMM inside the GC. */
49#define SELM_HYPER_SEL_TSS 0
50/** The Flat CS selector used by the VMM inside the GC. */
51#define SELM_HYPER_SEL_CS 1
52/** The Flat DS selector used by the VMM inside the GC. */
53#define SELM_HYPER_SEL_DS 2
54/** The 64-bit mode CS selector used by the VMM inside the GC. */
55#define SELM_HYPER_SEL_CS64 3
56/** The TSS selector for taking trap 08 (\#DF). */
57#define SELM_HYPER_SEL_TSS_TRAP08 4
58#define SELM_HYPER_SEL_MAX (SELM_HYPER_SEL_TSS_TRAP08+1)
59
60/**
61 * Converts a SELM pointer into a VM pointer.
62 * @returns Pointer to the VM structure the SELM is part of.
63 * @param pSELM Pointer to SELM instance data.
64 */
65#define SELM2VM(pSELM) ( (PVM)((char*)pSELM - pSELM->offVM) )
66
67
68
69/**
70 * SELM Data (part of VM)
71 */
72typedef struct SELM
73{
74 /** Offset to the VM structure.
75 * See SELM2VM(). */
76 RTINT offVM;
77
78 /* Flat CS, DS, 64 bit mode CS, TSS & trap 8 TSS */
79 RTSEL aHyperSel[SELM_HYPER_SEL_MAX];
80
81 /** Pointer to the GCs - HC Ptr.
82 * This size is governed by SELM_GDT_ELEMENTS. */
83 HCPTRTYPE(PVBOXDESC) paGdtHC;
84 /** Pointer to the GCs - GC Ptr.
85 * This is not initialized until the first relocation because it's used to
86 * check if the shadow GDT virtual handler requires deregistration. */
87 GCPTRTYPE(PVBOXDESC) paGdtGC;
88 /** Current (last) Guest's GDTR. */
89 VBOXGDTR GuestGdtr;
90 /** The current (last) effective Guest GDT size. */
91 RTUINT cbEffGuestGdtLimit;
92
93 /** HC Pointer to the LDT shadow area placed in Hypervisor memory arena. */
94 HCPTRTYPE(void *) HCPtrLdt;
95 /** GC Pointer to the LDT shadow area placed in Hypervisor memory arena. */
96 GCPTRTYPE(void *) GCPtrLdt;
97 /** GC Pointer to the current Guest's LDT. */
98 RTGCPTR GCPtrGuestLdt;
99 /** Current LDT limit, both Guest and Shadow. */
100 RTUINT cbLdtLimit;
101 /** Current LDT offset relative to pvLdt*. */
102 RTUINT offLdtHyper;
103
104#if HC_ARCH_BITS == 32
105 /** TSS alignment padding. */
106 RTUINT auPadding[2];
107#endif
108 /** TSS. (This is 16 byte aligned!) */
109 VBOXTSS Tss;
110 /** @todo I/O bitmap & interrupt redirection table. */
111
112 /** TSS for trap 08 (\#DF). */
113 VBOXTSS TssTrap08;
114 /** TSS for trap 0a (\#TS). */
115 VBOXTSS TssTrap0a;
116
117 /** GC Pointer to the TSS shadow area (Tss) placed in Hypervisor memory arena. */
118 RTGCPTR GCPtrTss;
119 /** GC Pointer to the current Guest's TSS. */
120 RTGCPTR GCPtrGuestTss;
121 /** The size of the guest TSS. */
122 RTUINT cbGuestTss;
123 /** Set if it's a 32-bit TSS. */
124 bool fGuestTss32Bit;
125 /** The size of the Guest's TSS part we're monitoring. */
126 RTUINT cbMonitoredGuestTss;
127 /** GC shadow TSS selector */
128 RTSEL GCSelTss;
129
130 /** Indicates that the Guest GDT access handler have been registered. */
131 bool fGDTRangeRegistered;
132
133 /** Indicates whether LDT/GDT/TSS monitoring and syncing is disabled. */
134 bool fDisableMonitoring;
135
136 /** Indicates whether the TSS stack selector & base address need to be refreshed. */
137 bool fSyncTSSRing0Stack;
138 /** alignment . */
139 RTUINT uPadding2;
140
141 /** SELMR3UpdateFromCPUM() profiling. */
142 STAMPROFILE StatUpdateFromCPUM;
143 /** SELMR3SyncTSS() profiling. */
144 STAMPROFILE StatTSSSync;
145
146 /** GC: The number of handled write to the Guest's GDT. */
147 STAMCOUNTER StatGCWriteGuestGDTHandled;
148 /** GC: The number of unhandled write to the Guest's GDT. */
149 STAMCOUNTER StatGCWriteGuestGDTUnhandled;
150 /** GC: The number of times write to Guest's LDT was detected. */
151 STAMCOUNTER StatGCWriteGuestLDT;
152 /** GC: The number of handled write to the Guest's TSS. */
153 STAMCOUNTER StatGCWriteGuestTSSHandled;
154 /** GC: The number of handled write to the Guest's TSS where we detected a change. */
155 STAMCOUNTER StatGCWriteGuestTSSHandledChanged;
156 /** GC: The number of unhandled write to the Guest's TSS. */
157 STAMCOUNTER StatGCWriteGuestTSSUnhandled;
158} SELM, *PSELM;
159
160__BEGIN_DECLS
161
162SELMGCDECL(int) selmgcGuestGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
163SELMGCDECL(int) selmgcGuestLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
164SELMGCDECL(int) selmgcGuestTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
165
166SELMGCDECL(int) selmgcShadowGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
167SELMGCDECL(int) selmgcShadowLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
168SELMGCDECL(int) selmgcShadowTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
169
170__END_DECLS
171
172#ifdef IN_RING3
173
174#endif
175
176/** @} */
177
178#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