1 | /** @file
|
---|
2 | * DBGF - Debugger Facility, selector interface partly shared with SELM.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2022 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_dbgfsel_h
|
---|
37 | #define VBOX_INCLUDED_vmm_dbgfsel_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <VBox/types.h>
|
---|
43 | #include <iprt/x86.h>
|
---|
44 |
|
---|
45 |
|
---|
46 | /** @addtogroup grp_dbgf
|
---|
47 | * @{ */
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * Selector information structure.
|
---|
51 | */
|
---|
52 | typedef struct DBGFSELINFO
|
---|
53 | {
|
---|
54 | /** The base address.
|
---|
55 | * For gate descriptors, this is the target address. */
|
---|
56 | RTGCPTR GCPtrBase;
|
---|
57 | /** The limit (-1).
|
---|
58 | * For gate descriptors, this is set to zero. */
|
---|
59 | RTGCUINTPTR cbLimit;
|
---|
60 | /** The raw descriptor. */
|
---|
61 | union
|
---|
62 | {
|
---|
63 | X86DESC Raw;
|
---|
64 | X86DESC64 Raw64;
|
---|
65 | } u;
|
---|
66 | /** The selector. */
|
---|
67 | RTSEL Sel;
|
---|
68 | /** The target selector for a gate.
|
---|
69 | * This is 0 if non-gate descriptor. */
|
---|
70 | RTSEL SelGate;
|
---|
71 | /** Flags. */
|
---|
72 | uint32_t fFlags;
|
---|
73 | } DBGFSELINFO;
|
---|
74 | /** Pointer to a SELM selector information struct. */
|
---|
75 | typedef DBGFSELINFO *PDBGFSELINFO;
|
---|
76 | /** Pointer to a const SELM selector information struct. */
|
---|
77 | typedef const DBGFSELINFO *PCDBGFSELINFO;
|
---|
78 |
|
---|
79 | /** @name DBGFSELINFO::fFlags
|
---|
80 | * @{ */
|
---|
81 | /** The CPU is in real mode. */
|
---|
82 | #define DBGFSELINFO_FLAGS_REAL_MODE RT_BIT_32(0)
|
---|
83 | /** The CPU is in protected mode. */
|
---|
84 | #define DBGFSELINFO_FLAGS_PROT_MODE RT_BIT_32(1)
|
---|
85 | /** The CPU is in long mode. */
|
---|
86 | #define DBGFSELINFO_FLAGS_LONG_MODE RT_BIT_32(2)
|
---|
87 | /** The selector is a hyper selector.
|
---|
88 | * @todo remove me! */
|
---|
89 | #define DBGFSELINFO_FLAGS_HYPER RT_BIT_32(3)
|
---|
90 | /** The selector is a gate selector. */
|
---|
91 | #define DBGFSELINFO_FLAGS_GATE RT_BIT_32(4)
|
---|
92 | /** The selector is invalid. */
|
---|
93 | #define DBGFSELINFO_FLAGS_INVALID RT_BIT_32(5)
|
---|
94 | /** The selector not present. */
|
---|
95 | #define DBGFSELINFO_FLAGS_NOT_PRESENT RT_BIT_32(6)
|
---|
96 | /** @} */
|
---|
97 |
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * Tests whether the selector info describes an expand-down selector or now.
|
---|
101 | *
|
---|
102 | * @returns true / false.
|
---|
103 | * @param pSelInfo The selector info.
|
---|
104 | */
|
---|
105 | DECLINLINE(bool) DBGFSelInfoIsExpandDown(PCDBGFSELINFO pSelInfo)
|
---|
106 | {
|
---|
107 | return (pSelInfo)->u.Raw.Gen.u1DescType
|
---|
108 | && ((pSelInfo)->u.Raw.Gen.u4Type & (X86_SEL_TYPE_DOWN | X86_SEL_TYPE_CODE)) == X86_SEL_TYPE_DOWN;
|
---|
109 | }
|
---|
110 |
|
---|
111 |
|
---|
112 | VMMR3DECL(int) DBGFR3SelInfoValidateCS(PCDBGFSELINFO pSelInfo, RTSEL SelCPL);
|
---|
113 |
|
---|
114 | /** @} */
|
---|
115 |
|
---|
116 | #endif /* !VBOX_INCLUDED_vmm_dbgfsel_h */
|
---|
117 |
|
---|