types.h revision 0c34933fc8f84dd5183d1897881bbc7683d24541
/** @file
* VirtualBox - Types.
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef ___VBox_types_h
#define ___VBox_types_h
/** @defgroup grp_types Basic VBox Types
* @{
*/
/** @defgroup grp_types_both Common Guest and Host Context Basic Types
* @ingroup grp_types
* @{
*/
/** @defgroup grp_types_hc Host Context Basic Types
* @ingroup grp_types_both
* @{
*/
/** @deprecated
* @{ */
typedef RTHCPHYS VBOXHCPHYS;
typedef VBOXHCPHYS *PVBOXHCPHYS;
#define NILVBOXHCPHYS NIL_RTHCPHYS
typedef VBOXHCPTR *PVBOXHCPTR;
/** @} */
/** @} */
/** @defgroup grp_types_gc Guest Context Basic Types
* @ingroup grp_types_both
* @{
*/
/** @deprecated
* @{ */
typedef RTGCPHYS VBOXGCPHYS;
typedef VBOXGCPHYS *PVBOXGCPHYS;
#define NILVBOXGCPHYS NIL_RTGCPHYS
typedef VBOXGCPTR *PVBOXGCPTR;
/** @} */
/** @} */
/** Pointer to per support driver session data.
* (The data is a R0 entity and private to the the R0 SUP part. All
* other should consider this a sort of handle.) */
/** Pointer to a VM. */
/** Pointer to a VM - Ring-0 Ptr. */
/** Pointer to a VM - Ring-3 Ptr. */
/** Pointer to a VM - GC Ptr. */
/** VM State
*/
typedef enum VMSTATE
{
/** The VM is being created. */
VMSTATE_CREATING = 0,
/** The VM is created. */
/** The VM is runnning. */
/** The VM state is being loaded from file. */
/** The VM is screwed because of a failed state loading. */
/** The VM state is being saved to file. */
/** The VM is suspended. */
/** The VM is being reset. */
/** The VM is in guru meditation over a fatal failure. */
/** The VM is switched off, awaiting destruction. */
/** The VM is being destroyed. */
/** Terminated. */
/** hack forcing the size of the enum to 32-bits. */
VMSTATE_MAKE_32BIT_HACK = 0x7fffffff
} VMSTATE;
/** Pointer to a PDM Driver Base Interface. */
/** Pointer to a pointer to a PDM Driver Base Interface. */
typedef PPDMIBASE *PPPDMIBASE;
/** Pointer to a PDM Device Instance. */
typedef struct PDMDEVINS *PPDMDEVINS;
/** Pointer to a pointer to a PDM Device Instance. */
typedef PPDMDEVINS *PPPDMDEVINS;
/** R3 pointer to a PDM Device Instance. */
/** R0 pointer to a PDM Device Instance. */
/** GC pointer to a PDM Device Instance. */
/** Pointer to a PDM USB Device Instance. */
typedef struct PDMUSBINS *PPDMUSBINS;
/** Pointer to a pointer to a PDM USB Device Instance. */
typedef PPDMUSBINS *PPPDMUSBINS;
/** Pointer to a PDM Driver Instance. */
typedef struct PDMDRVINS *PPDMDRVINS;
/** Pointer to a pointer to a PDM Driver Instance. */
typedef PPDMDRVINS *PPPDMDRVINS;
/** Pointer to a PDM Service Instance. */
typedef struct PDMSRVINS *PPDMSRVINS;
/** Pointer to a pointer to a PDM Service Instance. */
typedef PPDMSRVINS *PPPDMSRVINS;
/** R3 pointer to a timer. */
/** Pointer to a R3 pointer to a timer. */
typedef PTMTIMERR3 *PPTMTIMERR3;
/** R0 pointer to a timer. */
/** Pointer to a R3 pointer to a timer. */
typedef PTMTIMERR0 *PPTMTIMERR0;
/** GC pointer to a timer. */
/** Pointer to a GC pointer to a timer. */
typedef PTMTIMERGC *PPTMTIMERGC;
/** Pointer to a timer. */
/** Pointer to a pointer to a timer. */
/** SSM Operation handle. */
typedef struct SSMHANDLE *PSSMHANDLE;
/** @} */
/** @defgroup grp_types_idt Interrupt Descriptor Table Entry.
* @ingroup grp_types
* @todo This all belongs in x86.h!
* @{ */
/** @todo VBOXIDT -> VBOXDESCIDT, skip the complex variations. We'll never use them. */
/** IDT Entry, Task Gate view. */
typedef struct VBOXIDTE_TASKGATE
{
/** Reserved. */
unsigned u16Reserved1 : 16;
/** Task Segment Selector. */
unsigned u16TSS : 16;
/** More reserved. */
unsigned u8Reserved2 : 8;
/** Fixed value bit 0 - Set to 1. */
unsigned u1Fixed0 : 1;
/** Busy bit. */
unsigned u1Busy : 1;
/** Fixed value bit 2 - Set to 1. */
unsigned u1Fixed1 : 1;
/** Fixed value bit 3 - Set to 0. */
unsigned u1Fixed2: 1;
/** Fixed value bit 4 - Set to 0. */
unsigned u1Fixed3 : 1;
/** Descriptor Privilege level. */
unsigned u2DPL : 2;
/** Present flag. */
unsigned u1Present : 1;
/** Reserved. */
unsigned u16Reserved3 : 16;
#pragma pack()
/** Pointer to IDT Entry, Task gate view. */
typedef VBOXIDTE_TASKGATE *PVBOXIDTE_TASKGATE;
/** IDT Entry, Intertupt gate view. */
typedef struct VBOXIDTE_INTERRUPTGATE
{
/** Low offset word. */
unsigned u16OffsetLow : 16;
/** Segment Selector. */
unsigned u16SegSel : 16;
/** Reserved. */
unsigned u5Reserved2 : 5;
/** Fixed value bit 0 - Set to 0. */
unsigned u1Fixed0 : 1;
/** Fixed value bit 1 - Set to 0. */
unsigned u1Fixed1 : 1;
/** Fixed value bit 2 - Set to 0. */
unsigned u1Fixed2 : 1;
/** Fixed value bit 3 - Set to 0. */
unsigned u1Fixed3: 1;
/** Fixed value bit 4 - Set to 1. */
unsigned u1Fixed4 : 1;
/** Fixed value bit 5 - Set to 1. */
unsigned u1Fixed5 : 1;
/** Gate size, 1 = 32 bits, 0 = 16 bits. */
unsigned u132BitGate : 1;
/** Fixed value bit 5 - Set to 0. */
unsigned u1Fixed6 : 1;
/** Descriptor Privilege level. */
unsigned u2DPL : 2;
/** Present flag. */
unsigned u1Present : 1;
/** High offset word. */
unsigned u16OffsetHigh : 16;
#pragma pack()
/** Pointer to IDT Entry, Interrupt gate view. */
/** IDT Entry, Trap Gate view. */
typedef struct VBOXIDTE_TRAPGATE
{
/** Low offset word. */
unsigned u16OffsetLow : 16;
/** Segment Selector. */
unsigned u16SegSel : 16;
/** Reserved. */
unsigned u5Reserved2 : 5;
/** Fixed value bit 0 - Set to 0. */
unsigned u1Fixed0 : 1;
/** Fixed value bit 1 - Set to 0. */
unsigned u1Fixed1 : 1;
/** Fixed value bit 2 - Set to 0. */
unsigned u1Fixed2 : 1;
/** Fixed value bit 3 - Set to 1. */
unsigned u1Fixed3: 1;
/** Fixed value bit 4 - Set to 1. */
unsigned u1Fixed4 : 1;
/** Fixed value bit 5 - Set to 1. */
unsigned u1Fixed5 : 1;
/** Gate size, 1 = 32 bits, 0 = 16 bits. */
unsigned u132BitGate : 1;
/** Fixed value bit 5 - Set to 0. */
unsigned u1Fixed6 : 1;
/** Descriptor Privilege level. */
unsigned u2DPL : 2;
/** Present flag. */
unsigned u1Present : 1;
/** High offset word. */
unsigned u16OffsetHigh : 16;
#pragma pack()
/** Pointer to IDT Entry, Trap Gate view. */
typedef VBOXIDTE_TRAPGATE *PVBOXIDTE_TRAPGATE;
/** IDT Entry Generic view. */
typedef struct VBOXIDTE_GENERIC
{
/** Low offset word. */
unsigned u16OffsetLow : 16;
/** Segment Selector. */
unsigned u16SegSel : 16;
/** Reserved. */
unsigned u5Reserved : 5;
/** IDT Type part one (not used for task gate). */
unsigned u3Type1 : 3;
/** IDT Type part two. */
unsigned u5Type2 : 5;
/** Descriptor Privilege level. */
unsigned u2DPL : 2;
/** Present flag. */
unsigned u1Present : 1;
/** High offset word. */
unsigned u16OffsetHigh : 16;
#pragma pack()
/** Pointer to IDT Entry Generic view. */
typedef VBOXIDTE_GENERIC *PVBOXIDTE_GENERIC;
/** IDT Type1 value. (Reserved for task gate!) */
#define VBOX_IDTE_TYPE1 0
/** IDT Type2 value - Task gate. */
#define VBOX_IDTE_TYPE2_TASK 0x5
/** IDT Type2 value - 16 bit interrupt gate. */
#define VBOX_IDTE_TYPE2_INT_16 0x6
/** IDT Type2 value - 32 bit interrupt gate. */
#define VBOX_IDTE_TYPE2_INT_32 0xe
/** IDT Type2 value - 16 bit trap gate. */
#define VBOX_IDTE_TYPE2_TRAP_16 0x7
/** IDT Type2 value - 32 bit trap gate. */
#define VBOX_IDTE_TYPE2_TRAP_32 0xf
/** IDT Entry. */
typedef union VBOXIDTE
{
/** Task gate view. */
/** Trap gate view. */
/** Interrupt gate view. */
/** Generic IDT view. */
/** 8 bit unsigned integer view. */
/** 16 bit unsigned integer view. */
/** 32 bit unsigned integer view. */
/** 64 bit unsigned integer view. */
} VBOXIDTE;
#pragma pack()
/** Pointer to IDT Entry. */
#pragma pack(1)
/** IDTR */
typedef struct VBOXIDTR
{
/** Size of the IDT. */
/** Address of the IDT. */
#pragma pack()
/** @} */
/** @defgroup grp_types_desc Descriptor Table Entry.
* @ingroup grp_types
* @{ */
#pragma pack(1)
/**
* Memory descriptor.
*/
typedef struct VBOXDESCGENERIC
{
/** 0-15 - Limit - Low word. */
unsigned u16LimitLow : 16;
/** 16-31 - Base address - lowe word.
* Don't try set this to 24 because MSC is doing studing things then. */
unsigned u16BaseLow : 16;
/** 32-39 - Base address - first 8 bits of high word. */
unsigned u8BaseHigh1 : 8;
/** 40-43 - Segment Type. */
unsigned u4Type : 4;
unsigned u1DescType : 1;
/** 45-46 - Descriptor Privelege level. */
unsigned u2Dpl : 2;
/** 47 - Flags selector present(=1) or not. */
unsigned u1Present : 1;
/** 48-51 - Segment limit 16-19. */
unsigned u4LimitHigh : 4;
/** 52 - Available for system software. */
unsigned u1Available : 1;
/** 53 - Reserved - 0. In long mode this is the 'Long' (L) attribute bit. */
unsigned u1Reserved : 1;
/** 54 - This flags meaning depends on the segment type. Try make sense out
* of the intel manual yourself. */
unsigned u1DefBig : 1;
/** 55 - Granularity of the limit. If set 4KB granularity is used, if
* clear byte. */
unsigned u1Granularity : 1;
/** 56-63 - Base address - highest 8 bits. */
unsigned u8BaseHigh2 : 8;
#pragma pack()
/** Pointer to a generic descriptor entry. */
typedef VBOXDESCGENERIC *PVBOXDESCGENERIC;
#pragma pack(1)
/**
* Descriptor table entry.
*/
typedef union VBOXDESC
{
/** Generic descriptor view. */
/** IDT view. */
/** 8 bit unsigned interger view. */
/** 16 bit unsigned interger view. */
/** 32 bit unsigned interger view. */
} VBOXDESC;
#pragma pack()
/** Pointer to descriptor table entry. */
/** Pointer to const descriptor table entry. */
typedef VBOXDESC const *PCVBOXDESC;
#pragma pack(1)
/** GDTR */
typedef struct VBOXGDTR
{
/** Size of the GDT. */
/** Address of the GDT. */
} VBOXGDTR;
#pragma pack()
/** Pointer to GDTR. */
/** @} */
/** @defgroup grp_types_pg Page Structures
* @ingroup grp_types
* @{
*/
/** @} */
/**
* Task Segment
*/
#pragma pack(1)
typedef struct VBOXTSS
{
/** Back link to previous task. (static) */
/** Ring-0 stack pointer. (static) */
/** Ring-0 stack segment. (static) */
/** Ring-1 stack pointer. (static) */
/** Ring-1 stack segment. (static) */
/** Ring-2 stack pointer. (static) */
/** Ring-2 stack segment. (static) */
/** Page directory for the task. (static) */
/** EIP before task switch. */
/** EFLAGS before task switch. */
/** EAX before task switch. */
/** ECX before task switch. */
/** EDX before task switch. */
/** EBX before task switch. */
/** ESP before task switch. */
/** EBP before task switch. */
/** ESI before task switch. */
/** EDI before task switch. */
/** ES before task switch. */
/** CS before task switch. */
/** SS before task switch. */
/** DS before task switch. */
/** FS before task switch. */
/** GS before task switch. */
/** LDTR before task switch. */
/** Debug trap flag */
/** Offset relative to the TSS of the start of the I/O Bitmap
* and the end of the interrupt redirection bitmap. */
/** 32 bytes for the virtual interrupt redirection bitmap. (VME) */
} VBOXTSS;
#pragma pack()
/** Pointer to task segment. */
/** Pointer to const task segment. */
/** @} */
#endif