VirtualBox

source: vbox/trunk/include/VBox/types.h@ 60534

Last change on this file since 60534 was 60404, checked in by vboxsync, 9 years ago

VMM,Devices,Main: Implemented soft/warm reset for shutdown status codes 05h, 09h and 0Ah.

This is a shot at adjusting our VM reset handling to handle the ancient way of
getting a 286 out of protected mode and back to real mode. Our exiting reset
code (XXXR3Reset, PDMDEVREG::pfnReset, and so on) is doing a cold reset of the
system and then some additional device & memory initialization that the firmware
is usually responsible for doing. When the guest triggers a reset via the
keyboard controller, system control port A, CPU triple fault, and possibly ACPI,
only the CPU is supposed to be reset. The BIOS would then decide whether memory
and devices needed resetting as well, or if the resetter justed wanted to get out
protected mode and resume executing some real mode code pointed to by 467h.

  • New states SOFT_RESETTING and SOFT_RESETTING_LS. The latter returns to RUNNING_LS, not SUSPENDED_LS like for hard reset.
  • Added a firmware interface so the VMM/PDM can ask it whether we're supposed to do a hard reset or a soft(/warm) one.
  • Implemented firmware interface for the PC BIOS (but not EFI). It indicates soft(/warm) reset when CMOS[0xf] is 5, 9 or 10.
  • Moved the CMOS[0xf] resetting from the RTC device to the PC BIOS since it's firmware thing, not RTC.
  • Added a flag parameter to PDMDevHlpVMReset for specifying the source of the reset operation. One class of sources (GIM) will always trigger hard resets, whereas the others will check with the firmware first.
  • Added PDMR3GetResetInfo for query the flags passed to PDMDevHlpVMReset and for asking the firmware whether it's a hard or soft reset. The latter, however, is only done if only CPU 0 is active. Systems with more than one CPU in a state other than EMSTATE_WAIT_SIPI status will always be hard reset.
  • Added internal VMR3ResetFF and VMR3ResetTripleFault APIs for handling the VM_FF_RESET and VINF_EM_TRIPLE_FAULT conditions.
  • Added PMDR3ResetSoft and had it call pfnSoftReset (which is now defined).

