Index: trunk/include/VBox/x86.h
===================================================================
--- trunk/include/VBox/x86.h	(revision 19300)
+++ trunk/include/VBox/x86.h	(revision 19304)
@@ -1900,4 +1900,47 @@
 
 /**
+ * Descriptor attributes.
+ */
+typedef struct X86DESCATTRBITS
+{
+    /** Segment Type. */
+    unsigned    u4Type : 4;
+    /** Descriptor Type. System(=0) or code/data selector */
+    unsigned    u1DescType : 1;
+    /** Descriptor Privelege level. */
+    unsigned    u2Dpl : 2;
+    /** Flags selector present(=1) or not. */
+    unsigned    u1Present : 1;
+    /** Segment limit 16-19. */
+    unsigned    u4LimitHigh : 4;
+    /** Available for system software. */
+    unsigned    u1Available : 1;
+    /** 32 bits mode: Reserved - 0, long mode: Long Attribute Bit. */
+    unsigned    u1Long : 1;
+    /** This flags meaning depends on the segment type. Try make sense out
+     * of the intel manual yourself.  */
+    unsigned    u1DefBig : 1;
+    /** Granularity of the limit. If set 4KB granularity is used, if
+     * clear byte. */
+    unsigned    u1Granularity : 1;
+} X86DESCATTRBITS;
+
+
+#pragma pack(1)
+typedef union X86DESCATTR
+{
+    /** Unsigned integer view. */
+    uint32_t           u;
+    /** Normal view. */
+    X86DESCATTRBITS    n;
+} X86DESCATTR;
+#pragma pack()
+/** Pointer to descriptor attributes. */
+typedef X86DESCATTR *PX86DESCATTR;
+/** Pointer to const descriptor attributes. */
+typedef const X86DESCATTR *PCX86DESCATTR;
+
+
+/**
  * Generic descriptor table entry
  */
@@ -1908,5 +1951,5 @@
     unsigned    u16LimitLow : 16;
     /** Base address - lowe word.
-     * Don't try set this to 24 because MSC is doing studing things then. */
+     * Don't try set this to 24 because MSC is doing stupid things then. */
     unsigned    u16BaseLow : 16;
     /** Base address - first 8 bits of high word. */
@@ -1941,13 +1984,23 @@
 typedef const X86DESCGENERIC *PCX86DESCGENERIC;
 
-
-/**
- * Descriptor attributes.
- */
-typedef struct X86DESCATTRBITS
-{
+/**
+ * Call-, Interrupt-, Trap- or Task-gate descriptor (legacy).
+ */
+typedef struct X86DESCGATE
+{
+    /** Target code segment offset - Low word.
+     * Ignored if task-gate. */
+    unsigned    u16OffsetLow : 16;
+    /** Target code segment selector for call-, interrupt- and trap-gates,
+     * TSS selector if task-gate. */
+    unsigned    u16Sel : 16;
+    /** Number of parameters for a call-gate.
+     * Ignored if interrupt-, trap- or task-gate. */
+    unsigned    u4ParmCount : 4;
+    /** Reserved / ignored. */
+    unsigned    u4Reserved : 4;
     /** Segment Type. */
     unsigned    u4Type : 4;
-    /** Descriptor Type. System(=0) or code/data selector */
+    /** Descriptor Type (0 = system). */
     unsigned    u1DescType : 1;
     /** Descriptor Privelege level. */
@@ -1955,34 +2008,13 @@
     /** Flags selector present(=1) or not. */
     unsigned    u1Present : 1;
-    /** Segment limit 16-19. */
-    unsigned    u4LimitHigh : 4;
-    /** Available for system software. */
-    unsigned    u1Available : 1;
-    /** 32 bits mode: Reserved - 0, long mode: Long Attribute Bit. */
-    unsigned    u1Long : 1;
-    /** This flags meaning depends on the segment type. Try make sense out
-     * of the intel manual yourself.  */
-    unsigned    u1DefBig : 1;
-    /** Granularity of the limit. If set 4KB granularity is used, if
-     * clear byte. */
-    unsigned    u1Granularity : 1;
-} X86DESCATTRBITS;
-
-
-#pragma pack(1)
-typedef union X86DESCATTR
-{
-    /** Unsigned integer view. */
-    uint32_t           u;
-    /** Normal view. */
-    X86DESCATTRBITS    n;
-} X86DESCATTR;
-#pragma pack()
-
-/** Pointer to descriptor attributes. */
-typedef X86DESCATTR *PX86DESCATTR;
-/** Pointer to const descriptor attributes. */
-typedef const X86DESCATTR *PCX86DESCATTR;
-
+    /** Target code segment offset - High word.
+     * Ignored if task-gate. */
+    unsigned    u16OffsetHigh : 16;
+} X86DESCGATE;
+AssertCompileSize(X86DESCGATE, 8);
+/** Pointer to a Call-, Interrupt-, Trap- or Task-gate descriptor entry. */
+typedef X86DESCGATE *PX86DESCGATE;
+/** Pointer to a const Call-, Interrupt-, Trap- or Task-gate descriptor entry. */
+typedef const X86DESCGATE *PCX86DESCGATE;
 
 /**
@@ -1994,8 +2026,6 @@
     /** Generic descriptor view. */
     X86DESCGENERIC  Gen;
