VirtualBox

source: vbox/trunk/include/iprt/nt/nt-structures.h

Last change on this file was 98103, checked in by vboxsync, 17 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.5 KB
Line 
1/* $Id: nt-structures.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * IPRT - Header for NT structures.
4 */
5
6/*
7 * Copyright (C) 2010-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * The contents of this file may alternatively be used under the terms
26 * of the Common Development and Distribution License Version 1.0
27 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28 * in the VirtualBox distribution, in which case the provisions of the
29 * CDDL are applicable instead of those of the GPL.
30 *
31 * You may elect to license modified versions of this file under the
32 * terms and conditions of either the GPL or the CDDL or both.
33 *
34 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35 */
36
37#ifndef IPRT_INCLUDED_nt_nt_structures_h
38#define IPRT_INCLUDED_nt_nt_structures_h
39#ifndef RT_WITHOUT_PRAGMA_ONCE
40# pragma once
41#endif
42
43
44#include <iprt/types.h>
45
46
47/** @name NT Kernel Structures
48 * @{ */
49typedef struct KTRAP_FRAME_AMD64
50{
51 uint64_t P1Home; /**< 0x00 */
52 uint64_t P2Home; /**< 0x08 */
53 uint64_t P3Home; /**< 0x10 */
54 uint64_t P4Home; /**< 0x18 */
55 uint64_t P5; /**< 0x20 */
56 uint8_t PreviousMode; /**< 0x28: KPROCESSOR_MODE / MODE - unused? */
57 uint8_t PreviousIrql; /**< 0x29: KIRQL - Interrupts? */
58 uint8_t FaultIndicator; /**< 0x2a: Holds (ErrCd >> 1) & 9) for \#PF. */
59 uint8_t ExceptionActive; /**< 0x2b: 0 if interrupt, 1 if exception, 2 if service call, */
60 uint32_t MxCsr; /**< 0x2c */
61 /** @name Volatile general register state. Only saved on interrupts and exceptions.
62 * @{ */
63 uint64_t Rax; /**< 0x30 */
64 uint64_t Rcx; /**< 0x38 */
65 uint64_t Rdx; /**< 0x40 */
66 uint64_t R8; /**< 0x48 */
67 uint64_t R9; /**< 0x50 */
68 uint64_t R10; /**< 0x58 */
69 uint64_t R11; /**< 0x60 */
70 /** @} */
71 uint64_t GsBaseOrSwap; /**< 0x68: GsBase if previous mode is kernel, GsSwap if pervious mode was user. */
72 /** @name Volatile SSE state. Only saved on interrupts and exceptions.
73 * @{ */
74 RTUINT128U Xmm0; /**< 0x70 */
75 RTUINT128U Xmm1; /**< 0x80: RBP points here. */
76 RTUINT128U Xmm2; /**< 0x90 */
77 RTUINT128U Xmm3; /**< 0xa0 */
78 RTUINT128U Xmm4; /**< 0xb0 */
79 RTUINT128U Xmm5; /**< 0xc0 */
80 /** @} */
81 uint64_t FaultAddrOrCtxRecOrTS; /**< 0xd0: Used to save CR2 in \#PF and NMI handlers. */
82 /** @name Usermode debug state.
83 * @{ */
84 uint64_t Dr0; /**< 0xd8: Only if DR7 indicates active. */
85 uint64_t Dr1; /**< 0xe0: Only if DR7 indicates active. */
86 uint64_t Dr2; /**< 0xe8: Only if DR7 indicates active. */
87 uint64_t Dr3; /**< 0xf0: Only if DR7 indicates active. */
88 uint64_t Dr6; /**< 0xf8: Only if DR7 indicates active. */
89 uint64_t Dr7; /**< 0x100: Considered active any of these bits are set:
90 X86_DR7_LE_ALL | X86_DR7_LE | X86_DR7_GE. */
91 union
92 {
93 struct
94 {
95 uint64_t LastBranchControl; /**< 0x108 */
96 uint32_t LastBranchMSR; /**< 0x110 */
97 } amd;
98 struct
99 {
100 uint64_t DebugControl; /**< 0x108 */
101 uint64_t LastBranchToRip; /**< 0x110 */
102 uint64_t LastBranchFromRip; /**< 0x118 */
103 uint64_t LastExceptionToRip; /**< 0x120 */
104 uint64_t LastExceptionFromRip; /**< 0x128 */
105 } intel;
106 } u;
107 /** @} */
108 /** @name Segment registers. Not sure when these would actually be used.
109 * @{ */
110 uint16_t SegDs; /**< 0x130 */
111 uint16_t SegEs; /**< 0x132 */
112 uint16_t SegFs; /**< 0x134 */
113 uint16_t SegGs; /**< 0x136 */
114 /** @} */
115 uint64_t TrapFrame; /**< 0x138 */
116 /** @name Some non-volatile registers only saved in service calls.
117 * @{ */
118 uint64_t Rbx; /**< 0x140 */
119 uint64_t Rdi; /**< 0x148 */
120 uint64_t Rsi; /**< 0x150 */
121 /** @} */
122 uint64_t Rbp; /**< 0x158: Typically restored by: MOV RBP, [RBP + 0xd8] */
123 uint64_t ErrCdOrXcptFrameOrS; /**< 0x160 */
124 uint64_t Rip; /**< 0x168 - IRET RIP */
125 uint16_t SegCs; /**< 0x170 - IRET CS */
126 uint8_t Fill0; /**< 0x172 */
127 uint8_t Logging; /**< 0x173 */
128 uint16_t Fill1[2]; /**< 0x174 */
129 uint32_t EFlags; /**< 0x178 - IRET EFLAGS - Uninitialized for stack switching/growth code path. */
130 uint32_t Fill2; /**< 0x17c */
131 uint64_t Rsp; /**< 0x180 - IRET RSP */
132 uint16_t SegSs; /**< 0x188 - IRET SS */
133 uint16_t Fill3; /**< 0x18a */
134 uint32_t Fill4; /**< 0x18c */
135} KTRAP_FRAME_AMD64;
136AssertCompileSize(KTRAP_FRAME_AMD64, 0x190);
137/** Pointer to an AMD64 NT trap frame. */
138typedef KTRAP_FRAME_AMD64 *PKTRAP_FRAME_AMD64;
139/** Pointer to a const AMD64 NT trap frame. */
140typedef KTRAP_FRAME_AMD64 const *PCKTRAP_FRAME_AMD64;
141
142/** @} */
143
144
145#endif /* !IPRT_INCLUDED_nt_nt_structures_h */
146
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use