Logo Search packages:      
Sourcecode: virtualbox-ose version File versions  Download package

types.h

Go to the documentation of this file.
/** @file
 * VirtualBox - Types.
 */

/*
 * Copyright (C) 2006-2007 Oracle Corporation
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License (GPL) 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.
 *
 * The contents of this file may alternatively be used under the terms
 * of the Common Development and Distribution License Version 1.0
 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
 * VirtualBox OSE distribution, in which case the provisions of the
 * CDDL are applicable instead of those of the GPL.
 *
 * You may elect to license modified versions of this file under the
 * terms and conditions of either the GPL or the CDDL or both.
 */

#ifndef ___VBox_types_h
#define ___VBox_types_h

#include <VBox/cdefs.h>
#include <iprt/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
 * @{
 */

/** @} */


/** @defgroup grp_types_gc  Guest Context Basic Types
 * @ingroup grp_types_both
 * @{
 */

/** @} */


/** 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.) */
typedef R0PTRTYPE(struct SUPDRVSESSION *) PSUPDRVSESSION;

/** Pointer to a VM. */
00066 typedef struct VM                  *PVM;
/** Pointer to a VM - Ring-0 Ptr. */
typedef R0PTRTYPE(struct VM *)      PVMR0;
/** Pointer to a VM - Ring-3 Ptr. */
typedef R3PTRTYPE(struct VM *)      PVMR3;
/** Pointer to a VM - RC Ptr. */
typedef RCPTRTYPE(struct VM *)      PVMRC;

/** Pointer to a virtual CPU structure. */
00075 typedef struct VMCPU *              PVMCPU;
/** Pointer to a virtual CPU structure - Ring-3 Ptr. */
typedef R3PTRTYPE(struct VMCPU *)   PVMCPUR3;
/** Pointer to a virtual CPU structure - Ring-0 Ptr. */
typedef R0PTRTYPE(struct VMCPU *)   PVMCPUR0;
/** Pointer to a virtual CPU structure - RC Ptr. */
typedef RCPTRTYPE(struct VMCPU *)   PVMCPURC;

/** Pointer to a ring-0 (global) VM structure. */
typedef R0PTRTYPE(struct GVM *)     PGVM;

/** Pointer to a ring-3 (user mode) VM structure. */
typedef R3PTRTYPE(struct UVM *)     PUVM;

/** Pointer to a ring-3 (user mode) VMCPU structure. */
typedef R3PTRTYPE(struct UVMCPU *)  PUVMCPU;

/** Virtual CPU ID. */
00093 typedef uint32_t                    VMCPUID;
/** Pointer to a virtual CPU ID. */
00095 typedef VMCPUID                    *PVMCPUID;
/** @name Special CPU ID values.
 * Most of these are for request scheduling.
 *
 * @{ */
/** All virtual CPUs. */
00101 #define VMCPUID_ALL         UINT32_C(0xfffffff2)
/** All virtual CPUs, descending order. */
00103 #define VMCPUID_ALL_REVERSE UINT32_C(0xfffffff3)
/** Any virtual CPU.
 * Intended for scheduling a VM request or some other task. */
00106 #define VMCPUID_ANY         UINT32_C(0xfffffff4)
/** Any virtual CPU; always queue for future execution.
 * Intended for scheduling a VM request or some other task. */
00109 #define VMCPUID_ANY_QUEUE   UINT32_C(0xfffffff5)
/** The NIL value. */
00111 #define NIL_VMCPUID         UINT32_C(0xfffffffd)
/** @} */

/**
 * Virtual CPU set.
 */
00117 typedef struct VMCPUSET
{
    /** The bitmap data.  */
00120     uint32_t    au32Bitmap[256/32];
} VMCPUSET;
/** Pointer to a Virtual CPU set. */
00123 typedef VMCPUSET *PVMCPUSET;
/** Pointer to a const Virtual CPU set. */
00125 typedef VMCPUSET const *PCVMCPUSET;

/** Tests if a valid CPU ID is present in the set.. */
00128 #define VMCPUSET_IS_PRESENT(pSet, idCpu)    ASMBitTest( &(pSet)->au32Bitmap, (idCpu))
/** Adds a CPU to the set. */
00130 #define VMCPUSET_ADD(pSet, idCpu)           ASMBitSet(  &(pSet)->au32Bitmap, (idCpu))
/** Deletes a CPU from the set. */
00132 #define VMCPUSET_DEL(pSet, idCpu)           ASMBitClear(&(pSet)->au32Bitmap, (idCpu))
/** Empties the set. */
00134 #define VMCPUSET_EMPTY(pSet)                memset(&(pSet)->au32Bitmap[0], '\0', sizeof((pSet)->au32Bitmap))
/** Filles the set. */
00136 #define VMCPUSET_FILL(pSet)                 memset(&(pSet)->au32Bitmap[0], 0xff, sizeof((pSet)->au32Bitmap))
/** Filles the set. */
00138 #define VMCPUSET_IS_EQUAL(pSet1, pSet2)     (memcmp(&(pSet1)->au32Bitmap[0], &(pSet2)->au32Bitmap[0], sizeof((pSet1)->au32Bitmap)) == 0)


/**
 * VM State
 */
00144 typedef enum VMSTATE
{
    /** The VM is being created. */
00147     VMSTATE_CREATING = 0,
    /** The VM is created. */
00149     VMSTATE_CREATED,
    /** The VM state is being loaded from file. */
00151     VMSTATE_LOADING,
    /** The VM is being powered on */
00153     VMSTATE_POWERING_ON,
    /** The VM is being resumed. */
00155     VMSTATE_RESUMING,
    /** The VM is runnning. */
00157     VMSTATE_RUNNING,
    /** Live save: The VM is running and the state is being saved. */
00159     VMSTATE_RUNNING_LS,
    /** The VM is being reset. */
00161     VMSTATE_RESETTING,
    /** Live save: The VM is being reset and immediately suspended. */
00163     VMSTATE_RESETTING_LS,
    /** The VM is being suspended. */
00165     VMSTATE_SUSPENDING,
    /** Live save: The VM is being suspended during a live save operation, either as
     * part of the normal flow or VMR3Reset. */
00168     VMSTATE_SUSPENDING_LS,
    /** Live save: The VM is being suspended by VMR3Suspend during live save. */
00170     VMSTATE_SUSPENDING_EXT_LS,
    /** The VM is suspended. */
00172     VMSTATE_SUSPENDED,
    /** Live save: The VM has been suspended and is waiting for the live save
     * operation to move on. */
00175     VMSTATE_SUSPENDED_LS,
    /** Live save: The VM has been suspended by VMR3Suspend during a live save. */
00177     VMSTATE_SUSPENDED_EXT_LS,
    /** The VM is suspended and its state is being saved by EMT(0). (See SSM) */
00179     VMSTATE_SAVING,
    /** The VM is being debugged. (See DBGF.) */
00181     VMSTATE_DEBUGGING,
    /** Live save: The VM is being debugged while the live phase is going on. */
00183     VMSTATE_DEBUGGING_LS,
    /** The VM is being powered off. */
00185     VMSTATE_POWERING_OFF,
    /** Live save: The VM is being powered off and the save cancelled. */
00187     VMSTATE_POWERING_OFF_LS,
    /** The VM is switched off, awaiting destruction. */
00189     VMSTATE_OFF,
    /** Live save: Waiting for cancellation and transition to VMSTATE_OFF. */
00191     VMSTATE_OFF_LS,
    /** The VM is powered off because of a fatal error. */
00193     VMSTATE_FATAL_ERROR,
    /** Live save: Waiting for cancellation and transition to FatalError. */
00195     VMSTATE_FATAL_ERROR_LS,
    /** The VM is in guru meditation over a fatal failure. */
00197     VMSTATE_GURU_MEDITATION,
    /** Live save: Waiting for cancellation and transition to GuruMeditation. */
00199     VMSTATE_GURU_MEDITATION_LS,
    /** The VM is screwed because of a failed state loading. */
00201     VMSTATE_LOAD_FAILURE,
    /** The VM is being destroyed. */
00203     VMSTATE_DESTROYING,
    /** Terminated. */
00205     VMSTATE_TERMINATED,
    /** hack forcing the size of the enum to 32-bits. */
00207     VMSTATE_MAKE_32BIT_HACK = 0x7fffffff
} VMSTATE;

/** @def VBOXSTRICTRC_STRICT_ENABLED
 * Indicates that VBOXSTRICTRC is in strict mode.
 */
#if defined(__cplusplus) \
 && ARCH_BITS == 64    /* cdecl requires classes and structs as hidden params. */ \
 && !defined(_MSC_VER) /* trouble similar to 32-bit gcc. */ \
 &&  (   defined(RT_STRICT) \
      || defined(VBOX_STRICT) \
      || defined(DEBUG) \
      || defined(DOXYGEN_RUNNING) )
# define VBOXSTRICTRC_STRICT_ENABLED 1
# ifdef _MSC_VER
#  pragma warning(disable:4190)
# endif
#endif

/** We need RTERR_STRICT_RC.  */
#if defined(VBOXSTRICTRC_STRICT_ENABLED) && !defined(RTERR_STRICT_RC)
# define RTERR_STRICT_RC 1
#endif

/**
 * Strict VirtualBox status code.
 *
 * This is normally an 32-bit integer and the only purpose of the type is to
 * highlight the special handling that is required.  But in strict build it is a
 * class that causes compilation and runtime errors for some of the incorrect
 * handling.
 */
#ifdef VBOXSTRICTRC_STRICT_ENABLED
struct VBOXSTRICTRC
{
protected:
    /** The status code. */
    int32_t m_rc;

public:
    /** Default constructor setting the status to VERR_IPE_UNINITIALIZED_STATUS. */
    VBOXSTRICTRC()
#ifdef VERR_IPE_UNINITIALIZED_STATUS
        : m_rc(VERR_IPE_UNINITIALIZED_STATUS)
#else
        : m_rc(-233 /*VERR_IPE_UNINITIALIZED_STATUS*/)
#endif
    {
    }

    /** Constructor for normal integer status codes. */
    VBOXSTRICTRC(int32_t const rc)
        : m_rc(rc)
    {
    }

    /** Getter that VBOXSTRICTRC_VAL can use. */
    int32_t getValue() const                    { return m_rc; }

    /** @name Comparison operators
     * @{ */
    bool operator==(int32_t rc) const           { return m_rc == rc; }
    bool operator!=(int32_t rc) const           { return m_rc != rc; }
    bool operator<=(int32_t rc) const           { return m_rc <= rc; }
    bool operator>=(int32_t rc) const           { return m_rc >= rc; }
    bool operator<(int32_t rc) const            { return m_rc < rc; }
    bool operator>(int32_t rc) const            { return m_rc > rc; }
    /** @} */

    /** Special automatic cast for RT_SUCCESS_NP. */
    operator RTErrStrictType2() const           { return RTErrStrictType2(m_rc); }

private:
    /** @name Constructors that will prevent some of the bad types.
     * @{ */
    VBOXSTRICTRC(uint8_t  rc) : m_rc(-999)      { NOREF(rc); }
    VBOXSTRICTRC(uint16_t rc) : m_rc(-999)      { NOREF(rc); }
    VBOXSTRICTRC(uint32_t rc) : m_rc(-999)      { NOREF(rc); }
    VBOXSTRICTRC(uint64_t rc) : m_rc(-999)      { NOREF(rc); }

    VBOXSTRICTRC(int8_t rc)   : m_rc(-999)      { NOREF(rc); }
    VBOXSTRICTRC(int16_t rc)  : m_rc(-999)      { NOREF(rc); }
    VBOXSTRICTRC(int64_t rc)  : m_rc(-999)      { NOREF(rc); }
    /** @} */
};
#else
00293 typedef int32_t VBOXSTRICTRC;
#endif

/** @def VBOXSTRICTRC_VAL
 * Explicit getter.
 * @param rcStrict  The strict VirtualBox status code.
 */
#ifdef VBOXSTRICTRC_STRICT_ENABLED
# define VBOXSTRICTRC_VAL(rcStrict) ( (rcStrict).getValue() )
#else
00303 # define VBOXSTRICTRC_VAL(rcStrict) (rcStrict)
#endif

/** @def VBOXSTRICTRC_TODO
 * Returns that needs dealing with.
 * @param rcStrict  The strict VirtualBox status code.
 */
00310 #define VBOXSTRICTRC_TODO(rcStrict) VBOXSTRICTRC_VAL(rcStrict)


/** Pointer to a PDM Base Interface. */
00314 typedef struct PDMIBASE *PPDMIBASE;
/** Pointer to a pointer to a PDM Base Interface. */
00316 typedef PPDMIBASE *PPPDMIBASE;

/** Pointer to a PDM Device Instance. */
00319 typedef struct PDMDEVINS *PPDMDEVINS;
/** Pointer to a pointer to a PDM Device Instance. */
00321 typedef PPDMDEVINS *PPPDMDEVINS;
/** R3 pointer to a PDM Device Instance. */
typedef R3PTRTYPE(PPDMDEVINS) PPDMDEVINSR3;
/** R0 pointer to a PDM Device Instance. */
typedef R0PTRTYPE(PPDMDEVINS) PPDMDEVINSR0;
/** RC pointer to a PDM Device Instance. */
typedef RCPTRTYPE(PPDMDEVINS) PPDMDEVINSRC;

/** Pointer to a PDM USB Device Instance. */
00330 typedef struct PDMUSBINS *PPDMUSBINS;
/** Pointer to a pointer to a PDM USB Device Instance. */
00332 typedef PPDMUSBINS *PPPDMUSBINS;

/** Pointer to a PDM Driver Instance. */
00335 typedef struct PDMDRVINS *PPDMDRVINS;
/** Pointer to a pointer to a PDM Driver Instance. */
00337 typedef PPDMDRVINS *PPPDMDRVINS;
/** R3 pointer to a PDM Driver Instance. */
typedef R3PTRTYPE(PPDMDRVINS) PPDMDRVINSR3;
/** R0 pointer to a PDM Driver Instance. */
typedef R0PTRTYPE(PPDMDRVINS) PPDMDRVINSR0;
/** RC pointer to a PDM Driver Instance. */
typedef RCPTRTYPE(PPDMDRVINS) PPDMDRVINSRC;

/** Pointer to a PDM Service Instance. */
00346 typedef struct PDMSRVINS *PPDMSRVINS;
/** Pointer to a pointer to a PDM Service Instance. */
00348 typedef PPDMSRVINS *PPPDMSRVINS;

/** Pointer to a PDM critical section. */
00351 typedef union PDMCRITSECT *PPDMCRITSECT;
/** Pointer to a const PDM critical section. */
00353 typedef const union PDMCRITSECT *PCPDMCRITSECT;

/** R3 pointer to a timer. */
typedef R3PTRTYPE(struct TMTIMER *) PTMTIMERR3;
/** Pointer to a R3 pointer to a timer. */
00358 typedef PTMTIMERR3 *PPTMTIMERR3;

/** R0 pointer to a timer. */
typedef R0PTRTYPE(struct TMTIMER *) PTMTIMERR0;
/** Pointer to a R3 pointer to a timer. */
00363 typedef PTMTIMERR0 *PPTMTIMERR0;

/** RC pointer to a timer. */
typedef RCPTRTYPE(struct TMTIMER *) PTMTIMERRC;
/** Pointer to a RC pointer to a timer. */
00368 typedef PTMTIMERRC *PPTMTIMERRC;

/** Pointer to a timer. */
typedef CTX_SUFF(PTMTIMER)     PTMTIMER;
/** Pointer to a pointer to a timer. */
00373 typedef PTMTIMER              *PPTMTIMER;

/** SSM Operation handle. */
00376 typedef struct SSMHANDLE *PSSMHANDLE;
/** Pointer to a const SSM stream method table. */
00378 typedef struct SSMSTRMOPS const *PCSSMSTRMOPS;

/** Pointer to a CPUMCTX. */
00381 typedef struct CPUMCTX *PCPUMCTX;
/** Pointer to a const CPUMCTX. */
00383 typedef const struct CPUMCTX *PCCPUMCTX;

/** Pointer to a CPU context core. */
00386 typedef struct CPUMCTXCORE *PCPUMCTXCORE;
/** Pointer to a const CPU context core. */
00388 typedef const struct CPUMCTXCORE *PCCPUMCTXCORE;

/** Pointer to selector hidden registers. */
00391 typedef struct CPUMSELREGHID *PCPUMSELREGHID;
/** Pointer to const selector hidden registers. */
00393 typedef const struct CPUMSELREGHID *PCCPUMSELREGHID;

/** @} */


/** @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. */
#pragma pack(1)                         /* paranoia */
00407 typedef struct VBOXIDTE_TASKGATE
{
    /** Reserved. */
00410     unsigned    u16Reserved1 : 16;
    /** Task Segment Selector. */
00412     unsigned    u16TSS : 16;
    /** More reserved. */
00414     unsigned    u8Reserved2 : 8;
    /** Fixed value bit 0 - Set to 1. */
00416     unsigned    u1Fixed0 : 1;
    /** Busy bit. */
00418     unsigned    u1Busy : 1;
    /** Fixed value bit 2 - Set to 1. */
00420     unsigned    u1Fixed1 : 1;
    /** Fixed value bit 3 - Set to 0. */
00422     unsigned    u1Fixed2: 1;
    /** Fixed value bit 4 - Set to 0. */
00424     unsigned    u1Fixed3 : 1;
    /** Descriptor Privilege level. */
00426     unsigned    u2DPL : 2;
    /** Present flag. */
00428     unsigned    u1Present : 1;
    /** Reserved. */
00430     unsigned    u16Reserved3 : 16;
} VBOXIDTE_TASKGATE;
#pragma pack()
/** Pointer to IDT Entry, Task gate view. */
00434 typedef VBOXIDTE_TASKGATE *PVBOXIDTE_TASKGATE;


/** IDT Entry, Intertupt gate view. */
#pragma pack(1)                         /* paranoia */
00439 typedef struct VBOXIDTE_INTERRUPTGATE
{
    /** Low offset word. */
00442     unsigned    u16OffsetLow : 16;
    /** Segment Selector. */
00444     unsigned    u16SegSel : 16;
    /** Reserved. */
00446     unsigned    u5Reserved2 : 5;
    /** Fixed value bit 0 - Set to 0. */
00448     unsigned    u1Fixed0 : 1;
    /** Fixed value bit 1 - Set to 0. */
00450     unsigned    u1Fixed1 : 1;
    /** Fixed value bit 2 - Set to 0. */
00452     unsigned    u1Fixed2 : 1;
    /** Fixed value bit 3 - Set to 0. */
00454     unsigned    u1Fixed3: 1;
    /** Fixed value bit 4 - Set to 1. */
00456     unsigned    u1Fixed4 : 1;
    /** Fixed value bit 5 - Set to 1. */
00458     unsigned    u1Fixed5 : 1;
    /** Gate size, 1 = 32 bits, 0 = 16 bits. */
00460     unsigned    u132BitGate : 1;
    /** Fixed value bit 5 - Set to 0. */
00462     unsigned    u1Fixed6 : 1;
    /** Descriptor Privilege level. */
00464     unsigned    u2DPL : 2;
    /** Present flag. */
00466     unsigned    u1Present : 1;
    /** High offset word. */
00468     unsigned    u16OffsetHigh : 16;
} VBOXIDTE_INTERRUPTGATE;
#pragma pack()
/** Pointer to IDT Entry, Interrupt gate view. */
00472 typedef  VBOXIDTE_INTERRUPTGATE *PVBOXIDTE_INTERRUPTGATE;

/** IDT Entry, Trap Gate view. */
#pragma pack(1)                         /* paranoia */
00476 typedef struct VBOXIDTE_TRAPGATE
{
    /** Low offset word. */
00479     unsigned    u16OffsetLow : 16;
    /** Segment Selector. */
00481     unsigned    u16SegSel : 16;
    /** Reserved. */
00483     unsigned    u5Reserved2 : 5;
    /** Fixed value bit 0 - Set to 0. */
00485     unsigned    u1Fixed0 : 1;
    /** Fixed value bit 1 - Set to 0. */
00487     unsigned    u1Fixed1 : 1;
    /** Fixed value bit 2 - Set to 0. */
00489     unsigned    u1Fixed2 : 1;
    /** Fixed value bit 3 - Set to 1. */
00491     unsigned    u1Fixed3: 1;
    /** Fixed value bit 4 - Set to 1. */
00493     unsigned    u1Fixed4 : 1;
    /** Fixed value bit 5 - Set to 1. */
00495     unsigned    u1Fixed5 : 1;
    /** Gate size, 1 = 32 bits, 0 = 16 bits. */
00497     unsigned    u132BitGate : 1;
    /** Fixed value bit 5 - Set to 0. */
00499     unsigned    u1Fixed6 : 1;
    /** Descriptor Privilege level. */
00501     unsigned    u2DPL : 2;
    /** Present flag. */
00503     unsigned    u1Present : 1;
    /** High offset word. */
00505     unsigned    u16OffsetHigh : 16;
} VBOXIDTE_TRAPGATE;
#pragma pack()
/** Pointer to IDT Entry, Trap Gate view. */
00509 typedef VBOXIDTE_TRAPGATE *PVBOXIDTE_TRAPGATE;

/** IDT Entry Generic view. */
#pragma pack(1)                         /* paranoia */
00513 typedef struct VBOXIDTE_GENERIC
{
    /** Low offset word. */
00516     unsigned    u16OffsetLow : 16;
    /** Segment Selector. */
00518     unsigned    u16SegSel : 16;
    /** Reserved. */
00520     unsigned    u5Reserved : 5;
    /** IDT Type part one (not used for task gate). */
00522     unsigned    u3Type1 : 3;
    /** IDT Type part two. */
00524     unsigned    u5Type2 : 5;
    /** Descriptor Privilege level. */
00526     unsigned    u2DPL : 2;
    /** Present flag. */
00528     unsigned    u1Present : 1;
    /** High offset word. */
00530     unsigned    u16OffsetHigh : 16;
} VBOXIDTE_GENERIC;
#pragma pack()
/** Pointer to IDT Entry Generic view. */
00534 typedef VBOXIDTE_GENERIC *PVBOXIDTE_GENERIC;

/** IDT Type1 value. (Reserved for task gate!) */
00537 #define VBOX_IDTE_TYPE1             0
/** IDT Type2 value - Task gate. */
00539 #define VBOX_IDTE_TYPE2_TASK        0x5
/** IDT Type2 value - 16 bit interrupt gate. */
00541 #define VBOX_IDTE_TYPE2_INT_16      0x6
/** IDT Type2 value - 32 bit interrupt gate. */
00543 #define VBOX_IDTE_TYPE2_INT_32      0xe
/** IDT Type2 value - 16 bit trap gate. */
00545 #define VBOX_IDTE_TYPE2_TRAP_16     0x7
/** IDT Type2 value - 32 bit trap gate. */
00547 #define VBOX_IDTE_TYPE2_TRAP_32     0xf

/** IDT Entry. */
#pragma pack(1)                         /* paranoia */
00551 typedef union VBOXIDTE
{
    /** Task gate view. */
00554     VBOXIDTE_TASKGATE       Task;
    /** Trap gate view. */
00556     VBOXIDTE_TRAPGATE       Trap;
    /** Interrupt gate view. */
00558     VBOXIDTE_INTERRUPTGATE  Int;
    /** Generic IDT view. */
00560     VBOXIDTE_GENERIC        Gen;

    /** 8 bit unsigned integer view. */
00563     uint8_t     au8[8];
    /** 16 bit unsigned integer view. */
00565     uint16_t    au16[4];
    /** 32 bit unsigned integer view. */
00567     uint32_t    au32[2];
    /** 64 bit unsigned integer view. */
00569     uint64_t    au64;
} VBOXIDTE;
#pragma pack()
/** Pointer to IDT Entry. */
00573 typedef VBOXIDTE *PVBOXIDTE;
/** Pointer to IDT Entry. */
00575 typedef VBOXIDTE const *PCVBOXIDTE;

#pragma pack(1)
/** IDTR */
00579 typedef struct VBOXIDTR
{
    /** Size of the IDT. */
00582     uint16_t    cbIdt;
    /** Address of the IDT. */
00584     uint64_t     pIdt;
} VBOXIDTR, *PVBOXIDTR;
#pragma pack()

#pragma pack(1)
/** IDTR from version 1.6 */
00590 typedef struct VBOXIDTR_VER1_6
{
    /** Size of the IDT. */
00593     uint16_t    cbIdt;
    /** Address of the IDT. */
00595     uint32_t     pIdt;
} VBOXIDTR_VER1_6, *PVBOXIDTR_VER1_6;
#pragma pack()

/** @} */


/** @def VBOXIDTE_OFFSET
 * Return the offset of an IDT entry.
 */
00605 #define VBOXIDTE_OFFSET(desc) \
        (  ((uint32_t)((desc).Gen.u16OffsetHigh) << 16) \
         | (           (desc).Gen.u16OffsetLow        ) )

#pragma pack(1)
/** GDTR */
00611 typedef struct VBOXGDTR
{
    /** Size of the GDT. */
00614     uint16_t    cbGdt;
    /** Address of the GDT. */
00616     uint64_t    pGdt;
} VBOXGDTR;
#pragma pack()
/** Pointer to GDTR. */
00620 typedef VBOXGDTR *PVBOXGDTR;

#pragma pack(1)
/** GDTR from version 1.6 */
00624 typedef struct VBOXGDTR_VER1_6
{
    /** Size of the GDT. */
00627     uint16_t    cbGdt;
    /** Address of the GDT. */
00629     uint32_t    pGdt;
} VBOXGDTR_VER1_6;
#pragma pack()

/** @} */


/**
 * 32-bit Task Segment used in raw mode.
 * @todo Move this to SELM! Use X86TSS32 instead.
 */
#pragma pack(1)
00641 typedef struct VBOXTSS
{
    /** 0x00 - Back link to previous task. (static) */
00644     RTSEL       selPrev;
    uint16_t    padding1;
    /** 0x04 - Ring-0 stack pointer. (static) */
00647     uint32_t    esp0;
    /** 0x08 - Ring-0 stack segment. (static) */
00649     RTSEL       ss0;
    uint16_t    padding_ss0;
    /** 0x0c - Ring-1 stack pointer. (static) */
00652     uint32_t    esp1;
    /** 0x10 - Ring-1 stack segment. (static) */
00654     RTSEL       ss1;
    uint16_t    padding_ss1;
    /** 0x14 - Ring-2 stack pointer. (static) */
00657     uint32_t    esp2;
    /** 0x18 - Ring-2 stack segment. (static) */
00659     RTSEL       ss2;
    uint16_t    padding_ss2;
    /** 0x1c - Page directory for the task. (static) */
00662     uint32_t    cr3;
    /** 0x20 - EIP before task switch. */
00664     uint32_t    eip;
    /** 0x24 - EFLAGS before task switch. */
00666     uint32_t    eflags;
    /** 0x28 - EAX before task switch. */
00668     uint32_t    eax;
    /** 0x2c - ECX before task switch. */
00670     uint32_t    ecx;
    /** 0x30 - EDX before task switch. */
00672     uint32_t    edx;
    /** 0x34 - EBX before task switch. */
00674     uint32_t    ebx;
    /** 0x38 - ESP before task switch. */
00676     uint32_t    esp;
    /** 0x3c - EBP before task switch. */
00678     uint32_t    ebp;
    /** 0x40 - ESI before task switch. */
00680     uint32_t    esi;
    /** 0x44 - EDI before task switch. */
00682     uint32_t    edi;
    /** 0x48 - ES before task switch. */
00684     RTSEL       es;
    uint16_t    padding_es;
    /** 0x4c - CS before task switch. */
00687     RTSEL       cs;
    uint16_t    padding_cs;
    /** 0x50 - SS before task switch. */
00690     RTSEL       ss;
    uint16_t    padding_ss;
    /** 0x54 - DS before task switch. */
00693     RTSEL       ds;
    uint16_t    padding_ds;
    /** 0x58 - FS before task switch. */
00696     RTSEL       fs;
    uint16_t    padding_fs;
    /** 0x5c - GS before task switch. */
00699     RTSEL       gs;
    uint16_t    padding_gs;
    /** 0x60 - LDTR before task switch. */
00702     RTSEL       selLdt;
    uint16_t    padding_ldt;
    /** 0x64 - Debug trap flag */
00705     uint16_t    fDebugTrap;
    /** 0x66 -  Offset relative to the TSS of the start of the I/O Bitmap
     * and the end of the interrupt redirection bitmap. */
00708     uint16_t    offIoBitmap;
    /** 0x68 -  32 bytes for the virtual interrupt redirection bitmap. (VME) */
00710     uint8_t     IntRedirBitmap[32];
} VBOXTSS;
#pragma pack()
/** Pointer to task segment. */
00714 typedef VBOXTSS *PVBOXTSS;
/** Pointer to const task segment. */
00716 typedef const VBOXTSS *PCVBOXTSS;


/**
 * Data transport buffer (scatter/gather)
 */
00722 typedef struct PDMDATASEG
{
    /** Length of buffer in entry. */
00725     size_t  cbSeg;
    /** Pointer to the start of the buffer. */
00727     void   *pvSeg;
} PDMDATASEG;
/** Pointer to a data transport segment. */
00730 typedef PDMDATASEG *PPDMDATASEG;
/** Pointer to a const data transport segment. */
00732 typedef PDMDATASEG const *PCPDMDATASEG;


/**
 * Forms of generic segment offloading.
 */
00738 typedef enum PDMNETWORKGSOTYPE
{
    /** Invalid zero value. */
00741     PDMNETWORKGSOTYPE_INVALID = 0,
    /** TCP/IPv4 - no CWR/ECE encoding. */
00743     PDMNETWORKGSOTYPE_IPV4_TCP,
    /** TCP/IPv6 - no CWR/ECE encoding. */
00745     PDMNETWORKGSOTYPE_IPV6_TCP,
    /** UDP/IPv4. */
00747     PDMNETWORKGSOTYPE_IPV4_UDP,
    /** UDP/IPv6. */
00749     PDMNETWORKGSOTYPE_IPV6_UDP,
    /** TCP/IPv6 over IPv4 tunneling - no CWR/ECE encoding.
     * The header offsets and sizes relates to IPv4 and TCP, the IPv6 header is
     * figured out as needed.
     * @todo Needs checking against facts, this is just an outline of the idea. */
00754     PDMNETWORKGSOTYPE_IPV4_IPV6_TCP,
    /** UDP/IPv6 over IPv4 tunneling.
     * The header offsets and sizes relates to IPv4 and UDP, the IPv6 header is
     * figured out as needed.
     * @todo Needs checking against facts, this is just an outline of the idea. */
00759     PDMNETWORKGSOTYPE_IPV4_IPV6_UDP,
    /** The end of valid GSO types. */
00761     PDMNETWORKGSOTYPE_END
} PDMNETWORKGSOTYPE;


/**
 * Generic segment offloading context.
 *
 * We generally follow the E1000 specs wrt to which header fields we change.
 * However the GSO type implies where the checksum fields are and that they are
 * always updated from scratch (no half done pseudo checksums).
 *
 * @remarks This is part of the internal network GSO packets.  Take great care
 *          when making changes.  The size is expected to be exactly 8 bytes.
 */
00775 typedef struct PDMNETWORKGSO
{
    /** The type of segmentation offloading we're performing (PDMNETWORKGSOTYPE). */
00778     uint8_t             u8Type;
    /** The total header size. */
00780     uint8_t             cbHdrs;
    /** The max segment size (MSS) to apply. */
00782     uint16_t            cbMaxSeg;

    /** Offset of the first header (IPv4 / IPv6).  0 if not not needed. */
00785     uint8_t             offHdr1;
    /** Offset of the second header (TCP / UDP).  0 if not not needed. */
00787     uint8_t             offHdr2;
    /** Unused. */
00789     uint8_t             au8Unused[2];
} PDMNETWORKGSO;
/** Pointer to a GSO context. */
00792 typedef PDMNETWORKGSO *PPDMNETWORKGSO;
/** Pointer to a const GSO context. */
00794 typedef PDMNETWORKGSO const *PCPDMNETWORKGSO;


/**
 * The current ROM page protection.
 *
 * @remarks This is part of the saved state.
 */
00802 typedef enum PGMROMPROT
{
    /** The customary invalid value. */
00805     PGMROMPROT_INVALID = 0,
    /** Read from the virgin ROM page, ignore writes.
     * Map the virgin page, use write access handler to ignore writes. */
00808     PGMROMPROT_READ_ROM_WRITE_IGNORE,
    /** Read from the virgin ROM page, write to the shadow RAM.
     * Map the virgin page, use write access handler change the RAM. */
00811     PGMROMPROT_READ_ROM_WRITE_RAM,
    /** Read from the shadow ROM page, ignore writes.
     * Map the shadow page read-only, use write access handler to ignore writes. */
00814     PGMROMPROT_READ_RAM_WRITE_IGNORE,
    /** Read from the shadow ROM page, ignore writes.
     * Map the shadow page read-write, disabled write access handler. */
00817     PGMROMPROT_READ_RAM_WRITE_RAM,
    /** The end of valid values. */
00819     PGMROMPROT_END,
    /** The usual 32-bit type size hack. */
00821     PGMROMPROT_32BIT_HACK = 0x7fffffff
} PGMROMPROT;


/**
 * Page mapping lock.
 *
 * @remarks This doesn't work in structures shared between
 *          ring-3, ring-0 and/or GC.
 */
00831 typedef struct PGMPAGEMAPLOCK
{
    /** @todo see PGMPhysIsPageMappingLockValid for possibly incorrect assumptions */
#if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
    /** Just a dummy for the time being. */
    uint32_t    u32Dummy;
#else
    /** Pointer to the PGMPAGE and lock type.
     * bit-0 abuse: set=write, clear=read. */
00840     uintptr_t   uPageAndType;
/** Read lock type value. */
00842 # define PGMPAGEMAPLOCK_TYPE_READ    ((uintptr_t)0)
/** Write lock type value. */
00844 # define PGMPAGEMAPLOCK_TYPE_WRITE   ((uintptr_t)1)
/** Lock type mask. */
00846 # define PGMPAGEMAPLOCK_TYPE_MASK    ((uintptr_t)1)
    /** Pointer to the PGMCHUNKR3MAP. */
00848     void       *pvMap;
#endif
} PGMPAGEMAPLOCK;
/** Pointer to a page mapping lock. */
00852 typedef PGMPAGEMAPLOCK *PPGMPAGEMAPLOCK;


/** Configuration manager tree node - A key. */
00856 typedef struct CFGMNODE *PCFGMNODE;

/** Configuration manager tree leaf - A value. */
00859 typedef struct CFGMLEAF *PCFGMLEAF;

/**
 * CPU modes.
 */
00864 typedef enum CPUMMODE
{
    /** The usual invalid zero entry. */
00867     CPUMMODE_INVALID = 0,
    /** Real mode. */
00869     CPUMMODE_REAL,
    /** Protected mode (32-bit). */
00871     CPUMMODE_PROTECTED,
    /** Long mode (64-bit). */
00873     CPUMMODE_LONG
} CPUMMODE;

/** @} */

#endif

Generated by  Doxygen 1.6.0   Back to index