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