-#if 0
-    /** IDT view. */
-    VBOXIDTE        Idt;
-#endif
+    /** Gate descriptor view. */
+    X86DESCGATE     Gate;
 
     /** 8 bit unsigned interger view. */
@@ -2006,4 +2036,5 @@
     uint32_t        au32[2];
 } X86DESC;
+AssertCompileSize(X86DESC, 8);
 #pragma pack()
 /** Pointer to descriptor table entry. */
@@ -2012,5 +2043,4 @@
 typedef const X86DESC *PCX86DESC;
 
-
 /** @def X86DESC_BASE
  * Return the base address of a descriptor.
@@ -2038,5 +2068,5 @@
     unsigned    u16LimitLow : 16;
     /** Base address - lowe word. - *IGNORED*
-     * Don't try set this to 24 because MSC is doing studing things then. */
+     * Don't try set this to 24 because MSC is doing stupid things then. */
     unsigned    u16BaseLow : 16;
     /** Base address - first 8 bits of high word. - *IGNORED* */
@@ -2078,4 +2108,6 @@
 /**
  * System descriptor table entry (64 bits)
+ *
+ * @remarks This is, save a couple of comments, identical to X86DESC64GENERIC...
  */
 #pragma pack(1)
@@ -2085,5 +2117,5 @@
     unsigned    u16LimitLow     : 16;
     /** Base address - lowe word.
-     * Don't try set this to 24 because MSC is doing studing things then. */
+     * Don't try set this to 24 because MSC is doing stupid things then. */
     unsigned    u16BaseLow      : 16;
     /** Base address - first 8 bits of high word. */
@@ -2118,8 +2150,46 @@
 } X86DESC64SYSTEM;
 #pragma pack()
-/** Pointer to a generic descriptor entry. */
+/** Pointer to a system descriptor entry. */
 typedef X86DESC64SYSTEM *PX86DESC64SYSTEM;
-/** Pointer to a const generic descriptor entry. */
+/** Pointer to a const system descriptor entry. */
 typedef const X86DESC64SYSTEM *PCX86DESC64SYSTEM;
+
+/**
+ * Call-, Interrupt-, Trap- or Task-gate descriptor (64-bit).
+ */
+typedef struct X86DESC64GATE
+{
+    /** Target code segment offset - Low word. */
+    unsigned    u16OffsetLow : 16;
+    /** Target code segment selector. */
+    unsigned    u16Sel : 16;
+    /** Interrupt stack table for interrupt- and trap-gates.
+     * Ignored by call-gates. */
+    unsigned    u3IST : 3;
+    /** Reserved / ignored. */
+    unsigned    u5Reserved : 5;
+    /** Segment Type. */
+    unsigned    u4Type : 4;
+    /** Descriptor Type (0 = system). */
+    unsigned    u1DescType : 1;
+    /** Descriptor Privelege level. */
+    unsigned    u2Dpl : 2;
+    /** Flags selector present(=1) or not. */
+    unsigned    u1Present : 1;
+    /** Target code segment offset - High word.
+     * Ignored if task-gate. */
+    unsigned    u16OffsetHigh : 16;
+    /** Target code segment offset - Top dword.
+     * Ignored if task-gate. */
+    unsigned    u32OffsetTop : 32;
+    /** Reserved / ignored / must be zero.
+     * For call-gates bits 8 thru 12 must be zero, the other gates ignores this. */
+    unsigned    u32Reserved : 32;
+} X86DESC64GATE;
+AssertCompileSize(X86DESC64GATE, 16);
+/** Pointer to a Call-, Interrupt-, Trap- or Task-gate descriptor entry. */
+typedef X86DESC64GATE *PX86DESC64GATE;
+/** Pointer to a const Call-, Interrupt-, Trap- or Task-gate descriptor entry. */
+typedef const X86DESC64GATE *PCX86DESC64GATE;
 
 
@@ -2134,7 +2204,6 @@
     /** System descriptor view. */
     X86DESC64SYSTEM     System;
-#if 0
+    /** Gate descriptor view. */
     X86DESC64GATE       Gate;
-#endif
 
     /** 8 bit unsigned interger view. */
@@ -2147,4 +2216,5 @@
     uint64_t            au64[2];
 } X86DESC64;
+AssertCompileSize(X86DESC64, 16);
 #pragma pack()
 /** Pointer to descriptor table entry. */
@@ -2161,5 +2231,5 @@
 #endif
 
-/** @def X86DESC_LIMIT
+/** @def X86DESC64_BASE
  * Return the base of a 64-bit descriptor.
  */
