VirtualBox

Changeset 19304 in vbox for trunk/include/VBox


Ignore:
Timestamp:
May 3, 2009 1:18:29 AM (16 years ago)
Author:
vboxsync
Message:

VBox/x86.h: gate descriptors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/x86.h

    r18763 r19304  
    19001900
    19011901/**
     1902 * Descriptor attributes.
     1903 */
     1904typedef struct X86DESCATTRBITS
     1905{
     1906    /** Segment Type. */
     1907    unsigned    u4Type : 4;
     1908    /** Descriptor Type. System(=0) or code/data selector */
     1909    unsigned    u1DescType : 1;
     1910    /** Descriptor Privelege level. */
     1911    unsigned    u2Dpl : 2;
     1912    /** Flags selector present(=1) or not. */
     1913    unsigned    u1Present : 1;
     1914    /** Segment limit 16-19. */
     1915    unsigned    u4LimitHigh : 4;
     1916    /** Available for system software. */
     1917    unsigned    u1Available : 1;
     1918    /** 32 bits mode: Reserved - 0, long mode: Long Attribute Bit. */
     1919    unsigned    u1Long : 1;
     1920    /** This flags meaning depends on the segment type. Try make sense out
     1921     * of the intel manual yourself.  */
     1922    unsigned    u1DefBig : 1;
     1923    /** Granularity of the limit. If set 4KB granularity is used, if
     1924     * clear byte. */
     1925    unsigned    u1Granularity : 1;
     1926} X86DESCATTRBITS;
     1927
     1928
     1929#pragma pack(1)
     1930typedef union X86DESCATTR
     1931{
     1932    /** Unsigned integer view. */
     1933    uint32_t           u;
     1934    /** Normal view. */
     1935    X86DESCATTRBITS    n;
     1936} X86DESCATTR;
     1937#pragma pack()
     1938/** Pointer to descriptor attributes. */
     1939typedef X86DESCATTR *PX86DESCATTR;
     1940/** Pointer to const descriptor attributes. */
     1941typedef const X86DESCATTR *PCX86DESCATTR;
     1942
     1943
     1944/**
    19021945 * Generic descriptor table entry
    19031946 */
     
    19081951    unsigned    u16LimitLow : 16;
    19091952    /** Base address - lowe word.
    1910      * Don't try set this to 24 because MSC is doing studing things then. */
     1953     * Don't try set this to 24 because MSC is doing stupid things then. */
    19111954    unsigned    u16BaseLow : 16;
    19121955    /** Base address - first 8 bits of high word. */
     
    19411984typedef const X86DESCGENERIC *PCX86DESCGENERIC;
    19421985
    1943 
    1944 /**
    1945  * Descriptor attributes.
    1946  */
    1947 typedef struct X86DESCATTRBITS
    1948 {
     1986/**
     1987 * Call-, Interrupt-, Trap- or Task-gate descriptor (legacy).
     1988 */
     1989typedef struct X86DESCGATE
     1990{
     1991    /** Target code segment offset - Low word.
     1992     * Ignored if task-gate. */
     1993    unsigned    u16OffsetLow : 16;
     1994    /** Target code segment selector for call-, interrupt- and trap-gates,
     1995     * TSS selector if task-gate. */
     1996    unsigned    u16Sel : 16;
     1997    /** Number of parameters for a call-gate.
     1998     * Ignored if interrupt-, trap- or task-gate. */
     1999    unsigned    u4ParmCount : 4;
     2000    /** Reserved / ignored. */
     2001    unsigned    u4Reserved : 4;
    19492002    /** Segment Type. */
    19502003    unsigned    u4Type : 4;
    1951     /** Descriptor Type. System(=0) or code/data selector */
     2004    /** Descriptor Type (0 = system). */
    19522005    unsigned    u1DescType : 1;
    19532006    /** Descriptor Privelege level. */
     
    19552008    /** Flags selector present(=1) or not. */
    19562009    unsigned    u1Present : 1;
    1957     /** Segment limit 16-19. */
    1958     unsigned    u4LimitHigh : 4;
    1959     /** Available for system software. */
    1960     unsigned    u1Available : 1;
    1961     /** 32 bits mode: Reserved - 0, long mode: Long Attribute Bit. */
    1962     unsigned    u1Long : 1;
    1963     /** This flags meaning depends on the segment type. Try make sense out
    1964      * of the intel manual yourself.  */
    1965     unsigned    u1DefBig : 1;
    1966     /** Granularity of the limit. If set 4KB granularity is used, if
    1967      * clear byte. */
    1968     unsigned    u1Granularity : 1;
    1969 } X86DESCATTRBITS;
    1970 
    1971 
    1972 #pragma pack(1)
    1973 typedef union X86DESCATTR
    1974 {
    1975     /** Unsigned integer view. */
    1976     uint32_t           u;
    1977     /** Normal view. */
    1978     X86DESCATTRBITS    n;
    1979 } X86DESCATTR;
    1980 #pragma pack()
    1981 
    1982 /** Pointer to descriptor attributes. */
    1983 typedef X86DESCATTR *PX86DESCATTR;
    1984 /** Pointer to const descriptor attributes. */
    1985 typedef const X86DESCATTR *PCX86DESCATTR;
    1986 
     2010    /** Target code segment offset - High word.
     2011     * Ignored if task-gate. */
     2012    unsigned    u16OffsetHigh : 16;
     2013} X86DESCGATE;
     2014AssertCompileSize(X86DESCGATE, 8);
     2015/** Pointer to a Call-, Interrupt-, Trap- or Task-gate descriptor entry. */
     2016typedef X86DESCGATE *PX86DESCGATE;
     2017/** Pointer to a const Call-, Interrupt-, Trap- or Task-gate descriptor entry. */
     2018typedef const X86DESCGATE *PCX86DESCGATE;
    19872019
    19882020/**
     
    19942026    /** Generic descriptor view. */
    19952027    X86DESCGENERIC  Gen;
    1996 #if 0
    1997     /** IDT view. */
    1998     VBOXIDTE        Idt;
    1999 #endif
     2028    /** Gate descriptor view. */
     2029    X86DESCGATE     Gate;
    20002030
    20012031    /** 8 bit unsigned interger view. */
     
    20062036    uint32_t        au32[2];
    20072037} X86DESC;
     2038AssertCompileSize(X86DESC, 8);
    20082039#pragma pack()
    20092040/** Pointer to descriptor table entry. */
     
    20122043typedef const X86DESC *PCX86DESC;
    20132044
    2014 
    20152045/** @def X86DESC_BASE
    20162046 * Return the base address of a descriptor.
     
    20382068    unsigned    u16LimitLow : 16;
    20392069    /** Base address - lowe word. - *IGNORED*
    2040      * Don't try set this to 24 because MSC is doing studing things then. */
     2070     * Don't try set this to 24 because MSC is doing stupid things then. */
    20412071    unsigned    u16BaseLow : 16;
    20422072    /** Base address - first 8 bits of high word. - *IGNORED* */
     
    20782108/**
    20792109 * System descriptor table entry (64 bits)
     2110 *
     2111 * @remarks This is, save a couple of comments, identical to X86DESC64GENERIC...
    20802112 */
    20812113#pragma pack(1)
     
    20852117    unsigned    u16LimitLow     : 16;
    20862118    /** Base address - lowe word.
    2087      * Don't try set this to 24 because MSC is doing studing things then. */
     2119     * Don't try set this to 24 because MSC is doing stupid things then. */
    20882120    unsigned    u16BaseLow      : 16;
    20892121    /** Base address - first 8 bits of high word. */
     
    21182150} X86DESC64SYSTEM;
    21192151#pragma pack()
    2120 /** Pointer to a generic descriptor entry. */
     2152/** Pointer to a system descriptor entry. */
    21212153typedef X86DESC64SYSTEM *PX86DESC64SYSTEM;
    2122 /** Pointer to a const generic descriptor entry. */
     2154/** Pointer to a const system descriptor entry. */
    21232155typedef const X86DESC64SYSTEM *PCX86DESC64SYSTEM;
     2156
     2157/**
     2158 * Call-, Interrupt-, Trap- or Task-gate descriptor (64-bit).
     2159 */
     2160typedef struct X86DESC64GATE
     2161{
     2162    /** Target code segment offset - Low word. */
     2163    unsigned    u16OffsetLow : 16;
     2164    /** Target code segment selector. */
     2165    unsigned    u16Sel : 16;
     2166    /** Interrupt stack table for interrupt- and trap-gates.
     2167     * Ignored by call-gates. */
     2168    unsigned    u3IST : 3;
     2169    /** Reserved / ignored. */
     2170    unsigned    u5Reserved : 5;
     2171    /** Segment Type. */
     2172    unsigned    u4Type : 4;
     2173    /** Descriptor Type (0 = system). */
     2174    unsigned    u1DescType : 1;
     2175    /** Descriptor Privelege level. */
     2176    unsigned    u2Dpl : 2;
     2177    /** Flags selector present(=1) or not. */
     2178    unsigned    u1Present : 1;
     2179    /** Target code segment offset - High word.
     2180     * Ignored if task-gate. */
     2181    unsigned    u16OffsetHigh : 16;
     2182    /** Target code segment offset - Top dword.
     2183     * Ignored if task-gate. */
     2184    unsigned    u32OffsetTop : 32;
     2185    /** Reserved / ignored / must be zero.
     2186     * For call-gates bits 8 thru 12 must be zero, the other gates ignores this. */
     2187    unsigned    u32Reserved : 32;
     2188} X86DESC64GATE;
     2189AssertCompileSize(X86DESC64GATE, 16);
     2190/** Pointer to a Call-, Interrupt-, Trap- or Task-gate descriptor entry. */
     2191typedef X86DESC64GATE *PX86DESC64GATE;
     2192/** Pointer to a const Call-, Interrupt-, Trap- or Task-gate descriptor entry. */
     2193typedef const X86DESC64GATE *PCX86DESC64GATE;
    21242194
    21252195
     
    21342204    /** System descriptor view. */
    21352205    X86DESC64SYSTEM     System;
    2136 #if 0
     2206    /** Gate descriptor view. */
    21372207    X86DESC64GATE       Gate;
    2138 #endif
    21392208
    21402209    /** 8 bit unsigned interger view. */
     
    21472216    uint64_t            au64[2];
    21482217} X86DESC64;
     2218AssertCompileSize(X86DESC64, 16);
    21492219#pragma pack()
    21502220/** Pointer to descriptor table entry. */
     
    21612231#endif
    21622232
    2163 /** @def X86DESC_LIMIT
     2233/** @def X86DESC64_BASE
    21642234 * Return the base of a 64-bit descriptor.
    21652235 */
Note: See TracChangeset for help on using the changeset viewer.

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