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