Ignore:
Timestamp:
Aug 27, 2007, 9:54:05 PM (18 years ago)
Author:
bird
Message:

Use the new type system.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kStuff/kLdr/kLdrModLX.h

    r3537 r3567  
    2020struct e32_exe
    2121{
    22     uint8_t             e32_magic[2];
    23     uint8_t             e32_border;
    24     uint8_t             e32_worder;
    25     uint32_t            e32_level;
    26     uint16_t            e32_cpu;
    27     uint16_t            e32_os;
    28     uint32_t            e32_ver;
    29     uint32_t            e32_mflags;
    30     uint32_t            e32_mpages;
    31     uint32_t            e32_startobj;
    32     uint32_t            e32_eip;
    33     uint32_t            e32_stackobj;
    34     uint32_t            e32_esp;
    35     uint32_t            e32_pagesize;
    36     uint32_t            e32_pageshift;
     22    KU8                 e32_magic[2];
     23    KU8                 e32_border;
     24    KU8                 e32_worder;
     25    KU32                e32_level;
     26    KU16                e32_cpu;
     27    KU16                e32_os;
     28    KU32                e32_ver;
     29    KU32                e32_mflags;
     30    KU32                e32_mpages;
     31    KU32                e32_startobj;
     32    KU32                e32_eip;
     33    KU32                e32_stackobj;
     34    KU32                e32_esp;
     35    KU32                e32_pagesize;
     36    KU32                e32_pageshift;
    3737    /** The size of the fixup section.
    3838     * The fixup section consists of the fixup page table, the fixup record table,
    3939     * the import module table, and the import procedure name table.
    4040     */
    41     uint32_t            e32_fixupsize;
    42     uint32_t            e32_fixupsum;
     41    KU32                e32_fixupsize;
     42    KU32                e32_fixupsum;
    4343    /** The size of the resident loader section.
    4444     * This includes the object table, the object page map table, the resource table, the resident name table,
    4545     * the entry table, the module format directives table, and the page checksum table (?). */
    46     uint32_t            e32_ldrsize;
     46    KU32                e32_ldrsize;
    4747    /** The checksum of the loader section. 0 if not calculated. */
    48     uint32_t            e32_ldrsum;
     48    KU32                e32_ldrsum;
    4949    /** The offset of the object table relative to this structure. */
    50     uint32_t            e32_objtab;
     50    KU32                e32_objtab;
    5151    /** Count of objects. */
    52     uint32_t            e32_objcnt;
     52    KU32                e32_objcnt;
    5353    /** The offset of the object page map table relative to this structure. */
    54     uint32_t            e32_objmap;
     54    KU32                e32_objmap;
    5555    /** The offset of the object iterated pages (whatever this is used for) relative to the start of the file. */
    56     uint32_t            e32_itermap;
     56    KU32                e32_itermap;
    5757    /** The offset of the resource table relative to this structure. */
    58     uint32_t            e32_rsrctab;
     58    KU32                e32_rsrctab;
    5959    /** The number of entries in the resource table. */
    60     uint32_t            e32_rsrccnt;
     60    KU32                e32_rsrccnt;
    6161    /** The offset of the resident name table relative to this structure. */
    62     uint32_t            e32_restab;
     62    KU32                e32_restab;
    6363    /** The offset of the entry (export) table relative to this structure. */
    64     uint32_t            e32_enttab;
     64    KU32                e32_enttab;
    6565    /** The offset of the module format directives table relative to this structure. */
    66     uint32_t            e32_dirtab;
     66    KU32                e32_dirtab;
    6767    /** The number of entries in the module format directives table. */
    68     uint32_t            e32_dircnt;
     68    KU32                e32_dircnt;
    6969    /** The offset of the fixup page table relative to this structure. */
    70     uint32_t            e32_fpagetab;
     70    KU32                e32_fpagetab;
    7171    /** The offset of the fixup record table relative to this structure. */
    72     uint32_t            e32_frectab;
     72    KU32                e32_frectab;
    7373    /** The offset of the import module name table relative to this structure. */
    74     uint32_t            e32_impmod;
     74    KU32                e32_impmod;
    7575    /** The number of entries in the import module name table. */
    76     uint32_t            e32_impmodcnt;
     76    KU32                e32_impmodcnt;
    7777    /** The offset of the import procedure name table relative to this structure. */
    78     uint32_t            e32_impproc;
     78    KU32                e32_impproc;
    7979    /** The offset of the page checksum table relative to this structure. */
    80     uint32_t            e32_pagesum;
     80    KU32                e32_pagesum;
    8181    /** The offset of the data pages relative to the start of the file. */
    82     uint32_t            e32_datapage;
     82    KU32                e32_datapage;
    8383    /** The number of preload pages (ignored). */
    84     uint32_t            e32_preload;
     84    KU32                e32_preload;
    8585    /** The offset of the non-resident name table relative to the start of the file. */
    86     uint32_t            e32_nrestab;
     86    KU32                e32_nrestab;
    8787    /** The size of the non-resident name table. */
    88     uint32_t            e32_cbnrestab;
    89     uint32_t            e32_nressum;
    90     uint32_t            e32_autodata;
    91     uint32_t            e32_debuginfo;
    92     uint32_t            e32_debuglen;
    93     uint32_t            e32_instpreload;
    94     uint32_t            e32_instdemand;
    95     uint32_t            e32_heapsize;
    96     uint32_t            e32_stacksize;
    97     uint8_t             e32_res3[20];
     88    KU32                e32_cbnrestab;
     89    KU32                e32_nressum;
     90    KU32                e32_autodata;
     91    KU32                e32_debuginfo;
     92    KU32                e32_debuglen;
     93    KU32                e32_instpreload;
     94    KU32                e32_instdemand;
     95    KU32                e32_heapsize;
     96    KU32                e32_stacksize;
     97    KU8                 e32_res3[20];
    9898};
    9999
     
    113113#define E32BEWO         1
    114114/** e32_level */
    115 #define E32LEVEL        UINT32_C(0)
     115#define E32LEVEL        KU32_C(0)
    116116/** e32_cpu - 80286 */
    117117#define E32CPU286       1
     
    121121#define E32CPU486       3
    122122/** e32_pagesize */
    123 #define OBJPAGELEN      UINT32_C(0x1000)
     123#define OBJPAGELEN      KU32_C(0x1000)
    124124
    125125
     
    127127 * @{ */
    128128/** App Type: Fullscreen only. */
    129 #define E32NOPMW         UINT32_C(0x00000100)
     129#define E32NOPMW         KU32_C(0x00000100)
    130130/** App Type: PM API. */
    131 #define E32PMAPI         UINT32_C(0x00000300)
     131#define E32PMAPI         KU32_C(0x00000300)
    132132/** App Type: PM VIO compatible. */
    133 #define E32PMW           UINT32_C(0x00000200)
     133#define E32PMW           KU32_C(0x00000200)
    134134/** Application type mask. */
    135 #define E32APPMASK       UINT32_C(0x00000300)
     135#define E32APPMASK       KU32_C(0x00000300)
    136136/** Executable module. */
    137 #define E32MODEXE        UINT32_C(0x00000000)
     137#define E32MODEXE        KU32_C(0x00000000)
    138138/** Dynamic link library (DLL / library) module. */
    139 #define E32MODDLL        UINT32_C(0x00008000)
     139#define E32MODDLL        KU32_C(0x00008000)
    140140/** Protected memory DLL. */
    141 #define E32PROTDLL       UINT32_C(0x00010000)
     141#define E32PROTDLL       KU32_C(0x00010000)
    142142/** Physical Device Driver. */
    143 #define E32MODPDEV       UINT32_C(0x00020000)
     143#define E32MODPDEV       KU32_C(0x00020000)
    144144/** Virtual Device Driver. */
    145 #define E32MODVDEV       UINT32_C(0x00028000)
     145#define E32MODVDEV       KU32_C(0x00028000)
    146146/** Device driver */
    147147#define E32DEVICE        E32MODPDEV
     
    151151#define E32MODPROTDLL    (E32MODDLL | E32PROTDLL)
    152152/** Module Type mask. */
    153 #define E32MODMASK       UINT32_C(0x00038000)
     153#define E32MODMASK       KU32_C(0x00038000)
    154154/** Not loadable (linker error). */
    155 #define E32NOLOAD        UINT32_C(0x00002000)
     155#define E32NOLOAD        KU32_C(0x00002000)
    156156/** No internal fixups. */
    157 #define E32NOINTFIX      UINT32_C(0x00000010)
     157#define E32NOINTFIX      KU32_C(0x00000010)
    158158/** No external fixups (i.e. imports). */
    159 #define E32NOEXTFIX      UINT32_C(0x00000020)
     159#define E32NOEXTFIX      KU32_C(0x00000020)
    160160/** System DLL, no internal fixups. */
    161 #define E32SYSDLL        UINT32_C(0x00000008)
     161#define E32SYSDLL        KU32_C(0x00000008)
    162162/** Global (set) or per instance (cleared) library initialization. */
    163 #define E32LIBINIT       UINT32_C(0x00000004)
     163#define E32LIBINIT       KU32_C(0x00000004)
    164164/** Global (set) or per instance (cleared) library termination. */
    165 #define E32LIBTERM       UINT32_C(0x40000000)
     165#define E32LIBTERM       KU32_C(0x40000000)
    166166/** Indicates when set in an executable that the process isn't SMP safe. */
    167 #define E32NOTMPSAFE     UINT32_C(0x00080000)
     167#define E32NOTMPSAFE     KU32_C(0x00080000)
    168168/** @} */
    169169
     
    172172typedef union _offset
    173173{
    174     uint16_t            offset16;
    175     uint32_t            offset32;
     174    KU16                offset16;
     175    KU32                offset32;
    176176} offset;
    177177
     
    181181struct r32_rlc
    182182{
    183     uint8_t             nr_stype;
    184     uint8_t             nr_flags;
    185     int16_t             r32_soff;
    186     uint16_t            r32_objmod;
     183    KU8                 nr_stype;
     184    KU8                 nr_flags;
     185    KI16                r32_soff;
     186    KU16                r32_objmod;
    187187
    188188    union targetid
     
    192192        {
    193193            offset      proc;
    194             uint32_t    ord;
     194            KU32        ord;
    195195        } extref;
    196196        struct addfixup
    197197        {
    198             uint16_t    entry;
     198            KU16        entry;
    199199            offset      addval;
    200200        } addfix;
    201201    } r32_target;
    202     uint16_t            r32_srccount;
    203     uint16_t            r32_chain;
     202    KU16                r32_srccount;
     203    KU16                r32_chain;
    204204};
    205205
     
    256256{
    257257    /** The size of the object. */
    258     uint32_t            o32_size;
     258    KU32                o32_size;
    259259    /** The base address of the object. */
    260     uint32_t            o32_base;
     260    KU32                o32_base;
    261261    /** Object flags. */
    262     uint32_t            o32_flags;
     262    KU32                o32_flags;
    263263    /** Page map index. */
    264     uint32_t            o32_pagemap;
     264    KU32                o32_pagemap;
    265265    /** Page map size. (doesn't need to be o32_size >> page shift). */
    266     uint32_t            o32_mapsize;
     266    KU32                o32_mapsize;
    267267    /** Reserved */
    268     uint32_t            o32_reserved;
     268    KU32                o32_reserved;
    269269};
    270270
     
    272272 * @{ */
    273273/** Read access. */
    274 #define OBJREAD         UINT32_C(0x00000001)
     274#define OBJREAD         KU32_C(0x00000001)
    275275/** Write access. */
    276 #define OBJWRITE        UINT32_C(0x00000002)
     276#define OBJWRITE        KU32_C(0x00000002)
    277277/** Execute access. */
    278 #define OBJEXEC         UINT32_C(0x00000004)
     278#define OBJEXEC         KU32_C(0x00000004)
    279279/** Resource object. */
    280 #define OBJRSRC         UINT32_C(0x00000008)
     280#define OBJRSRC         KU32_C(0x00000008)
    281281/** The object is discarable (i.e. don't swap, just load in pages from the executable).
    282282 * This overlaps a bit with object type. */
    283 #define OBJDISCARD      UINT32_C(0x00000010)
     283#define OBJDISCARD      KU32_C(0x00000010)
    284284/** The object is shared. */
    285 #define OBJSHARED       UINT32_C(0x00000020)
     285#define OBJSHARED       KU32_C(0x00000020)
    286286/** The object has preload pages. */
    287 #define OBJPRELOAD      UINT32_C(0x00000040)
     287#define OBJPRELOAD      KU32_C(0x00000040)
    288288/** The object has invalid pages. */
    289 #define OBJINVALID      UINT32_C(0x00000080)
     289#define OBJINVALID      KU32_C(0x00000080)
    290290/** Non-permanent, link386 bug. */
    291 #define LNKNONPERM      UINT32_C(0x00000600)
     291#define LNKNONPERM      KU32_C(0x00000600)
    292292/** Non-permanent, correct 'value'. */
    293 #define OBJNONPERM      UINT32_C(0x00000000)
     293#define OBJNONPERM      KU32_C(0x00000000)
    294294/** Obj Type: The object is permanent and swappable. */
    295 #define OBJPERM         UINT32_C(0x00000100)
     295#define OBJPERM         KU32_C(0x00000100)
    296296/** Obj Type: The object is permanent and resident (i.e. not swappable). */
    297 #define OBJRESIDENT     UINT32_C(0x00000200)
     297#define OBJRESIDENT     KU32_C(0x00000200)
    298298/** Obj Type: The object is resident and contigious. */
    299 #define OBJCONTIG       UINT32_C(0x00000300)
     299#define OBJCONTIG       KU32_C(0x00000300)
    300300/** Obj Type: The object is permanent and long locable. */
    301 #define OBJDYNAMIC      UINT32_C(0x00000400)
     301#define OBJDYNAMIC      KU32_C(0x00000400)
    302302/** Object type mask. */
    303 #define OBJTYPEMASK     UINT32_C(0x00000700)
     303#define OBJTYPEMASK     KU32_C(0x00000700)
    304304/** x86: The object require an 16:16 alias. */
    305 #define OBJALIAS16      UINT32_C(0x00001000)
     305#define OBJALIAS16      KU32_C(0x00001000)
    306306/** x86: Big/Default selector setting, i.e. toggle 32-bit or 16-bit. */
    307 #define OBJBIGDEF       UINT32_C(0x00002000)
     307#define OBJBIGDEF       KU32_C(0x00002000)
    308308/** x86: conforming selector setting (weird stuff). */
    309 #define OBJCONFORM      UINT32_C(0x00004000)
     309#define OBJCONFORM      KU32_C(0x00004000)
    310310/** x86: IOPL. */
    311 #define OBJIOPL         UINT32_C(0x00008000)
     311#define OBJIOPL         KU32_C(0x00008000)
    312312/** @} */
    313313
     
    316316{
    317317    /** The file offset of the page. */
    318     uint32_t            o32_pagedataoffset;
     318    KU32                o32_pagedataoffset;
    319319    /** The number of bytes of raw page data. */
    320     uint16_t            o32_pagesize;
     320    KU16                o32_pagesize;
    321321    /** Per page flags describing how the page is encoded in the file. */
    322     uint16_t            o32_pageflags;
     322    KU16                o32_pageflags;
    323323};
    324324
     
    327327 */
    328328/** Raw page (uncompressed) in the file. */
    329 #define VALID           UINT16_C(0x0000)
     329#define VALID           KU16_C(0x0000)
    330330/** RLE encoded page in file. */
    331 #define ITERDATA        UINT16_C(0x0001)
     331#define ITERDATA        KU16_C(0x0001)
    332332/** Invalid page, nothing in the file. */
    333 #define INVALID         UINT16_C(0x0002)
     333#define INVALID         KU16_C(0x0002)
    334334/** Zero page, nothing in file. */
    335 #define ZEROED          UINT16_C(0x0003)
     335#define ZEROED          KU16_C(0x0003)
    336336/** range of pages (what is this?) */
    337 #define RANGE           UINT16_C(0x0004)
     337#define RANGE           KU16_C(0x0004)
    338338/** Compressed page in file. */
    339 #define ITERDATA2       UINT16_C(0x0005)
     339#define ITERDATA2       KU16_C(0x0005)
    340340/** @} */
    341341
     
    345345{
    346346    /** Number of iterations. */
    347     uint16_t            LX_nIter;
     347    KU16                LX_nIter;
    348348    /** The number of bytes that's being iterated. */
    349     uint16_t            LX_nBytes;
     349    KU16                LX_nBytes;
    350350    /** The bytes. */
    351     uint8_t             LX_Iterdata;
     351    KU8                 LX_Iterdata;
    352352};
    353353
     
    359359{
    360360    /** Resource Type. */
    361     uint16_t            type;
     361    KU16                type;
    362362    /** Resource ID. */
    363     uint16_t            name;
     363    KU16                name;
    364364    /** Resource size in bytes. */
    365     uint32_t            cb;
     365    KU32                cb;
    366366    /** The index of the object containing the resource. */
    367     uint16_t            obj;
     367    KU16                obj;
    368368    /** Offset of the resource that within the object. */
    369     uint32_t            offset;
     369    KU32                offset;
    370370};
    371371
     
    379379{
    380380    /** The number of entries. */
    381     uint8_t             b32_cnt;
     381    KU8                 b32_cnt;
    382382    /** The type of bundle. */
    383     uint8_t             b32_type;
     383    KU8                 b32_type;
    384384    /** The index of the object containing these entry points. */
    385     uint16_t            b32_obj;
     385    KU16                b32_obj;
    386386};
    387387
     
    407407{
    408408    /** Entry point flags */
    409     uint8_t             e32_flags;      /* Entry point flags */
     409    KU8                 e32_flags;      /* Entry point flags */
    410410    union entrykind
    411411    {
     
    416416        {
    417417            /** Offset into segment. */
    418             uint16_t    offset;
     418            KU16        offset;
    419419            /** The callgate selector */
    420             uint16_t    callgate;
     420            KU16        callgate;
    421421        } e32_callgate;
    422422        /** ENTRYFWD */
     
    424424        {
    425425            /** Module ordinal number (i.e. into the import module table). */
    426             uint16_t    modord;
     426            KU16        modord;
    427427            /** Procedure name or ordinal number. */
    428             uint32_t    value;
     428            KU32        value;
    429429        } e32_fwd;
    430430    } e32_variant;
Note: See TracChangeset for help on using the changeset viewer.