VirtualBox

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

Last change on this file since 19968 was 19334, checked in by vboxsync, 16 years ago

DBGF,SELM,DBGC,++: Refactored the selector info querying and usage, mainly for fixing VM_ASSERT_EMT issues cropping up after from #3170, but also for moving the external interface to DBGF.

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