VirtualBox

source: vbox/trunk/include/VBox/selm.h@ 32714

Last change on this file since 32714 was 30263, checked in by vboxsync, 14 years ago

VMM,REM: Only invalidate hidden registers when using raw-mode. Fixes save restore during mode switching code like the windows boot menu. (#5057)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
1/** @file
2 * SELM - The Selector Manager. (VMM)
3 */
4
5/*
6 * Copyright (C) 2006-2007 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_selm_h
27#define ___VBox_selm_h
28
29#include <VBox/cdefs.h>
30#include <VBox/types.h>
31#include <VBox/x86.h>
32#include <VBox/dis.h>
33#include <VBox/dbgfsel.h>
34
35
36RT_C_DECLS_BEGIN
37
38/** @defgroup grp_selm The Selector Monitor(/Manager) API
39 * @{
40 */
41
42VMMDECL(RTSEL) SELMGetTrap8Selector(PVM pVM);
43VMMDECL(void) SELMSetTrap8EIP(PVM pVM, uint32_t u32EIP);
44VMMDECL(int) SELMGetRing1Stack(PVM pVM, uint32_t *pSS, PRTGCPTR32 pEsp);
45VMMDECL(RTGCPTR) SELMGetGuestTSS(PVM pVM);
46VMMDECL(RTSEL) SELMGetHyperCS(PVM pVM);
47VMMDECL(RTSEL) SELMGetHyperCS64(PVM pVM);
48VMMDECL(RTSEL) SELMGetHyperDS(PVM pVM);
49VMMDECL(RTSEL) SELMGetHyperTSS(PVM pVM);
50VMMDECL(RTSEL) SELMGetHyperTSSTrap08(PVM pVM);
51VMMDECL(RTRCPTR) SELMGetHyperGDT(PVM pVM);
52VMMDECL(int) SELMGetTSSInfo(PVM pVM, PVMCPU pVCpu, PRTGCUINTPTR pGCPtrTss, PRTGCUINTPTR pcbTss, bool *pfCanHaveIOBitmap);
53VMMDECL(RTGCPTR) SELMToFlat(PVM pVM, DIS_SELREG SelReg, PCPUMCTXCORE pCtxCore, RTGCPTR Addr);
54VMMDECL(RTGCPTR) SELMToFlatBySel(PVM pVM, RTSEL Sel, RTGCPTR Addr);
55VMMDECL(void) SELMShadowCR3Changed(PVM pVM, PVMCPU pVCpu);
56
57/** Flags for SELMToFlatEx().
58 * @{ */
59/** Don't check the RPL,DPL or CPL. */
60#define SELMTOFLAT_FLAGS_NO_PL RT_BIT(8)
61/** Flags contains CPL information. */
62#define SELMTOFLAT_FLAGS_HAVE_CPL RT_BIT(9)
63/** CPL is 3. */
64#define SELMTOFLAT_FLAGS_CPL3 3
65/** CPL is 2. */
66#define SELMTOFLAT_FLAGS_CPL2 2
67/** CPL is 1. */
68#define SELMTOFLAT_FLAGS_CPL1 1
69/** CPL is 0. */
70#define SELMTOFLAT_FLAGS_CPL0 0
71/** Get the CPL from the flags. */
72#define SELMTOFLAT_FLAGS_CPL(fFlags) ((fFlags) & X86_SEL_RPL)
73/** Allow converting using Hypervisor GDT entries. */
74#define SELMTOFLAT_FLAGS_HYPER RT_BIT(10)
75/** @} */
76
77VMMDECL(int) SELMToFlatEx(PVM pVM, DIS_SELREG SelReg, PCCPUMCTXCORE pCtxCore, RTGCPTR Addr, unsigned fFlags, PRTGCPTR ppvGC);
78VMMDECL(int) SELMToFlatBySelEx(PVM pVM, X86EFLAGS eflags, RTSEL Sel, RTGCPTR Addr, PCCPUMSELREGHID pHiddenSel,
79 unsigned fFlags, PRTGCPTR ppvGC, uint32_t *pcb);
80VMMDECL(int) SELMValidateAndConvertCSAddr(PVM pVM, X86EFLAGS eflags, RTSEL SelCPL, RTSEL SelCS,
81 PCCPUMSELREGHID pHiddenCSSel, RTGCPTR Addr, PRTGCPTR ppvFlat);
82VMMDECL(int) SELMValidateAndConvertCSAddrGCTrap(PVM pVM, X86EFLAGS eflags, RTSEL SelCPL, RTSEL SelCS, RTGCPTR Addr,
83 PRTGCPTR ppvFlat, uint32_t *pcBits);
84VMMDECL(DISCPUMODE) SELMGetCpuModeFromSelector(PVM pVM, X86EFLAGS eflags, RTSEL Sel, PCCPUMSELREGHID pHiddenSel);
85VMMDECL(int) SELMGetLDTFromSel(PVM pVM, RTSEL SelLdt, PRTGCPTR ppvLdt, unsigned *pcbLimit);
86
87
88#ifdef IN_RING3
89/** @defgroup grp_selm_r3 The Selector Monitor(/Manager) API
90 * @ingroup grp_selm
91 * @{
92 */
93VMMR3DECL(int) SELMR3Init(PVM pVM);
94VMMR3DECL(int) SELMR3InitFinalize(PVM pVM);
95VMMR3DECL(void) SELMR3Relocate(PVM pVM);
96VMMR3DECL(int) SELMR3Term(PVM pVM);
97VMMR3DECL(void) SELMR3Reset(PVM pVM);
98VMMR3DECL(int) SELMR3UpdateFromCPUM(PVM pVM, PVMCPU pVCpu);
99VMMR3DECL(int) SELMR3SyncTSS(PVM pVM, PVMCPU pVCpu);
100VMMR3DECL(int) SELMR3GetSelectorInfo(PVM pVM, PVMCPU pVCpu, RTSEL Sel, PDBGFSELINFO pSelInfo);
101VMMR3DECL(int) SELMR3GetShadowSelectorInfo(PVM pVM, RTSEL Sel, PDBGFSELINFO pSelInfo);
102VMMR3DECL(void) SELMR3DisableMonitoring(PVM pVM);
103VMMR3DECL(void) SELMR3DumpDescriptor(X86DESC Desc, RTSEL Sel, const char *pszMsg);
104VMMR3DECL(void) SELMR3DumpHyperGDT(PVM pVM);
105VMMR3DECL(void) SELMR3DumpHyperLDT(PVM pVM);
106VMMR3DECL(void) SELMR3DumpGuestGDT(PVM pVM);
107VMMR3DECL(void) SELMR3DumpGuestLDT(PVM pVM);
108VMMR3DECL(bool) SELMR3CheckTSS(PVM pVM);
109VMMR3DECL(int) SELMR3DebugCheck(PVM pVM);
110/** @def SELMR3_DEBUG_CHECK
111 * Invokes SELMR3DebugCheck in stricts builds. */
112# ifdef VBOX_STRICT
113# define SELMR3_DEBUG_CHECK(pVM) SELMR3DebugCheck(pVM)
114# else
115# define SELMR3_DEBUG_CHECK(pVM) do { } while (0)
116# endif
117/** @} */
118#endif /* IN_RING3 */
119
120/** @} */
121RT_C_DECLS_END
122
123#endif
124
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