VirtualBox

source: vbox/trunk/include/VBox/vmm/selm.h@ 78454

Last change on this file since 78454 was 76585, checked in by vboxsync, 6 years ago

*: scm --fix-header-guard-endif

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