[1] | 1 | /** @file
|
---|
| 2 | * VirtualBox - Types.
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | /*
|
---|
[8155] | 6 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
[1] | 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
|
---|
[5999] | 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.
|
---|
[8155] | 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.
|
---|
[1] | 28 | */
|
---|
| 29 |
|
---|
[3632] | 30 | #ifndef ___VBox_types_h
|
---|
| 31 | #define ___VBox_types_h
|
---|
[1] | 32 |
|
---|
| 33 | #include <VBox/cdefs.h>
|
---|
| 34 | #include <iprt/types.h>
|
---|
| 35 |
|
---|
| 36 |
|
---|
| 37 | /** @defgroup grp_types Basic VBox Types
|
---|
| 38 | * @{
|
---|
| 39 | */
|
---|
| 40 |
|
---|
| 41 |
|
---|
| 42 | /** @defgroup grp_types_both Common Guest and Host Context Basic Types
|
---|
| 43 | * @ingroup grp_types
|
---|
| 44 | * @{
|
---|
| 45 | */
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 | /** @defgroup grp_types_hc Host Context Basic Types
|
---|
| 49 | * @ingroup grp_types_both
|
---|
| 50 | * @{
|
---|
| 51 | */
|
---|
| 52 |
|
---|
| 53 | /** @deprecated
|
---|
| 54 | * @{ */
|
---|
| 55 | typedef RTHCPHYS VBOXHCPHYS;
|
---|
| 56 | typedef VBOXHCPHYS *PVBOXHCPHYS;
|
---|
| 57 | #define NILVBOXHCPHYS NIL_RTHCPHYS
|
---|
| 58 | typedef RTHCPTR VBOXHCPTR;
|
---|
| 59 | typedef VBOXHCPTR *PVBOXHCPTR;
|
---|
| 60 | /** @} */
|
---|
| 61 |
|
---|
| 62 | /** @} */
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | /** @defgroup grp_types_gc Guest Context Basic Types
|
---|
| 66 | * @ingroup grp_types_both
|
---|
| 67 | * @{
|
---|
| 68 | */
|
---|
| 69 |
|
---|
| 70 | /** @} */
|
---|
| 71 |
|
---|
| 72 |
|
---|
| 73 | /** Pointer to per support driver session data.
|
---|
| 74 | * (The data is a R0 entity and private to the the R0 SUP part. All
|
---|
| 75 | * other should consider this a sort of handle.) */
|
---|
[1840] | 76 | typedef R0PTRTYPE(struct SUPDRVSESSION *) PSUPDRVSESSION;
|
---|
[1] | 77 |
|
---|
| 78 | /** Pointer to a VM. */
|
---|
| 79 | typedef struct VM *PVM;
|
---|
| 80 | /** Pointer to a VM - Ring-0 Ptr. */
|
---|
| 81 | typedef R0PTRTYPE(struct VM *) PVMR0;
|
---|
| 82 | /** Pointer to a VM - Ring-3 Ptr. */
|
---|
| 83 | typedef R3PTRTYPE(struct VM *) PVMR3;
|
---|
| 84 | /** Pointer to a VM - GC Ptr. */
|
---|
| 85 | typedef GCPTRTYPE(struct VM *) PVMGC;
|
---|
| 86 |
|
---|
[6796] | 87 | /** Pointer to a ring-0 (global) VM structure. */
|
---|
[5026] | 88 | typedef R0PTRTYPE(struct GVM *) PGVM;
|
---|
[1] | 89 |
|
---|
[6796] | 90 | /** Pointer to a ring-3 (user mode) VM structure. */
|
---|
| 91 | typedef R3PTRTYPE(struct UVM *) PUVM;
|
---|
[5026] | 92 |
|
---|
[6796] | 93 |
|
---|
[1] | 94 | /** VM State
|
---|
| 95 | */
|
---|
| 96 | typedef enum VMSTATE
|
---|
| 97 | {
|
---|
| 98 | /** The VM is being created. */
|
---|
| 99 | VMSTATE_CREATING = 0,
|
---|
| 100 | /** The VM is created. */
|
---|
| 101 | VMSTATE_CREATED,
|
---|
| 102 | /** The VM is runnning. */
|
---|
| 103 | VMSTATE_RUNNING,
|
---|
| 104 | /** The VM state is being loaded from file. */
|
---|
| 105 | VMSTATE_LOADING,
|
---|
| 106 | /** The VM is screwed because of a failed state loading. */
|
---|
| 107 | VMSTATE_LOAD_FAILURE,
|
---|
| 108 | /** The VM state is being saved to file. */
|
---|
| 109 | VMSTATE_SAVING,
|
---|
| 110 | /** The VM is suspended. */
|
---|
| 111 | VMSTATE_SUSPENDED,
|
---|
| 112 | /** The VM is being reset. */
|
---|
| 113 | VMSTATE_RESETTING,
|
---|
| 114 | /** The VM is in guru meditation over a fatal failure. */
|
---|
| 115 | VMSTATE_GURU_MEDITATION,
|
---|
| 116 | /** The VM is switched off, awaiting destruction. */
|
---|
| 117 | VMSTATE_OFF,
|
---|
| 118 | /** The VM is being destroyed. */
|
---|
| 119 | VMSTATE_DESTROYING,
|
---|
| 120 | /** Terminated. */
|
---|
| 121 | VMSTATE_TERMINATED,
|
---|
| 122 | /** hack forcing the size of the enum to 32-bits. */
|
---|
| 123 | VMSTATE_MAKE_32BIT_HACK = 0x7fffffff
|
---|
| 124 | } VMSTATE;
|
---|
| 125 |
|
---|
| 126 |
|
---|
[4013] | 127 | /** Pointer to a PDM Driver Base Interface. */
|
---|
| 128 | typedef struct PDMIBASE *PPDMIBASE;
|
---|
| 129 | /** Pointer to a pointer to a PDM Driver Base Interface. */
|
---|
| 130 | typedef PPDMIBASE *PPPDMIBASE;
|
---|
| 131 |
|
---|
[1] | 132 | /** Pointer to a PDM Device Instance. */
|
---|
| 133 | typedef struct PDMDEVINS *PPDMDEVINS;
|
---|
| 134 | /** Pointer to a pointer to a PDM Device Instance. */
|
---|
| 135 | typedef PPDMDEVINS *PPPDMDEVINS;
|
---|
| 136 | /** R3 pointer to a PDM Device Instance. */
|
---|
| 137 | typedef R3PTRTYPE(PPDMDEVINS) PPDMDEVINSR3;
|
---|
| 138 | /** R0 pointer to a PDM Device Instance. */
|
---|
| 139 | typedef R0PTRTYPE(PPDMDEVINS) PPDMDEVINSR0;
|
---|
| 140 | /** GC pointer to a PDM Device Instance. */
|
---|
| 141 | typedef GCPTRTYPE(PPDMDEVINS) PPDMDEVINSGC;
|
---|
| 142 |
|
---|
[3852] | 143 | /** Pointer to a PDM USB Device Instance. */
|
---|
| 144 | typedef struct PDMUSBINS *PPDMUSBINS;
|
---|
| 145 | /** Pointer to a pointer to a PDM USB Device Instance. */
|
---|
| 146 | typedef PPDMUSBINS *PPPDMUSBINS;
|
---|
| 147 |
|
---|
[1] | 148 | /** Pointer to a PDM Driver Instance. */
|
---|
| 149 | typedef struct PDMDRVINS *PPDMDRVINS;
|
---|
| 150 | /** Pointer to a pointer to a PDM Driver Instance. */
|
---|
| 151 | typedef PPDMDRVINS *PPPDMDRVINS;
|
---|
| 152 |
|
---|
| 153 | /** Pointer to a PDM Service Instance. */
|
---|
| 154 | typedef struct PDMSRVINS *PPDMSRVINS;
|
---|
| 155 | /** Pointer to a pointer to a PDM Service Instance. */
|
---|
| 156 | typedef PPDMSRVINS *PPPDMSRVINS;
|
---|
| 157 |
|
---|
| 158 | /** R3 pointer to a timer. */
|
---|
| 159 | typedef R3PTRTYPE(struct TMTIMER *) PTMTIMERR3;
|
---|
| 160 | /** Pointer to a R3 pointer to a timer. */
|
---|
| 161 | typedef PTMTIMERR3 *PPTMTIMERR3;
|
---|
| 162 |
|
---|
| 163 | /** R0 pointer to a timer. */
|
---|
| 164 | typedef R0PTRTYPE(struct TMTIMER *) PTMTIMERR0;
|
---|
| 165 | /** Pointer to a R3 pointer to a timer. */
|
---|
| 166 | typedef PTMTIMERR0 *PPTMTIMERR0;
|
---|
| 167 |
|
---|
| 168 | /** GC pointer to a timer. */
|
---|
| 169 | typedef GCPTRTYPE(struct TMTIMER *) PTMTIMERGC;
|
---|
| 170 | /** Pointer to a GC pointer to a timer. */
|
---|
| 171 | typedef PTMTIMERGC *PPTMTIMERGC;
|
---|
| 172 |
|
---|
| 173 | /** Pointer to a timer. */
|
---|
[4787] | 174 | typedef CTXALLSUFF(PTMTIMER) PTMTIMER;
|
---|
[1] | 175 | /** Pointer to a pointer to a timer. */
|
---|
[4787] | 176 | typedef CTXALLSUFF(PPTMTIMER) PPTMTIMER;
|
---|
[1] | 177 |
|
---|
| 178 | /** SSM Operation handle. */
|
---|
| 179 | typedef struct SSMHANDLE *PSSMHANDLE;
|
---|
| 180 |
|
---|
[7133] | 181 | /** Pointer to a CPUMCTX. */
|
---|
| 182 | typedef struct CPUMCTX *PCPUMCTX;
|
---|
| 183 | /** Pointer to a const CPUMCTX. */
|
---|
| 184 | typedef const struct CPUMCTX *PCCPUMCTX;
|
---|
| 185 |
|
---|
| 186 | /** Pointer to a CPU context core. */
|
---|
| 187 | typedef struct CPUMCTXCORE *PCPUMCTXCORE;
|
---|
| 188 | /** Pointer to a const CPU context core. */
|
---|
| 189 | typedef const struct CPUMCTXCORE *PCCPUMCTXCORE;
|
---|
| 190 |
|
---|
| 191 | /** Pointer to selector hidden registers. */
|
---|
| 192 | typedef struct CPUMSELREGHID *PCPUMSELREGHID;
|
---|
| 193 | /** Pointer to const selector hidden registers. */
|
---|
| 194 | typedef const struct CPUMSELREGHID *PCCPUMSELREGHID;
|
---|
| 195 |
|
---|
[1] | 196 | /** @} */
|
---|
| 197 |
|
---|
| 198 |
|
---|
| 199 | /** @defgroup grp_types_idt Interrupt Descriptor Table Entry.
|
---|
| 200 | * @ingroup grp_types
|
---|
| 201 | * @todo This all belongs in x86.h!
|
---|
| 202 | * @{ */
|
---|
| 203 |
|
---|
| 204 | /** @todo VBOXIDT -> VBOXDESCIDT, skip the complex variations. We'll never use them. */
|
---|
| 205 |
|
---|
| 206 | /** IDT Entry, Task Gate view. */
|
---|
| 207 | #pragma pack(1) /* paranoia */
|
---|
| 208 | typedef struct VBOXIDTE_TASKGATE
|
---|
| 209 | {
|
---|
| 210 | /** Reserved. */
|
---|
| 211 | unsigned u16Reserved1 : 16;
|
---|
| 212 | /** Task Segment Selector. */
|
---|
| 213 | unsigned u16TSS : 16;
|
---|
| 214 | /** More reserved. */
|
---|
| 215 | unsigned u8Reserved2 : 8;
|
---|
| 216 | /** Fixed value bit 0 - Set to 1. */
|
---|
| 217 | unsigned u1Fixed0 : 1;
|
---|
| 218 | /** Busy bit. */
|
---|
| 219 | unsigned u1Busy : 1;
|
---|
| 220 | /** Fixed value bit 2 - Set to 1. */
|
---|
| 221 | unsigned u1Fixed1 : 1;
|
---|
| 222 | /** Fixed value bit 3 - Set to 0. */
|
---|
| 223 | unsigned u1Fixed2: 1;
|
---|
| 224 | /** Fixed value bit 4 - Set to 0. */
|
---|
| 225 | unsigned u1Fixed3 : 1;
|
---|
| 226 | /** Descriptor Privilege level. */
|
---|
| 227 | unsigned u2DPL : 2;
|
---|
| 228 | /** Present flag. */
|
---|
| 229 | unsigned u1Present : 1;
|
---|
| 230 | /** Reserved. */
|
---|
| 231 | unsigned u16Reserved3 : 16;
|
---|
| 232 | } VBOXIDTE_TASKGATE;
|
---|
| 233 | #pragma pack()
|
---|
| 234 | /** Pointer to IDT Entry, Task gate view. */
|
---|
| 235 | typedef VBOXIDTE_TASKGATE *PVBOXIDTE_TASKGATE;
|
---|
| 236 |
|
---|
| 237 |
|
---|
| 238 | /** IDT Entry, Intertupt gate view. */
|
---|
| 239 | #pragma pack(1) /* paranoia */
|
---|
| 240 | typedef struct VBOXIDTE_INTERRUPTGATE
|
---|
| 241 | {
|
---|
| 242 | /** Low offset word. */
|
---|
| 243 | unsigned u16OffsetLow : 16;
|
---|
| 244 | /** Segment Selector. */
|
---|
| 245 | unsigned u16SegSel : 16;
|
---|
| 246 | /** Reserved. */
|
---|
| 247 | unsigned u5Reserved2 : 5;
|
---|
| 248 | /** Fixed value bit 0 - Set to 0. */
|
---|
| 249 | unsigned u1Fixed0 : 1;
|
---|
| 250 | /** Fixed value bit 1 - Set to 0. */
|
---|
| 251 | unsigned u1Fixed1 : 1;
|
---|
| 252 | /** Fixed value bit 2 - Set to 0. */
|
---|
| 253 | unsigned u1Fixed2 : 1;
|
---|
| 254 | /** Fixed value bit 3 - Set to 0. */
|
---|
| 255 | unsigned u1Fixed3: 1;
|
---|
| 256 | /** Fixed value bit 4 - Set to 1. */
|
---|
| 257 | unsigned u1Fixed4 : 1;
|
---|
| 258 | /** Fixed value bit 5 - Set to 1. */
|
---|
| 259 | unsigned u1Fixed5 : 1;
|
---|
| 260 | /** Gate size, 1 = 32 bits, 0 = 16 bits. */
|
---|
| 261 | unsigned u132BitGate : 1;
|
---|
| 262 | /** Fixed value bit 5 - Set to 0. */
|
---|
| 263 | unsigned u1Fixed6 : 1;
|
---|
| 264 | /** Descriptor Privilege level. */
|
---|
| 265 | unsigned u2DPL : 2;
|
---|
| 266 | /** Present flag. */
|
---|
| 267 | unsigned u1Present : 1;
|
---|
| 268 | /** High offset word. */
|
---|
| 269 | unsigned u16OffsetHigh : 16;
|
---|
| 270 | } VBOXIDTE_INTERRUPTGATE;
|
---|
| 271 | #pragma pack()
|
---|
| 272 | /** Pointer to IDT Entry, Interrupt gate view. */
|
---|
| 273 | typedef VBOXIDTE_INTERRUPTGATE *PVBOXIDTE_INTERRUPTGATE;
|
---|
| 274 |
|
---|
| 275 | /** IDT Entry, Trap Gate view. */
|
---|
| 276 | #pragma pack(1) /* paranoia */
|
---|
| 277 | typedef struct VBOXIDTE_TRAPGATE
|
---|
| 278 | {
|
---|
| 279 | /** Low offset word. */
|
---|
| 280 | unsigned u16OffsetLow : 16;
|
---|
| 281 | /** Segment Selector. */
|
---|
| 282 | unsigned u16SegSel : 16;
|
---|
| 283 | /** Reserved. */
|
---|
| 284 | unsigned u5Reserved2 : 5;
|
---|
| 285 | /** Fixed value bit 0 - Set to 0. */
|
---|
| 286 | unsigned u1Fixed0 : 1;
|
---|
| 287 | /** Fixed value bit 1 - Set to 0. */
|
---|
| 288 | unsigned u1Fixed1 : 1;
|
---|
| 289 | /** Fixed value bit 2 - Set to 0. */
|
---|
| 290 | unsigned u1Fixed2 : 1;
|
---|
| 291 | /** Fixed value bit 3 - Set to 1. */
|
---|
| 292 | unsigned u1Fixed3: 1;
|
---|
| 293 | /** Fixed value bit 4 - Set to 1. */
|
---|
| 294 | unsigned u1Fixed4 : 1;
|
---|
| 295 | /** Fixed value bit 5 - Set to 1. */
|
---|
| 296 | unsigned u1Fixed5 : 1;
|
---|
| 297 | /** Gate size, 1 = 32 bits, 0 = 16 bits. */
|
---|
| 298 | unsigned u132BitGate : 1;
|
---|
| 299 | /** Fixed value bit 5 - Set to 0. */
|
---|
| 300 | unsigned u1Fixed6 : 1;
|
---|
| 301 | /** Descriptor Privilege level. */
|
---|
| 302 | unsigned u2DPL : 2;
|
---|
| 303 | /** Present flag. */
|
---|
| 304 | unsigned u1Present : 1;
|
---|
| 305 | /** High offset word. */
|
---|
| 306 | unsigned u16OffsetHigh : 16;
|
---|
| 307 | } VBOXIDTE_TRAPGATE;
|
---|
| 308 | #pragma pack()
|
---|
| 309 | /** Pointer to IDT Entry, Trap Gate view. */
|
---|
| 310 | typedef VBOXIDTE_TRAPGATE *PVBOXIDTE_TRAPGATE;
|
---|
| 311 |
|
---|
| 312 | /** IDT Entry Generic view. */
|
---|
| 313 | #pragma pack(1) /* paranoia */
|
---|
| 314 | typedef struct VBOXIDTE_GENERIC
|
---|
| 315 | {
|
---|
| 316 | /** Low offset word. */
|
---|
| 317 | unsigned u16OffsetLow : 16;
|
---|
| 318 | /** Segment Selector. */
|
---|
| 319 | unsigned u16SegSel : 16;
|
---|
| 320 | /** Reserved. */
|
---|
| 321 | unsigned u5Reserved : 5;
|
---|
| 322 | /** IDT Type part one (not used for task gate). */
|
---|
| 323 | unsigned u3Type1 : 3;
|
---|
| 324 | /** IDT Type part two. */
|
---|
| 325 | unsigned u5Type2 : 5;
|
---|
| 326 | /** Descriptor Privilege level. */
|
---|
| 327 | unsigned u2DPL : 2;
|
---|
| 328 | /** Present flag. */
|
---|
| 329 | unsigned u1Present : 1;
|
---|
| 330 | /** High offset word. */
|
---|
| 331 | unsigned u16OffsetHigh : 16;
|
---|
| 332 | } VBOXIDTE_GENERIC;
|
---|
| 333 | #pragma pack()
|
---|
| 334 | /** Pointer to IDT Entry Generic view. */
|
---|
| 335 | typedef VBOXIDTE_GENERIC *PVBOXIDTE_GENERIC;
|
---|
| 336 |
|
---|
| 337 | /** IDT Type1 value. (Reserved for task gate!) */
|
---|
| 338 | #define VBOX_IDTE_TYPE1 0
|
---|
| 339 | /** IDT Type2 value - Task gate. */
|
---|
| 340 | #define VBOX_IDTE_TYPE2_TASK 0x5
|
---|
| 341 | /** IDT Type2 value - 16 bit interrupt gate. */
|
---|
| 342 | #define VBOX_IDTE_TYPE2_INT_16 0x6
|
---|
| 343 | /** IDT Type2 value - 32 bit interrupt gate. */
|
---|
| 344 | #define VBOX_IDTE_TYPE2_INT_32 0xe
|
---|
| 345 | /** IDT Type2 value - 16 bit trap gate. */
|
---|
| 346 | #define VBOX_IDTE_TYPE2_TRAP_16 0x7
|
---|
| 347 | /** IDT Type2 value - 32 bit trap gate. */
|
---|
| 348 | #define VBOX_IDTE_TYPE2_TRAP_32 0xf
|
---|
| 349 |
|
---|
| 350 | /** IDT Entry. */
|
---|
| 351 | #pragma pack(1) /* paranoia */
|
---|
| 352 | typedef union VBOXIDTE
|
---|
| 353 | {
|
---|
| 354 | /** Task gate view. */
|
---|
| 355 | VBOXIDTE_TASKGATE Task;
|
---|
| 356 | /** Trap gate view. */
|
---|
| 357 | VBOXIDTE_TRAPGATE Trap;
|
---|
| 358 | /** Interrupt gate view. */
|
---|
| 359 | VBOXIDTE_INTERRUPTGATE Int;
|
---|
| 360 | /** Generic IDT view. */
|
---|
| 361 | VBOXIDTE_GENERIC Gen;
|
---|
| 362 |
|
---|
| 363 | /** 8 bit unsigned integer view. */
|
---|
| 364 | uint8_t au8[8];
|
---|
| 365 | /** 16 bit unsigned integer view. */
|
---|
| 366 | uint16_t au16[4];
|
---|
| 367 | /** 32 bit unsigned integer view. */
|
---|
| 368 | uint32_t au32[2];
|
---|
| 369 | /** 64 bit unsigned integer view. */
|
---|
| 370 | uint64_t au64;
|
---|
| 371 | } VBOXIDTE;
|
---|
| 372 | #pragma pack()
|
---|
| 373 | /** Pointer to IDT Entry. */
|
---|
| 374 | typedef VBOXIDTE *PVBOXIDTE;
|
---|
| 375 |
|
---|
| 376 | #pragma pack(1)
|
---|
| 377 | /** IDTR */
|
---|
| 378 | typedef struct VBOXIDTR
|
---|
| 379 | {
|
---|
| 380 | /** Size of the IDT. */
|
---|
| 381 | uint16_t cbIdt;
|
---|
| 382 | /** Address of the IDT. */
|
---|
| 383 | uint32_t pIdt;
|
---|
| 384 | } VBOXIDTR, *PVBOXIDTR;
|
---|
| 385 | #pragma pack()
|
---|
| 386 | /** @} */
|
---|
| 387 |
|
---|
| 388 |
|
---|
| 389 | /** @defgroup grp_types_desc Descriptor Table Entry.
|
---|
| 390 | * @ingroup grp_types
|
---|
| 391 | * @{ */
|
---|
| 392 |
|
---|
| 393 | #pragma pack(1)
|
---|
| 394 | /**
|
---|
| 395 | * Memory descriptor.
|
---|
| 396 | */
|
---|
| 397 | typedef struct VBOXDESCGENERIC
|
---|
| 398 | {
|
---|
| 399 | /** 0-15 - Limit - Low word. */
|
---|
| 400 | unsigned u16LimitLow : 16;
|
---|
| 401 | /** 16-31 - Base address - lowe word.
|
---|
| 402 | * Don't try set this to 24 because MSC is doing studing things then. */
|
---|
| 403 | unsigned u16BaseLow : 16;
|
---|
| 404 | /** 32-39 - Base address - first 8 bits of high word. */
|
---|
| 405 | unsigned u8BaseHigh1 : 8;
|
---|
| 406 | /** 40-43 - Segment Type. */
|
---|
| 407 | unsigned u4Type : 4;
|
---|
| 408 | /** 44 - Descriptor Type. System(=0) or code/data selector */
|
---|
| 409 | unsigned u1DescType : 1;
|
---|
| 410 | /** 45-46 - Descriptor Privelege level. */
|
---|
| 411 | unsigned u2Dpl : 2;
|
---|
| 412 | /** 47 - Flags selector present(=1) or not. */
|
---|
| 413 | unsigned u1Present : 1;
|
---|
| 414 | /** 48-51 - Segment limit 16-19. */
|
---|
| 415 | unsigned u4LimitHigh : 4;
|
---|
| 416 | /** 52 - Available for system software. */
|
---|
| 417 | unsigned u1Available : 1;
|
---|
| 418 | /** 53 - Reserved - 0. In long mode this is the 'Long' (L) attribute bit. */
|
---|
| 419 | unsigned u1Reserved : 1;
|
---|
| 420 | /** 54 - This flags meaning depends on the segment type. Try make sense out
|
---|
| 421 | * of the intel manual yourself. */
|
---|
| 422 | unsigned u1DefBig : 1;
|
---|
| 423 | /** 55 - Granularity of the limit. If set 4KB granularity is used, if
|
---|
| 424 | * clear byte. */
|
---|
| 425 | unsigned u1Granularity : 1;
|
---|
| 426 | /** 56-63 - Base address - highest 8 bits. */
|
---|
| 427 | unsigned u8BaseHigh2 : 8;
|
---|
| 428 | } VBOXDESCGENERIC;
|
---|
| 429 | #pragma pack()
|
---|
| 430 | /** Pointer to a generic descriptor entry. */
|
---|
| 431 | typedef VBOXDESCGENERIC *PVBOXDESCGENERIC;
|
---|
| 432 |
|
---|
| 433 | #pragma pack(1)
|
---|
| 434 | /**
|
---|
| 435 | * Descriptor table entry.
|
---|
| 436 | */
|
---|
| 437 | typedef union VBOXDESC
|
---|
| 438 | {
|
---|
| 439 | /** Generic descriptor view. */
|
---|
| 440 | VBOXDESCGENERIC Gen;
|
---|
| 441 | /** IDT view. */
|
---|
| 442 | VBOXIDTE Idt;
|
---|
| 443 |
|
---|
| 444 | /** 8 bit unsigned interger view. */
|
---|
| 445 | uint8_t au8[8];
|
---|
| 446 | /** 16 bit unsigned interger view. */
|
---|
| 447 | uint16_t au16[4];
|
---|
| 448 | /** 32 bit unsigned interger view. */
|
---|
| 449 | uint32_t au32[2];
|
---|
| 450 | } VBOXDESC;
|
---|
| 451 | #pragma pack()
|
---|
| 452 | /** Pointer to descriptor table entry. */
|
---|
| 453 | typedef VBOXDESC *PVBOXDESC;
|
---|
| 454 | /** Pointer to const descriptor table entry. */
|
---|
| 455 | typedef VBOXDESC const *PCVBOXDESC;
|
---|
| 456 |
|
---|
| 457 |
|
---|
| 458 | #pragma pack(1)
|
---|
| 459 | /** GDTR */
|
---|
| 460 | typedef struct VBOXGDTR
|
---|
| 461 | {
|
---|
| 462 | /** Size of the GDT. */
|
---|
| 463 | uint16_t cbGdt;
|
---|
| 464 | /** Address of the GDT. */
|
---|
| 465 | uint32_t pGdt;
|
---|
| 466 | } VBOXGDTR;
|
---|
| 467 | #pragma pack()
|
---|
| 468 | /** Pointer to GDTR. */
|
---|
| 469 | typedef VBOXGDTR *PVBOXGDTR;
|
---|
| 470 |
|
---|
| 471 | /** @} */
|
---|
| 472 |
|
---|
| 473 |
|
---|
| 474 | /**
|
---|
| 475 | * Task Segment
|
---|
| 476 | */
|
---|
| 477 | #pragma pack(1)
|
---|
| 478 | typedef struct VBOXTSS
|
---|
| 479 | {
|
---|
| 480 | /** Back link to previous task. (static) */
|
---|
| 481 | RTSEL selPrev;
|
---|
| 482 | uint16_t padding1;
|
---|
| 483 | /** Ring-0 stack pointer. (static) */
|
---|
| 484 | uint32_t esp0;
|
---|
| 485 | /** Ring-0 stack segment. (static) */
|
---|
| 486 | RTSEL ss0;
|
---|
| 487 | uint16_t padding_ss0;
|
---|
| 488 | /** Ring-1 stack pointer. (static) */
|
---|
| 489 | uint32_t esp1;
|
---|
| 490 | /** Ring-1 stack segment. (static) */
|
---|
| 491 | RTSEL ss1;
|
---|
| 492 | uint16_t padding_ss1;
|
---|
| 493 | /** Ring-2 stack pointer. (static) */
|
---|
| 494 | uint32_t esp2;
|
---|
| 495 | /** Ring-2 stack segment. (static) */
|
---|
| 496 | RTSEL ss2;
|
---|
| 497 | uint16_t padding_ss2;
|
---|
| 498 | /** Page directory for the task. (static) */
|
---|
| 499 | uint32_t cr3;
|
---|
| 500 | /** EIP before task switch. */
|
---|
| 501 | uint32_t eip;
|
---|
| 502 | /** EFLAGS before task switch. */
|
---|
| 503 | uint32_t eflags;
|
---|
| 504 | /** EAX before task switch. */
|
---|
| 505 | uint32_t eax;
|
---|
| 506 | /** ECX before task switch. */
|
---|
| 507 | uint32_t ecx;
|
---|
| 508 | /** EDX before task switch. */
|
---|
| 509 | uint32_t edx;
|
---|
| 510 | /** EBX before task switch. */
|
---|
| 511 | uint32_t ebx;
|
---|
| 512 | /** ESP before task switch. */
|
---|
| 513 | uint32_t esp;
|
---|
| 514 | /** EBP before task switch. */
|
---|
| 515 | uint32_t ebp;
|
---|
| 516 | /** ESI before task switch. */
|
---|
| 517 | uint32_t esi;
|
---|
| 518 | /** EDI before task switch. */
|
---|
| 519 | uint32_t edi;
|
---|
| 520 | /** ES before task switch. */
|
---|
| 521 | RTSEL es;
|
---|
| 522 | uint16_t padding_es;
|
---|
| 523 | /** CS before task switch. */
|
---|
| 524 | RTSEL cs;
|
---|
| 525 | uint16_t padding_cs;
|
---|
| 526 | /** SS before task switch. */
|
---|
| 527 | RTSEL ss;
|
---|
| 528 | uint16_t padding_ss;
|
---|
| 529 | /** DS before task switch. */
|
---|
| 530 | RTSEL ds;
|
---|
| 531 | uint16_t padding_ds;
|
---|
| 532 | /** FS before task switch. */
|
---|
| 533 | RTSEL fs;
|
---|
| 534 | uint16_t padding_fs;
|
---|
| 535 | /** GS before task switch. */
|
---|
| 536 | RTSEL gs;
|
---|
| 537 | uint16_t padding_gs;
|
---|
| 538 | /** LDTR before task switch. */
|
---|
| 539 | RTSEL selLdt;
|
---|
| 540 | uint16_t padding_ldt;
|
---|
| 541 | /** Debug trap flag */
|
---|
| 542 | uint16_t fDebugTrap;
|
---|
| 543 | /** Offset relative to the TSS of the start of the I/O Bitmap
|
---|
| 544 | * and the end of the interrupt redirection bitmap. */
|
---|
| 545 | uint16_t offIoBitmap;
|
---|
[1580] | 546 | /** 32 bytes for the virtual interrupt redirection bitmap. (VME) */
|
---|
| 547 | uint8_t IntRedirBitmap[32];
|
---|
[1] | 548 | } VBOXTSS;
|
---|
| 549 | #pragma pack()
|
---|
| 550 | /** Pointer to task segment. */
|
---|
| 551 | typedef VBOXTSS *PVBOXTSS;
|
---|
| 552 | /** Pointer to const task segment. */
|
---|
| 553 | typedef const VBOXTSS *PCVBOXTSS;
|
---|
| 554 |
|
---|
| 555 |
|
---|
| 556 | /** @} */
|
---|
| 557 |
|
---|
| 558 | #endif
|
---|