1 | /** @file
|
---|
2 | * SELM - The Selector Manager.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * The contents of this file may alternatively be used under the terms
|
---|
25 | * of the Common Development and Distribution License Version 1.0
|
---|
26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | * CDDL are applicable instead of those of the GPL.
|
---|
29 | *
|
---|
30 | * You may elect to license modified versions of this file under the
|
---|
31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | *
|
---|
33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef VBOX_INCLUDED_vmm_selm_h
|
---|
37 | #define VBOX_INCLUDED_vmm_selm_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <VBox/types.h>
|
---|
43 | #include <iprt/x86.h>
|
---|
44 | #include <VBox/vmm/dbgfsel.h>
|
---|
45 |
|
---|
46 |
|
---|
47 | RT_C_DECLS_BEGIN
|
---|
48 |
|
---|
49 | /** @defgroup grp_selm The Selector Monitor(/Manager) API
|
---|
50 | * @ingroup grp_vmm
|
---|
51 | * @{
|
---|
52 | */
|
---|
53 |
|
---|
54 | VMMDECL(int) SELMGetTSSInfo(PVM pVM, PVMCPU pVCpu, PRTGCUINTPTR pGCPtrTss, PRTGCUINTPTR pcbTss, bool *pfCanHaveIOBitmap);
|
---|
55 | VMMDECL(RTGCPTR) SELMToFlat(PVMCPUCC pVCpu, unsigned idxSeg, PCPUMCTX pCtx, RTGCPTR Addr);
|
---|
56 | VMMDECL(RTGCPTR) SELMToFlatBySel(PVM pVM, RTSEL Sel, RTGCPTR Addr);
|
---|
57 |
|
---|
58 | /** Flags for SELMToFlatEx().
|
---|
59 | * @{ */
|
---|
60 | /** Don't check the RPL,DPL or CPL. */
|
---|
61 | #define SELMTOFLAT_FLAGS_NO_PL RT_BIT(8)
|
---|
62 | /** Flags contains CPL information. */
|
---|
63 | #define SELMTOFLAT_FLAGS_HAVE_CPL RT_BIT(9)
|
---|
64 | /** CPL is 3. */
|
---|
65 | #define SELMTOFLAT_FLAGS_CPL3 3
|
---|
66 | /** CPL is 2. */
|
---|
67 | #define SELMTOFLAT_FLAGS_CPL2 2
|
---|
68 | /** CPL is 1. */
|
---|
69 | #define SELMTOFLAT_FLAGS_CPL1 1
|
---|
70 | /** CPL is 0. */
|
---|
71 | #define SELMTOFLAT_FLAGS_CPL0 0
|
---|
72 | /** Get the CPL from the flags. */
|
---|
73 | #define SELMTOFLAT_FLAGS_CPL(fFlags) ((fFlags) & X86_SEL_RPL)
|
---|
74 | #define SELMTOFLAT_FLAGS_HYPER RT_BIT(10)
|
---|
75 | /** @} */
|
---|
76 |
|
---|
77 | VMMDECL(int) SELMToFlatEx(PVMCPU pVCpu, unsigned idxSeg, PCPUMCTX pCtx, RTGCPTR Addr, uint32_t fFlags, PRTGCPTR ppvGC);
|
---|
78 | VMMDECL(int) SELMValidateAndConvertCSAddr(PVMCPU pVCpu, uint32_t fEFlags, RTSEL SelCPL, RTSEL SelCS,
|
---|
79 | PCPUMSELREG pSRegCS, RTGCPTR Addr, PRTGCPTR ppvFlat);
|
---|
80 | #ifdef VBOX_WITH_RAW_MODE
|
---|
81 | VMM_INT_DECL(void) SELMLoadHiddenSelectorReg(PVMCPU pVCpu, PCCPUMCTX pCtx, PCPUMSELREG pSReg);
|
---|
82 | #endif
|
---|
83 |
|
---|
84 |
|
---|
85 | #ifdef IN_RING3
|
---|
86 | /** @defgroup grp_selm_r3 The SELM ring-3 Context API
|
---|
87 | * @{
|
---|
88 | */
|
---|
89 | VMMR3DECL(int) SELMR3Init(PVM pVM);
|
---|
90 | VMMR3DECL(void) SELMR3Relocate(PVM pVM);
|
---|
91 | VMMR3DECL(int) SELMR3Term(PVM pVM);
|
---|
92 | VMMR3DECL(void) SELMR3Reset(PVM pVM);
|
---|
93 | VMMR3DECL(int) SELMR3GetSelectorInfo(PVMCPU pVCpu, RTSEL Sel, PDBGFSELINFO pSelInfo);
|
---|
94 | VMMR3DECL(void) SELMR3DumpDescriptor(X86DESC Desc, RTSEL Sel, const char *pszMsg);
|
---|
95 | VMMR3DECL(void) SELMR3DumpGuestGDT(PVM pVM);
|
---|
96 | VMMR3DECL(void) SELMR3DumpGuestLDT(PVM pVM);
|
---|
97 |
|
---|
98 | /** @def SELMR3_DEBUG_CHECK
|
---|
99 | * Invokes SELMR3DebugCheck in stricts builds. */
|
---|
100 | # ifdef VBOX_STRICT
|
---|
101 | # define SELMR3_DEBUG_CHECK(pVM) SELMR3DebugCheck(pVM)
|
---|
102 | # else
|
---|
103 | # define SELMR3_DEBUG_CHECK(pVM) do { } while (0)
|
---|
104 | # endif
|
---|
105 | /** @} */
|
---|
106 | #endif /* IN_RING3 */
|
---|
107 |
|
---|
108 | /** @} */
|
---|
109 |
|
---|
110 | RT_C_DECLS_END
|
---|
111 |
|
---|
112 | #endif /* !VBOX_INCLUDED_vmm_selm_h */
|
---|
113 |
|
---|