Warning! Major PDM_DEVHLPR3_VERSION change, minor PDM_DEVREG_VERSION change.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 33.8 KB
Line 
1/** @file
2 * VirtualBox - Types.
3 */
4
5/*
6 * Copyright (C) 2006-2015 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_types_h
27#define ___VBox_types_h
28
29#include <VBox/cdefs.h>
30#include <iprt/types.h>
31
32
33/** @defgroup grp_types VBox Basic Types
34 * @{
35 */
36
37
38/** @defgroup grp_types_both Common Guest and Host Context Basic Types
39 * @{
40 */
41
42
43/** @defgroup grp_types_hc Host Context Basic Types
44 * @{
45 */
46
47/** @} */
48
49
50/** @defgroup grp_types_gc Guest Context Basic Types
51 * @{
52 */
53
54/** @} */
55
56
57/** Pointer to per support driver session data.
58 * (The data is a R0 entity and private to the the R0 SUP part. All
59 * other should consider this a sort of handle.) */
60typedef R0PTRTYPE(struct SUPDRVSESSION *) PSUPDRVSESSION;
61
62/** Event semaphore handle. Ring-0 / ring-3. */
63typedef R0PTRTYPE(struct SUPSEMEVENTHANDLE *) SUPSEMEVENT;
64/** Pointer to an event semaphore handle. */
65typedef SUPSEMEVENT *PSUPSEMEVENT;
66/** Nil event semaphore handle. */
67#define NIL_SUPSEMEVENT ((SUPSEMEVENT)0)
68
69/** Multiple release event semaphore handle. Ring-0 / ring-3. */
70typedef R0PTRTYPE(struct SUPSEMEVENTMULTIHANDLE *) SUPSEMEVENTMULTI;
71/** Pointer to an multiple release event semaphore handle. */
72typedef SUPSEMEVENTMULTI *PSUPSEMEVENTMULTI;
73/** Nil multiple release event semaphore handle. */
74#define NIL_SUPSEMEVENTMULTI ((SUPSEMEVENTMULTI)0)
75
76
77/** Pointer to a VM. */
78typedef struct VM *PVM;
79/** Pointer to a VM - Ring-0 Ptr. */
80typedef R0PTRTYPE(struct VM *) PVMR0;
81/** Pointer to a VM - Ring-3 Ptr. */
82typedef R3PTRTYPE(struct VM *) PVMR3;
83/** Pointer to a VM - RC Ptr. */
84typedef RCPTRTYPE(struct VM *) PVMRC;
85
86/** Pointer to a virtual CPU structure. */
87typedef struct VMCPU * PVMCPU;
88/** Pointer to a virtual CPU structure - Ring-3 Ptr. */
89typedef R3PTRTYPE(struct VMCPU *) PVMCPUR3;
90/** Pointer to a virtual CPU structure - Ring-0 Ptr. */
91typedef R0PTRTYPE(struct VMCPU *) PVMCPUR0;
92/** Pointer to a virtual CPU structure - RC Ptr. */
93typedef RCPTRTYPE(struct VMCPU *) PVMCPURC;
94
95/** Pointer to a ring-0 (global) VM structure. */
96typedef R0PTRTYPE(struct GVM *) PGVM;
97
98/** Pointer to a ring-3 (user mode) VM structure. */
99typedef R3PTRTYPE(struct UVM *) PUVM;
100
101/** Pointer to a ring-3 (user mode) VMCPU structure. */
102typedef R3PTRTYPE(struct UVMCPU *) PUVMCPU;
103
104/** Virtual CPU ID. */
105typedef uint32_t VMCPUID;
106/** Pointer to a virtual CPU ID. */
107typedef VMCPUID *PVMCPUID;
108/** @name Special CPU ID values.
109 * Most of these are for request scheduling.
110 *
111 * @{ */
112/** All virtual CPUs. */
113#define VMCPUID_ALL UINT32_C(0xfffffff2)
114/** All virtual CPUs, descending order. */
115#define VMCPUID_ALL_REVERSE UINT32_C(0xfffffff3)
116/** Any virtual CPU.
117 * Intended for scheduling a VM request or some other task. */
118#define VMCPUID_ANY UINT32_C(0xfffffff4)
119/** Any virtual CPU; always queue for future execution.
120 * Intended for scheduling a VM request or some other task. */
121#define VMCPUID_ANY_QUEUE UINT32_C(0xfffffff5)
122/** The NIL value. */
123#define NIL_VMCPUID UINT32_C(0xfffffffd)
124/** @} */
125
126/**
127 * Virtual CPU set.
128 */
129typedef struct VMCPUSET
130{
131 /** The bitmap data. */
132 uint32_t au32Bitmap[8 /*256/32*/];
133} VMCPUSET;
134/** Pointer to a Virtual CPU set. */
135typedef VMCPUSET *PVMCPUSET;
136/** Pointer to a const Virtual CPU set. */
137typedef VMCPUSET const *PCVMCPUSET;
138
139
140/**
141 * VM State
142 */
143typedef enum VMSTATE
144{
145 /** The VM is being created. */
146 VMSTATE_CREATING = 0,
147 /** The VM is created. */
148 VMSTATE_CREATED,
149 /** The VM state is being loaded from file. */
150 VMSTATE_LOADING,
151 /** The VM is being powered on */
152 VMSTATE_POWERING_ON,
153 /** The VM is being resumed. */
154 VMSTATE_RESUMING,
155 /** The VM is runnning. */
156 VMSTATE_RUNNING,
157 /** Live save: The VM is running and the state is being saved. */
158 VMSTATE_RUNNING_LS,
159 /** Fault Tolerance: The VM is running and the state is being synced. */
160 VMSTATE_RUNNING_FT,
161 /** The VM is being reset. */
162 VMSTATE_RESETTING,
163 /** Live save: The VM is being reset and immediately suspended. */
164 VMSTATE_RESETTING_LS,
165 /** The VM is being soft/warm reset. */
166 VMSTATE_SOFT_RESETTING,
167 /** Live save: The VM is being soft/warm reset (not suspended afterwards). */
168 VMSTATE_SOFT_RESETTING_LS,
169 /** The VM is being suspended. */
170 VMSTATE_SUSPENDING,
171 /** Live save: The VM is being suspended during a live save operation, either as
172 * part of the normal flow or VMR3Reset. */
173 VMSTATE_SUSPENDING_LS,
174 /** Live save: The VM is being suspended by VMR3Suspend during live save. */
175 VMSTATE_SUSPENDING_EXT_LS,
176 /** The VM is suspended. */
177 VMSTATE_SUSPENDED,
178 /** Live save: The VM has been suspended and is waiting for the live save
179 * operation to move on. */
180 VMSTATE_SUSPENDED_LS,
181 /** Live save: The VM has been suspended by VMR3Suspend during a live save. */
182 VMSTATE_SUSPENDED_EXT_LS,
183 /** The VM is suspended and its state is being saved by EMT(0). (See SSM) */
184 VMSTATE_SAVING,
185 /** The VM is being debugged. (See DBGF.) */
186 VMSTATE_DEBUGGING,
187 /** Live save: The VM is being debugged while the live phase is going on. */
188 VMSTATE_DEBUGGING_LS,
189 /** The VM is being powered off. */
190 VMSTATE_POWERING_OFF,
191 /** Live save: The VM is being powered off and the save cancelled. */
192 VMSTATE_POWERING_OFF_LS,
193 /** The VM is switched off, awaiting destruction. */
194 VMSTATE_OFF,
195 /** Live save: Waiting for cancellation and transition to VMSTATE_OFF. */
196 VMSTATE_OFF_LS,
197 /** The VM is powered off because of a fatal error. */
198 VMSTATE_FATAL_ERROR,
199 /** Live save: Waiting for cancellation and transition to FatalError. */
200 VMSTATE_FATAL_ERROR_LS,
201 /** The VM is in guru meditation over a fatal failure. */
202 VMSTATE_GURU_MEDITATION,
203 /** Live save: Waiting for cancellation and transition to GuruMeditation. */
204 VMSTATE_GURU_MEDITATION_LS,
205 /** The VM is screwed because of a failed state loading. */
206 VMSTATE_LOAD_FAILURE,
207 /** The VM is being destroyed. */
208 VMSTATE_DESTROYING,
209 /** Terminated. */
210 VMSTATE_TERMINATED,
211 /** hack forcing the size of the enum to 32-bits. */
212 VMSTATE_MAKE_32BIT_HACK = 0x7fffffff
213} VMSTATE;
214
215/** @def VBOXSTRICTRC_STRICT_ENABLED
216 * Indicates that VBOXSTRICTRC is in strict mode.
217 */
218#if defined(__cplusplus) \
219 && ARCH_BITS == 64 /* cdecl requires classes and structs as hidden params. */ \
220 && !defined(_MSC_VER) /* trouble similar to 32-bit gcc. */ \
221 && ( defined(RT_STRICT) \
222 || defined(VBOX_STRICT) \
223 || defined(DEBUG) \
224 || defined(DOXYGEN_RUNNING) )
225# define VBOXSTRICTRC_STRICT_ENABLED 1
226#endif
227
228/** We need RTERR_STRICT_RC. */
229#if defined(VBOXSTRICTRC_STRICT_ENABLED) && !defined(RTERR_STRICT_RC)
230# define RTERR_STRICT_RC 1
231#endif
232
233/**
234 * Strict VirtualBox status code.
235 *
236 * This is normally an 32-bit integer and the only purpose of the type is to
237 * highlight the special handling that is required. But in strict build it is a
238 * class that causes compilation and runtime errors for some of the incorrect
239 * handling.
240 */
241#ifdef VBOXSTRICTRC_STRICT_ENABLED
242struct VBOXSTRICTRC
243{
244protected:
245 /** The status code. */
246 int32_t m_rc;
247
248public:
249 /** Default constructor setting the status to VERR_IPE_UNINITIALIZED_STATUS. */
250 VBOXSTRICTRC()
251#ifdef VERR_IPE_UNINITIALIZED_STATUS
252 : m_rc(VERR_IPE_UNINITIALIZED_STATUS)
253#else
254 : m_rc(-233 /*VERR_IPE_UNINITIALIZED_STATUS*/)
255#endif
256 {
257 }
258
259 /** Constructor for normal integer status codes. */
260 VBOXSTRICTRC(int32_t const rc)
261 : m_rc(rc)
262 {
263 }
264
265 /** Getter that VBOXSTRICTRC_VAL can use. */
266 int32_t getValue() const { return m_rc; }
267
268 /** @name Comparison operators
269 * @{ */
270 bool operator==(int32_t rc) const { return m_rc == rc; }
271 bool operator!=(int32_t rc) const { return m_rc != rc; }
272 bool operator<=(int32_t rc) const { return m_rc <= rc; }
273 bool operator>=(int32_t rc) const { return m_rc >= rc; }
274 bool operator<(int32_t rc) const { return m_rc < rc; }
275 bool operator>(int32_t rc) const { return m_rc > rc; }
276
277 bool operator==(const VBOXSTRICTRC &rRc) const { return m_rc == rRc.m_rc; }
278 bool operator!=(const VBOXSTRICTRC &rRc) const { return m_rc != rRc.m_rc; }
279 bool operator<=(const VBOXSTRICTRC &rRc) const { return m_rc <= rRc.m_rc; }
280 bool operator>=(const VBOXSTRICTRC &rRc) const { return m_rc >= rRc.m_rc; }
281 bool operator<(const VBOXSTRICTRC &rRc) const { return m_rc < rRc.m_rc; }
282 bool operator>(const VBOXSTRICTRC &rRc) const { return m_rc > rRc.m_rc; }
283 /** @} */
284
285 /** Special automatic cast for RT_SUCCESS_NP. */
286 operator RTErrStrictType2() const { return RTErrStrictType2(m_rc); }
287
288private:
289 /** @name Constructors that will prevent some of the bad types.
290 * @{ */
291 VBOXSTRICTRC(uint8_t rc) : m_rc(-999) { NOREF(rc); }
292 VBOXSTRICTRC(uint16_t rc) : m_rc(-999) { NOREF(rc); }
293 VBOXSTRICTRC(uint32_t rc) : m_rc(-999) { NOREF(rc); }
294 VBOXSTRICTRC(uint64_t rc) : m_rc(-999) { NOREF(rc); }
295
296 VBOXSTRICTRC(int8_t rc) : m_rc(-999) { NOREF(rc); }
297 VBOXSTRICTRC(int16_t rc) : m_rc(-999) { NOREF(rc); }
298 VBOXSTRICTRC(int64_t rc) : m_rc(-999) { NOREF(rc); }
299 /** @} */
300};
301# ifdef _MSC_VER
302# pragma warning(disable:4190)
303# endif
304#else
305typedef int32_t VBOXSTRICTRC;
306#endif
307
308/** @def VBOXSTRICTRC_VAL
309 * Explicit getter.
310 * @param rcStrict The strict VirtualBox status code.
311 */
312#ifdef VBOXSTRICTRC_STRICT_ENABLED
313# define VBOXSTRICTRC_VAL(rcStrict) ( (rcStrict).getValue() )
314#else
315# define VBOXSTRICTRC_VAL(rcStrict) (rcStrict)
316#endif
317
318/** @def VBOXSTRICTRC_TODO
319 * Returns that needs dealing with.
320 * @param rcStrict The strict VirtualBox status code.
321 */
322#define VBOXSTRICTRC_TODO(rcStrict) VBOXSTRICTRC_VAL(rcStrict)
323
324
325/** Pointer to a PDM Base Interface. */
326typedef struct PDMIBASE *PPDMIBASE;
327/** Pointer to a pointer to a PDM Base Interface. */
328typedef PPDMIBASE *PPPDMIBASE;
329
330/** Pointer to a PDM Device Instance. */
331typedef struct PDMDEVINS *PPDMDEVINS;
332/** Pointer to a pointer to a PDM Device Instance. */
333typedef PPDMDEVINS *PPPDMDEVINS;
334/** R3 pointer to a PDM Device Instance. */
335typedef R3PTRTYPE(PPDMDEVINS) PPDMDEVINSR3;
336/** R0 pointer to a PDM Device Instance. */
337typedef R0PTRTYPE(PPDMDEVINS) PPDMDEVINSR0;
338/** RC pointer to a PDM Device Instance. */
339typedef RCPTRTYPE(PPDMDEVINS) PPDMDEVINSRC;
340
341/** Pointer to a PDM USB Device Instance. */
342typedef struct PDMUSBINS *PPDMUSBINS;
343/** Pointer to a pointer to a PDM USB Device Instance. */
344typedef PPDMUSBINS *PPPDMUSBINS;
345
346/** Pointer to a PDM Driver Instance. */
347typedef struct PDMDRVINS *PPDMDRVINS;
348/** Pointer to a pointer to a PDM Driver Instance. */
349typedef PPDMDRVINS *PPPDMDRVINS;
350/** R3 pointer to a PDM Driver Instance. */
351typedef R3PTRTYPE(PPDMDRVINS) PPDMDRVINSR3;
352/** R0 pointer to a PDM Driver Instance. */
353typedef R0PTRTYPE(PPDMDRVINS) PPDMDRVINSR0;
354/** RC pointer to a PDM Driver Instance. */
355typedef RCPTRTYPE(PPDMDRVINS) PPDMDRVINSRC;
356
357/** Pointer to a PDM Service Instance. */
358typedef struct PDMSRVINS *PPDMSRVINS;
359/** Pointer to a pointer to a PDM Service Instance. */
360typedef PPDMSRVINS *PPPDMSRVINS;
361
362/** Pointer to a PDM critical section. */
363typedef union PDMCRITSECT *PPDMCRITSECT;
364/** Pointer to a const PDM critical section. */
365typedef const union PDMCRITSECT *PCPDMCRITSECT;
366
367/** Pointer to a PDM read/write critical section. */
368typedef union PDMCRITSECTRW *PPDMCRITSECTRW;
369/** Pointer to a const PDM read/write critical section. */
370typedef union PDMCRITSECTRW const *PCPDMCRITSECTRW;
371
372/** R3 pointer to a timer. */
373typedef R3PTRTYPE(struct TMTIMER *) PTMTIMERR3;
374/** Pointer to a R3 pointer to a timer. */
375typedef PTMTIMERR3 *PPTMTIMERR3;
376
377/** R0 pointer to a timer. */
378typedef R0PTRTYPE(struct TMTIMER *) PTMTIMERR0;
379/** Pointer to a R3 pointer to a timer. */
380typedef PTMTIMERR0 *PPTMTIMERR0;
381
382/** RC pointer to a timer. */
383typedef RCPTRTYPE(struct TMTIMER *) PTMTIMERRC;
384/** Pointer to a RC pointer to a timer. */
385typedef PTMTIMERRC *PPTMTIMERRC;
386
387/** Pointer to a timer. */
388typedef CTX_SUFF(PTMTIMER) PTMTIMER;
389/** Pointer to a pointer to a timer. */
390typedef PTMTIMER *PPTMTIMER;
391
392/** SSM Operation handle. */
393typedef struct SSMHANDLE *PSSMHANDLE;
394/** Pointer to a const SSM stream method table. */
395typedef struct SSMSTRMOPS const *PCSSMSTRMOPS;
396
397/** Pointer to a CPUMCTX. */
398typedef struct CPUMCTX *PCPUMCTX;
399/** Pointer to a const CPUMCTX. */
400typedef const struct CPUMCTX *PCCPUMCTX;
401
402/** Pointer to a CPU context core. */
403typedef struct CPUMCTXCORE *PCPUMCTXCORE;
404/** Pointer to a const CPU context core. */
405typedef const struct CPUMCTXCORE *PCCPUMCTXCORE;
406
407/** Pointer to a selector register. */
408typedef struct CPUMSELREG *PCPUMSELREG;
409/** Pointer to a const selector register. */
410typedef const struct CPUMSELREG *PCCPUMSELREG;
411
412/** Pointer to selector hidden registers.
413 * @deprecated Replaced by PCPUMSELREG */
414typedef struct CPUMSELREG *PCPUMSELREGHID;
415/** Pointer to const selector hidden registers.
416 * @deprecated Replaced by PCCPUMSELREG */
417typedef const struct CPUMSELREG *PCCPUMSELREGHID;
418
419/** @} */
420
421
422/** @defgroup grp_types_idt Interrupt Descriptor Table Entry.
423 * @todo This all belongs in x86.h!
424 * @{ */
425
426/** @todo VBOXIDT -> VBOXDESCIDT, skip the complex variations. We'll never use them. */
427
428/** IDT Entry, Task Gate view. */
429#pragma pack(1) /* paranoia */
430typedef struct VBOXIDTE_TASKGATE
431{
432 /** Reserved. */
433 unsigned u16Reserved1 : 16;
434 /** Task Segment Selector. */
435 unsigned u16TSS : 16;
436 /** More reserved. */
437 unsigned u8Reserved2 : 8;
438 /** Fixed value bit 0 - Set to 1. */
439 unsigned u1Fixed0 : 1;
440 /** Busy bit. */
441 unsigned u1Busy : 1;
442 /** Fixed value bit 2 - Set to 1. */
443 unsigned u1Fixed1 : 1;
444 /** Fixed value bit 3 - Set to 0. */
445 unsigned u1Fixed2 : 1;
446 /** Fixed value bit 4 - Set to 0. */
447 unsigned u1Fixed3 : 1;
448 /** Descriptor Privilege level. */
449 unsigned u2DPL : 2;
450 /** Present flag. */
451 unsigned u1Present : 1;
452 /** Reserved. */
453 unsigned u16Reserved3 : 16;
454} VBOXIDTE_TASKGATE;
455#pragma pack()
456/** Pointer to IDT Entry, Task gate view. */
457typedef VBOXIDTE_TASKGATE *PVBOXIDTE_TASKGATE;
458
459
460/** IDT Entry, Intertupt gate view. */
461#pragma pack(1) /* paranoia */
462typedef struct VBOXIDTE_INTERRUPTGATE
463{
464 /** Low offset word. */
465 unsigned u16OffsetLow : 16;
466 /** Segment Selector. */
467 unsigned u16SegSel : 16;
468 /** Reserved. */
469 unsigned u5Reserved2 : 5;
470 /** Fixed value bit 0 - Set to 0. */
471 unsigned u1Fixed0 : 1;
472 /** Fixed value bit 1 - Set to 0. */
473 unsigned u1Fixed1 : 1;
474 /** Fixed value bit 2 - Set to 0. */
475 unsigned u1Fixed2 : 1;
476 /** Fixed value bit 3 - Set to 0. */
477 unsigned u1Fixed3 : 1;
478 /** Fixed value bit 4 - Set to 1. */
479 unsigned u1Fixed4 : 1;
480 /** Fixed value bit 5 - Set to 1. */
481 unsigned u1Fixed5 : 1;
482 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
483 unsigned u132BitGate : 1;
484 /** Fixed value bit 5 - Set to 0. */
485 unsigned u1Fixed6 : 1;
486 /** Descriptor Privilege level. */
487 unsigned u2DPL : 2;
488 /** Present flag. */
489 unsigned u1Present : 1;
490 /** High offset word. */
491 unsigned u16OffsetHigh : 16;
492} VBOXIDTE_INTERRUPTGATE;
493#pragma pack()
494/** Pointer to IDT Entry, Interrupt gate view. */
495typedef VBOXIDTE_INTERRUPTGATE *PVBOXIDTE_INTERRUPTGATE;
496
497/** IDT Entry, Trap Gate view. */
498#pragma pack(1) /* paranoia */
499typedef struct VBOXIDTE_TRAPGATE
500{
501 /** Low offset word. */
502 unsigned u16OffsetLow : 16;
503 /** Segment Selector. */
504 unsigned u16SegSel : 16;
505 /** Reserved. */
506 unsigned u5Reserved2 : 5;
507 /** Fixed value bit 0 - Set to 0. */
508 unsigned u1Fixed0 : 1;
509 /** Fixed value bit 1 - Set to 0. */
510 unsigned u1Fixed1 : 1;
511 /** Fixed value bit 2 - Set to 0. */
512 unsigned u1Fixed2 : 1;
513 /** Fixed value bit 3 - Set to 1. */
514 unsigned u1Fixed3 : 1;
515 /** Fixed value bit 4 - Set to 1. */
516 unsigned u1Fixed4 : 1;
517 /** Fixed value bit 5 - Set to 1. */
518 unsigned u1Fixed5 : 1;
519 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
520 unsigned u132BitGate : 1;
521 /** Fixed value bit 5 - Set to 0. */
522 unsigned u1Fixed6 : 1;
523 /** Descriptor Privilege level. */
524 unsigned u2DPL : 2;
525 /** Present flag. */
526 unsigned u1Present : 1;
527 /** High offset word. */
528 unsigned u16OffsetHigh : 16;
529} VBOXIDTE_TRAPGATE;
530#pragma pack()
531/** Pointer to IDT Entry, Trap Gate view. */
532typedef VBOXIDTE_TRAPGATE *PVBOXIDTE_TRAPGATE;
533
534/** IDT Entry Generic view. */
535#pragma pack(1) /* paranoia */
536typedef struct VBOXIDTE_GENERIC
537{
538 /** Low offset word. */
539 unsigned u16OffsetLow : 16;
540 /** Segment Selector. */
541 unsigned u16SegSel : 16;
542 /** Reserved. */
543 unsigned u5Reserved : 5;
544 /** IDT Type part one (not used for task gate). */
545 unsigned u3Type1 : 3;
546 /** IDT Type part two. */
547 unsigned u5Type2 : 5;
548 /** Descriptor Privilege level. */
549 unsigned u2DPL : 2;
550 /** Present flag. */
551 unsigned u1Present : 1;
552 /** High offset word. */
553 unsigned u16OffsetHigh : 16;
554} VBOXIDTE_GENERIC;
555#pragma pack()
556/** Pointer to IDT Entry Generic view. */
557typedef VBOXIDTE_GENERIC *PVBOXIDTE_GENERIC;
558
559/** IDT Type1 value. (Reserved for task gate!) */
560#define VBOX_IDTE_TYPE1 0
561/** IDT Type2 value - Task gate. */
562#define VBOX_IDTE_TYPE2_TASK 0x5
563/** IDT Type2 value - 16 bit interrupt gate. */
564#define VBOX_IDTE_TYPE2_INT_16 0x6
565/** IDT Type2 value - 32 bit interrupt gate. */
566#define VBOX_IDTE_TYPE2_INT_32 0xe
567/** IDT Type2 value - 16 bit trap gate. */
568#define VBOX_IDTE_TYPE2_TRAP_16 0x7
569/** IDT Type2 value - 32 bit trap gate. */
570#define VBOX_IDTE_TYPE2_TRAP_32 0xf
571
572/** IDT Entry. */
573#pragma pack(1) /* paranoia */
574typedef union VBOXIDTE
575{
576 /** Task gate view. */
577 VBOXIDTE_TASKGATE Task;
578 /** Trap gate view. */
579 VBOXIDTE_TRAPGATE Trap;
580 /** Interrupt gate view. */
581 VBOXIDTE_INTERRUPTGATE Int;
582 /** Generic IDT view. */
583 VBOXIDTE_GENERIC Gen;
584
585 /** 8 bit unsigned integer view. */
586 uint8_t au8[8];
587 /** 16 bit unsigned integer view. */
588 uint16_t au16[4];
589 /** 32 bit unsigned integer view. */
590 uint32_t au32[2];
591 /** 64 bit unsigned integer view. */
592 uint64_t au64;
593} VBOXIDTE;
594#pragma pack()
595/** Pointer to IDT Entry. */
596typedef VBOXIDTE *PVBOXIDTE;
597/** Pointer to IDT Entry. */
598typedef VBOXIDTE const *PCVBOXIDTE;
599
600/** IDT Entry, 64-bit mode, Intertupt gate view. */
601#pragma pack(1) /* paranoia */
602typedef struct VBOXIDTE64_INTERRUPTGATE
603{
604 /** Low offset word. */
605 unsigned u16OffsetLow : 16;
606 /** Segment Selector. */
607 unsigned u16SegSel : 16;
608 /** Interrupt Stack Table Index. */
609 unsigned u3Ist : 3;
610 /** Fixed value bit 0 - Set to 0. */
611 unsigned u1Fixed0 : 1;
612 /** Fixed value bit 1 - Set to 0. */
613 unsigned u1Fixed1 : 1;
614 /** Fixed value bit 2 - Set to 0. */
615 unsigned u1Fixed2 : 1;
616 /** Fixed value bit 3 - Set to 0. */
617 unsigned u1Fixed3 : 1;
618 /** Fixed value bit 4 - Set to 0. */
619 unsigned u1Fixed4 : 1;
620 /** Fixed value bit 5 - Set to 0. */
621 unsigned u1Fixed5 : 1;
622 /** Fixed value bit 6 - Set to 1. */
623 unsigned u1Fixed6 : 1;
624 /** Fixed value bit 7 - Set to 1. */
625 unsigned u1Fixed7 : 1;
626 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
627 unsigned u132BitGate : 1;
628 /** Fixed value bit 5 - Set to 0. */
629 unsigned u1Fixed8 : 1;
630 /** Descriptor Privilege level. */
631 unsigned u2DPL : 2;
632 /** Present flag. */
633 unsigned u1Present : 1;
634 /** High offset word. */
635 unsigned u16OffsetHigh : 16;
636 /** Offset bits 32..63. */
637 unsigned u32OffsetHigh64;
638 /** Reserved. */
639 unsigned u32Reserved;
640} VBOXIDTE64_INTERRUPTGATE;
641#pragma pack()
642/** Pointer to IDT Entry, 64-bit mode, Interrupt gate view. */
643typedef VBOXIDTE64_INTERRUPTGATE *PVBOXIDTE64_INTERRUPTGATE;
644
645/** IDT Entry, 64-bit mode, Trap gate view. */
646#pragma pack(1) /* paranoia */
647typedef struct VBOXIDTE64_TRAPGATE
648{
649 /** Low offset word. */
650 unsigned u16OffsetLow : 16;
651 /** Segment Selector. */
652 unsigned u16SegSel : 16;
653 /** Interrupt Stack Table Index. */
654 unsigned u3Ist : 3;
655 /** Fixed value bit 0 - Set to 0. */
656 unsigned u1Fixed0 : 1;
657 /** Fixed value bit 1 - Set to 0. */
658 unsigned u1Fixed1 : 1;
659 /** Fixed value bit 2 - Set to 0. */
660 unsigned u1Fixed2 : 1;
661 /** Fixed value bit 3 - Set to 0. */
662 unsigned u1Fixed3 : 1;
663 /** Fixed value bit 4 - Set to 0. */
664 unsigned u1Fixed4 : 1;
665 /** Fixed value bit 5 - Set to 1. */
666 unsigned u1Fixed5 : 1;
667 /** Fixed value bit 6 - Set to 1. */
668 unsigned u1Fixed6 : 1;
669 /** Fixed value bit 7 - Set to 1. */
670 unsigned u1Fixed7 : 1;
671 /** Gate size, 1 = 32 bits, 0 = 16 bits. */
672 unsigned u132BitGate : 1;
673 /** Fixed value bit 5 - Set to 0. */
674 unsigned u1Fixed8 : 1;
675 /** Descriptor Privilege level. */
676 unsigned u2DPL : 2;
677 /** Present flag. */
678 unsigned u1Present : 1;
679 /** High offset word. */
680 unsigned u16OffsetHigh : 16;
681 /** Offset bits 32..63. */
682 unsigned u32OffsetHigh64;
683 /** Reserved. */
684 unsigned u32Reserved;
685} VBOXIDTE64_TRAPGATE;
686#pragma pack()
687/** Pointer to IDT Entry, 64-bit mode, Trap gate view. */
688typedef VBOXIDTE64_TRAPGATE *PVBOXIDTE64_TRAPGATE;
689
690/** IDT Entry, 64-bit mode, Generic view. */
691#pragma pack(1) /* paranoia */
692typedef struct VBOXIDTE64_GENERIC
693{
694 /** Low offset word. */
695 unsigned u16OffsetLow : 16;
696 /** Segment Selector. */
697 unsigned u16SegSel : 16;
698 /** Reserved. */
699 unsigned u3Ist : 3;
700 /** Fixed value bit 0 - Set to 0. */
701 unsigned u1Fixed0 : 1;
702 /** Fixed value bit 1 - Set to 0. */
703 unsigned u1Fixed1 : 1;
704 /** IDT Type part one (not used for task gate). */
705 unsigned u3Type1 : 3;
706 /** IDT Type part two. */
707 unsigned u5Type2 : 5;
708 /** Descriptor Privilege level. */
709 unsigned u2DPL : 2;
710 /** Present flag. */
711 unsigned u1Present : 1;
712 /** High offset word. */
713 unsigned u16OffsetHigh : 16;
714 /** Offset bits 32..63. */
715 unsigned u32OffsetHigh64;
716 /** Reserved. */
717 unsigned u32Reserved;
718} VBOXIDTE64_GENERIC;
719#pragma pack()
720/** Pointer to IDT Entry, 64-bit mode, Generic view. */
721typedef VBOXIDTE64_GENERIC *PVBOXIDTE64_GENERIC;
722
723/** IDT Entry, 64-bit mode. */
724#pragma pack(1) /* paranoia */
725typedef union VBOXIDTE64
726{
727 /** Trap gate view. */
728 VBOXIDTE64_TRAPGATE Trap;
729 /** Interrupt gate view. */
730 VBOXIDTE64_INTERRUPTGATE Int;
731 /** Generic IDT view. */
732 VBOXIDTE64_GENERIC Gen;
733
734 /** 8 bit unsigned integer view. */
735 uint8_t au8[16];
736 /** 16 bit unsigned integer view. */
737 uint16_t au16[8];
738 /** 32 bit unsigned integer view. */
739 uint32_t au32[4];
740 /** 64 bit unsigned integer view. */
741 uint64_t au64[2];
742} VBOXIDTE64;
743#pragma pack()
744/** Pointer to IDT Entry. */
745typedef VBOXIDTE64 *PVBOXIDTE64;
746/** Pointer to IDT Entry. */
747typedef VBOXIDTE64 const *PCVBOXIDTE64;
748
749#pragma pack(1)
750/** IDTR */
751typedef struct VBOXIDTR
752{
753 /** Size of the IDT. */
754 uint16_t cbIdt;
755 /** Address of the IDT. */
756 uint64_t pIdt;
757} VBOXIDTR, *PVBOXIDTR;
758#pragma pack()
759
760/** @} */
761
762
763/** @def VBOXIDTE_OFFSET
764 * Return the offset of an IDT entry.
765 */
766#define VBOXIDTE_OFFSET(desc) \
767 ( ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
768 | ( (desc).Gen.u16OffsetLow ) )
769
770/** @def VBOXIDTE64_OFFSET
771 * Return the offset of an IDT entry.
772 */
773#define VBOXIDTE64_OFFSET(desc) \
774 ( ((uint64_t)((desc).Gen.u32OffsetHigh64) << 32) \
775 | ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
776 | ( (desc).Gen.u16OffsetLow ) )
777
778#pragma pack(1)
779/** GDTR */
780typedef struct VBOXGDTR
781{
782 /** Size of the GDT. */
783 uint16_t cbGdt;
784 /** Address of the GDT. */
785 uint64_t pGdt;
786} VBOXGDTR;
787#pragma pack()
788/** Pointer to GDTR. */
789typedef VBOXGDTR *PVBOXGDTR;
790
791/** @} */
792
793
794/**
795 * 32-bit Task Segment used in raw mode.
796 * @todo Move this to SELM! Use X86TSS32 instead.
797 */
798#pragma pack(1)
799typedef struct VBOXTSS
800{
801 /** 0x00 - Back link to previous task. (static) */
802 RTSEL selPrev;
803 uint16_t padding1;
804 /** 0x04 - Ring-0 stack pointer. (static) */
805 uint32_t esp0;
806 /** 0x08 - Ring-0 stack segment. (static) */
807 RTSEL ss0;
808 uint16_t padding_ss0;
809 /** 0x0c - Ring-1 stack pointer. (static) */
810 uint32_t esp1;
811 /** 0x10 - Ring-1 stack segment. (static) */
812 RTSEL ss1;
813 uint16_t padding_ss1;
814 /** 0x14 - Ring-2 stack pointer. (static) */
815 uint32_t esp2;
816 /** 0x18 - Ring-2 stack segment. (static) */
817 RTSEL ss2;
818 uint16_t padding_ss2;
819 /** 0x1c - Page directory for the task. (static) */
820 uint32_t cr3;
821 /** 0x20 - EIP before task switch. */
822 uint32_t eip;
823 /** 0x24 - EFLAGS before task switch. */
824 uint32_t eflags;
825 /** 0x28 - EAX before task switch. */
826 uint32_t eax;
827 /** 0x2c - ECX before task switch. */
828 uint32_t ecx;
829 /** 0x30 - EDX before task switch. */
830 uint32_t edx;
831 /** 0x34 - EBX before task switch. */
832 uint32_t ebx;
833 /** 0x38 - ESP before task switch. */
834 uint32_t esp;
835 /** 0x3c - EBP before task switch. */
836 uint32_t ebp;
837 /** 0x40 - ESI before task switch. */
838 uint32_t esi;
839 /** 0x44 - EDI before task switch. */
840 uint32_t edi;
841 /** 0x48 - ES before task switch. */
842 RTSEL es;
843 uint16_t padding_es;
844 /** 0x4c - CS before task switch. */
845 RTSEL cs;
846 uint16_t padding_cs;
847 /** 0x50 - SS before task switch. */
848 RTSEL ss;
849 uint16_t padding_ss;
850 /** 0x54 - DS before task switch. */
851 RTSEL ds;
852 uint16_t padding_ds;
853 /** 0x58 - FS before task switch. */
854 RTSEL fs;
855 uint16_t padding_fs;
856 /** 0x5c - GS before task switch. */
857 RTSEL gs;
858 uint16_t padding_gs;
859 /** 0x60 - LDTR before task switch. */
860 RTSEL selLdt;
861 uint16_t padding_ldt;
862 /** 0x64 - Debug trap flag */
863 uint16_t fDebugTrap;
864 /** 0x66 - Offset relative to the TSS of the start of the I/O Bitmap
865 * and the end of the interrupt redirection bitmap. */
866 uint16_t offIoBitmap;
867 /** 0x68 - 32 bytes for the virtual interrupt redirection bitmap. (VME) */
868 uint8_t IntRedirBitmap[32];
869} VBOXTSS;
870#pragma pack()
871/** Pointer to task segment. */
872typedef VBOXTSS *PVBOXTSS;
873/** Pointer to const task segment. */
874typedef const VBOXTSS *PCVBOXTSS;
875
876
877/** Pointer to a callback method table provided by the VM API user. */
878typedef struct VMM2USERMETHODS const *PCVMM2USERMETHODS;
879
880
881/**
882 * Data transport buffer (scatter/gather)
883 */
884typedef struct PDMDATASEG
885{
886 /** Length of buffer in entry. */
887 size_t cbSeg;
888 /** Pointer to the start of the buffer. */
889 void *pvSeg;
890} PDMDATASEG;
891/** Pointer to a data transport segment. */
892typedef PDMDATASEG *PPDMDATASEG;
893/** Pointer to a const data transport segment. */
894typedef PDMDATASEG const *PCPDMDATASEG;
895
896
897/**
898 * Forms of generic segment offloading.
899 */
900typedef enum PDMNETWORKGSOTYPE
901{
902 /** Invalid zero value. */
903 PDMNETWORKGSOTYPE_INVALID = 0,
904 /** TCP/IPv4 - no CWR/ECE encoding. */
905 PDMNETWORKGSOTYPE_IPV4_TCP,
906 /** TCP/IPv6 - no CWR/ECE encoding. */
907 PDMNETWORKGSOTYPE_IPV6_TCP,
908 /** UDP/IPv4. */
909 PDMNETWORKGSOTYPE_IPV4_UDP,
910 /** UDP/IPv6. */
911 PDMNETWORKGSOTYPE_IPV6_UDP,
912 /** TCP/IPv6 over IPv4 tunneling - no CWR/ECE encoding.
913 * The header offsets and sizes relates to IPv4 and TCP, the IPv6 header is
914 * figured out as needed.
915 * @todo Needs checking against facts, this is just an outline of the idea. */
916 PDMNETWORKGSOTYPE_IPV4_IPV6_TCP,
917 /** UDP/IPv6 over IPv4 tunneling.
918 * The header offsets and sizes relates to IPv4 and UDP, the IPv6 header is
919 * figured out as needed.
920 * @todo Needs checking against facts, this is just an outline of the idea. */
921 PDMNETWORKGSOTYPE_IPV4_IPV6_UDP,
922 /** The end of valid GSO types. */
923 PDMNETWORKGSOTYPE_END
924} PDMNETWORKGSOTYPE;
925
926
927/**
928 * Generic segment offloading context.
929 *
930 * We generally follow the E1000 specs wrt to which header fields we change.
931 * However the GSO type implies where the checksum fields are and that they are
932 * always updated from scratch (no half done pseudo checksums).
933 *
934 * @remarks This is part of the internal network GSO packets. Take great care
935 * when making changes. The size is expected to be exactly 8 bytes.
936 */
937typedef struct PDMNETWORKGSO
938{
939 /** The type of segmentation offloading we're performing (PDMNETWORKGSOTYPE). */
940 uint8_t u8Type;
941 /** The total header size. */
942 uint8_t cbHdrsTotal;
943 /** The max segment size (MSS) to apply. */
944 uint16_t cbMaxSeg;
945
946 /** Offset of the first header (IPv4 / IPv6). 0 if not not needed. */
947 uint8_t offHdr1;
948 /** Offset of the second header (TCP / UDP). 0 if not not needed. */
949 uint8_t offHdr2;
950 /** The header size used for segmentation (equal to offHdr2 in UFO). */
951 uint8_t cbHdrsSeg;
952 /** Unused. */
953 uint8_t u8Unused;
954} PDMNETWORKGSO;
955/** Pointer to a GSO context. */
956typedef PDMNETWORKGSO *PPDMNETWORKGSO;
957/** Pointer to a const GSO context. */
958typedef PDMNETWORKGSO const *PCPDMNETWORKGSO;
959
960
961/**
962 * The current ROM page protection.
963 *
964 * @remarks This is part of the saved state.
965 */
966typedef enum PGMROMPROT
967{
968 /** The customary invalid value. */
969 PGMROMPROT_INVALID = 0,
970 /** Read from the virgin ROM page, ignore writes.
971 * Map the virgin page, use write access handler to ignore writes. */
972 PGMROMPROT_READ_ROM_WRITE_IGNORE,
973 /** Read from the virgin ROM page, write to the shadow RAM.
974 * Map the virgin page, use write access handler to change the shadow RAM. */
975 PGMROMPROT_READ_ROM_WRITE_RAM,
976 /** Read from the shadow ROM page, ignore writes.
977 * Map the shadow page read-only, use write access handler to ignore writes. */
978 PGMROMPROT_READ_RAM_WRITE_IGNORE,
979 /** Read from the shadow ROM page, ignore writes.
980 * Map the shadow page read-write, disabled write access handler. */
981 PGMROMPROT_READ_RAM_WRITE_RAM,
982 /** The end of valid values. */
983 PGMROMPROT_END,
984 /** The usual 32-bit type size hack. */
985 PGMROMPROT_32BIT_HACK = 0x7fffffff
986} PGMROMPROT;
987
988
989/**
990 * Page mapping lock.
991 */
992typedef struct PGMPAGEMAPLOCK
993{
994#if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
995 /** The locked page. */
996 void *pvPage;
997 /** Pointer to the CPU that made the mapping.
998 * In ring-0 and raw-mode context we don't intend to ever allow long term
999 * locking and this is a way of making sure we're still on the same CPU. */
1000 PVMCPU pVCpu;
1001#else
1002 /** Pointer to the PGMPAGE and lock type.
1003 * bit-0 abuse: set=write, clear=read. */
1004 uintptr_t uPageAndType;
1005/** Read lock type value. */
1006# define PGMPAGEMAPLOCK_TYPE_READ ((uintptr_t)0)
1007/** Write lock type value. */
1008# define PGMPAGEMAPLOCK_TYPE_WRITE ((uintptr_t)1)
1009/** Lock type mask. */
1010# define PGMPAGEMAPLOCK_TYPE_MASK ((uintptr_t)1)
1011 /** Pointer to the PGMCHUNKR3MAP. */
1012 void *pvMap;
1013#endif
1014} PGMPAGEMAPLOCK;
1015/** Pointer to a page mapping lock. */
1016typedef PGMPAGEMAPLOCK *PPGMPAGEMAPLOCK;
1017
1018
1019/** Pointer to a info helper callback structure. */
1020typedef struct DBGFINFOHLP *PDBGFINFOHLP;
1021/** Pointer to a const info helper callback structure. */
1022typedef const struct DBGFINFOHLP *PCDBGFINFOHLP;
1023
1024/** Pointer to a const register descriptor. */
1025typedef struct DBGFREGDESC const *PCDBGFREGDESC;
1026
1027
1028/** Configuration manager tree node - A key. */
1029typedef struct CFGMNODE *PCFGMNODE;
1030
1031/** Configuration manager tree leaf - A value. */
1032typedef struct CFGMLEAF *PCFGMLEAF;
1033
1034
1035/**
1036 * CPU modes.
1037 */
1038typedef enum CPUMMODE
1039{
1040 /** The usual invalid zero entry. */
1041 CPUMMODE_INVALID = 0,
1042 /** Real mode. */
1043 CPUMMODE_REAL,
1044 /** Protected mode (32-bit). */
1045 CPUMMODE_PROTECTED,
1046 /** Long mode (64-bit). */
1047 CPUMMODE_LONG
1048} CPUMMODE;
1049
1050
1051/**
1052 * CPU mode flags (DISSTATE::mode).
1053 */
1054typedef enum DISCPUMODE
1055{
1056 DISCPUMODE_INVALID = 0,
1057 DISCPUMODE_16BIT,
1058 DISCPUMODE_32BIT,
1059 DISCPUMODE_64BIT,
1060 /** hack forcing the size of the enum to 32-bits. */
1061 DISCPUMODE_MAKE_32BIT_HACK = 0x7fffffff
1062} DISCPUMODE;
1063
1064/** Pointer to the disassembler state. */
1065typedef struct DISSTATE *PDISSTATE;
1066/** Pointer to a const disassembler state. */
1067typedef struct DISSTATE const *PCDISSTATE;
1068
1069/** @deprecated PDISSTATE and change pCpu and pDisState to pDis. */
1070typedef PDISSTATE PDISCPUSTATE;
1071/** @deprecated PCDISSTATE and change pCpu and pDisState to pDis. */
1072typedef PCDISSTATE PCDISCPUSTATE;
1073
1074
1075/** @} */
1076
1077#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette