| 1 | /* $Id: OS2Krnl.h,v 1.7 2000-02-15 23:39:19 bird Exp $
|
|---|
| 2 | *
|
|---|
| 3 | * OS/2 kernel structures, typedefs and macros.
|
|---|
| 4 | *
|
|---|
| 5 | * Top-level include file.
|
|---|
| 6 | *
|
|---|
| 7 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 8 | *
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 | #ifndef _OS2Krnl_h_
|
|---|
| 12 | #define _OS2Krnl_h_
|
|---|
| 13 |
|
|---|
| 14 | #if !defined(OS2_INCLUDED)
|
|---|
| 15 | /* when used with h2inc.exe */
|
|---|
| 16 | #define UCHAR unsigned char
|
|---|
| 17 | #define CHAR char
|
|---|
| 18 | #define USHORT unsigned short
|
|---|
| 19 | #define ULONG unsigned long
|
|---|
| 20 | #define PCHAR char *
|
|---|
| 21 | #endif
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 | #pragma pack(1)
|
|---|
| 25 |
|
|---|
| 26 | #ifdef RING0
|
|---|
| 27 | typedef USHORT SFN, *PSFN; /* system file number */
|
|---|
| 28 | #else
|
|---|
| 29 | #define SFN HFILE
|
|---|
| 30 | #define PSFN PHFILE
|
|---|
| 31 | #endif
|
|---|
| 32 |
|
|---|
| 33 | typedef struct OTE
|
|---|
| 34 | {
|
|---|
| 35 | ULONG ote_size; /* Object virtual size */
|
|---|
| 36 | ULONG ote_base; /* Object base virtual address */
|
|---|
| 37 | ULONG ote_flags; /* Attribute flags */
|
|---|
| 38 | ULONG ote_pagemap; /* Object page map index */
|
|---|
| 39 | ULONG ote_mapsize; /* Num of entries in obj page map */
|
|---|
| 40 | /*ULONG ote_reserved;*/
|
|---|
| 41 | USHORT ote_sel; /* Object Selector */
|
|---|
| 42 | USHORT ote_hob; /* Object Handle */
|
|---|
| 43 | } OTE, *POTE;
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 | /* ote_flags */
|
|---|
| 47 | #ifndef __EXE386__
|
|---|
| 48 | #define OBJREAD 0x00000001L /* Readable Object */
|
|---|
| 49 | #define OBJWRITE 0x00000002L /* Writeable Object */
|
|---|
| 50 | #define OBJEXEC 0x00000004L /* Executable Object */
|
|---|
| 51 | #define OBJRSRC 0x00000008L /* Resource Object */
|
|---|
| 52 | #define OBJDISCARD 0x00000010L /* Object is Discardable */
|
|---|
| 53 | #define OBJSHARED 0x00000020L /* Object is Shared */
|
|---|
| 54 | #define OBJPRELOAD 0x00000040L /* Object has preload pages */
|
|---|
| 55 | #define OBJINVALID 0x00000080L /* Object has invalid pages */
|
|---|
| 56 | #endif
|
|---|
| 57 | #define OBJZEROFIL 0x00000100L /* Object has zero-filled pages */
|
|---|
| 58 | #ifndef __EXE386__
|
|---|
| 59 | #define OBJRESIDENT 0x00000200L /* Object is resident */
|
|---|
| 60 | #define OBJCONTIG 0x00000300L /* Object is resident and contiguous */
|
|---|
| 61 | #define OBJDYNAMIC 0x00000400L /* Object is permanent and long locable */
|
|---|
| 62 | #define OBJTYPEMASK 0x00000700L /* Object type mask */
|
|---|
| 63 | #define OBJALIAS16 0x00001000L /* 16:16 alias required */
|
|---|
| 64 | #define OBJBIGDEF 0x00002000L /* Big/Default bit setting */
|
|---|
| 65 | #define OBJCONFORM 0x00004000L /* Object is conforming for code */
|
|---|
| 66 | #define OBJIOPL 0x00008000L /* Object I/O privilege level */
|
|---|
| 67 | #endif
|
|---|
| 68 | #define OBJMADEPRIV 0x40000000L /* Object is made private for debug (now obsolete) */
|
|---|
| 69 | #define OBJALLOC 0x80000000L /* Object is allocated used by loader */
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 | /*************************/
|
|---|
| 77 | /* warp 3.0 AS SMTEs */
|
|---|
| 78 | /* Swap ModuleTableEntry */
|
|---|
| 79 | /*************************/
|
|---|
| 80 | typedef struct SMTE
|
|---|
| 81 | {
|
|---|
| 82 | /* lxheader fields */
|
|---|
| 83 | /*- magic,border,worder,level,cpu,os,ver,mflags */
|
|---|
| 84 | ULONG smte_mpages; /* 00 Module # pages */
|
|---|
| 85 | ULONG smte_startobj; /* 04 Object # for instruction */
|
|---|
| 86 | ULONG smte_eip; /* 08 Extended instruction pointer */
|
|---|
| 87 | ULONG smte_stackobj; /* 0c Object # for stack pointer */
|
|---|
| 88 | ULONG smte_esp; /* 10 Extended stack pointer */
|
|---|
| 89 | /*- pagesize*/
|
|---|
| 90 | ULONG smte_pageshift; /* 14 Page alignment shift in .EXE */
|
|---|
| 91 | ULONG smte_fixupsize; /* 18 Fixup section size */
|
|---|
| 92 | /*- fixupsum,ldrsize,ldrsum*/
|
|---|
| 93 | POTE smte_objtab; /* 1c Object table offset - POINTER */
|
|---|
| 94 | ULONG smte_objcnt; /* 20 Number of objects in module */
|
|---|
| 95 | ULONG smte_objmap; /* 24 Object page map offset - POINTER */
|
|---|
| 96 | ULONG smte_itermap; /* 28 Object iterated data map offset */
|
|---|
| 97 | ULONG smte_rsrctab; /* 2c Offset of Resource Table */
|
|---|
| 98 | ULONG smte_rsrccnt; /* 30 Number of resource entries */
|
|---|
| 99 | ULONG smte_restab; /* 34 Offset of resident name table - POINTER */
|
|---|
| 100 | ULONG smte_enttab; /* 38 Offset of Entry Table - POINTER */
|
|---|
| 101 | ULONG smte_fpagetab; /* 3c Offset of Fixup Page Table - POINTER */
|
|---|
| 102 | ULONG smte_frectab; /* 40 Offset of Fixup Record Table - POINTER */
|
|---|
| 103 | ULONG smte_impmod; /* 44 Offset of Import Module Name Table - POINTER */
|
|---|
| 104 | /*- impmodcnt*/
|
|---|
| 105 | ULONG smte_impproc; /* 48 Offset of Imp Procedure Name Tab - POINTER */
|
|---|
| 106 | /*- pagesum*/
|
|---|
| 107 | ULONG smte_datapage; /* 4c Offset of Enumerated Data Pages */
|
|---|
| 108 | /*- preload*/
|
|---|
| 109 | ULONG smte_nrestab; /* 50 Offset of Non-resident Names Table */
|
|---|
| 110 | ULONG smte_cbnrestab; /* 54 Size of Non-resident Name Table */
|
|---|
| 111 | /*- nressum*/
|
|---|
| 112 | ULONG smte_autods; /* 58 Object # for automatic data object */
|
|---|
| 113 | ULONG smte_debuginfo; /* 5c Offset of the debugging info */
|
|---|
| 114 | ULONG smte_debuglen; /* 60 The len of the debug info in */
|
|---|
| 115 | /*- instpreload,instdemand*/
|
|---|
| 116 | ULONG smte_heapsize; /* 64 use for converted 16-bit modules */
|
|---|
| 117 | /*- res3*/
|
|---|
| 118 | /* extra */
|
|---|
| 119 | PCHAR smte_path; /* 68 full pathname - POINTER */
|
|---|
| 120 | USHORT smte_semcount; /* 6c Count of threads waiting on MTE semaphore. 0 => semaphore is free */
|
|---|
| 121 | USHORT smte_semowner; /* 6e Slot number of the owner of MTE semahore */
|
|---|
| 122 | ULONG smte_pfilecache; /* 70 Pointer to file cache for Dos32CacheModule */
|
|---|
| 123 | ULONG smte_stacksize; /* 74 Thread 1 Stack size from the exe header */
|
|---|
| 124 | USHORT smte_alignshift; /* 78 use for converted 16-bit modules */
|
|---|
| 125 | USHORT smte_NEexpver; /* 7a expver from NE header */
|
|---|
| 126 | USHORT smte_pathlen; /* 7c length of full pathname */
|
|---|
| 127 | USHORT smte_NEexetype; /* 7e exetype from NE header */
|
|---|
| 128 | USHORT smte_csegpack; /* 80 count of segs to pack */
|
|---|
| 129 | } SMTE, *PSMTE;
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 | /********************/
|
|---|
| 139 | /* warp 3.0 GA MTEs */
|
|---|
| 140 | /* ModuleTableEntry */
|
|---|
| 141 | /********************/
|
|---|
| 142 | typedef struct MTE
|
|---|
| 143 | {
|
|---|
| 144 | USHORT mte_flags2;
|
|---|
| 145 | USHORT mte_handle;
|
|---|
| 146 | PSMTE mte_swapmte; /* handle for swapmte */
|
|---|
| 147 | struct MTE * mte_link;
|
|---|
| 148 | ULONG mte_flags1;
|
|---|
| 149 | ULONG mte_impmodcnt; /* number of entries in Import Module Name Table*/
|
|---|
| 150 | SFN mte_sfn; /*"filehandle"*/
|
|---|
| 151 | USHORT mte_usecnt; /* (.EXE only) - use count */
|
|---|
| 152 | CHAR mte_modname[8];
|
|---|
| 153 | } MTE,*PMTE,**PPMTE;
|
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
|
|---|
| 157 | /***********/
|
|---|
| 158 | /* flags 1 */
|
|---|
| 159 | /***********/
|
|---|
| 160 | #define NOAUTODS 0x00000000 /* No Auto DS exists */
|
|---|
| 161 | #define SOLO 0x00000001 /* Auto DS is shared */
|
|---|
| 162 | #define INSTANCEDS 0x00000002 /* Auto DS is not shared */
|
|---|
| 163 | #define INSTLIBINIT 0x00000004 /* Perinstance Libinit */
|
|---|
| 164 | #define GINISETUP 0x00000008 /* Global Init has been setup */
|
|---|
| 165 | #define NOINTERNFIXUPS 0x00000010 /* internal fixups in .EXE.DLL applied */
|
|---|
| 166 | #define NOEXTERNFIXUPS 0x00000020 /* external fixups in .EXE.DLL applied */
|
|---|
| 167 | #define CLASS_PROGRAM 0x00000040 /* Program class */
|
|---|
| 168 | #define CLASS_GLOBAL 0x00000080 /* Global class */
|
|---|
| 169 | #define CLASS_SPECIFIC 0x000000C0 /* Specific class, as against global */
|
|---|
| 170 | #define CLASS_ALL 0x00000000 /* nonspecific class all modules */
|
|---|
| 171 | #define CLASS_MASK 0x000000C0 /* */
|
|---|
| 172 | #define MTEPROCESSED 0x00000100 /* MTE being loaded */
|
|---|
| 173 | #define USED 0x00000200 /* MTE is referenced see ldrgc.c */
|
|---|
| 174 | #define DOSLIB 0x00000400 /* set if DOSCALL1 */
|
|---|
| 175 | #define DOSMOD 0x00000800 /* set if DOSCALLS */
|
|---|
| 176 | #define MTE_MEDIAFIXED 0x00001000 /* File Media permits discarding */
|
|---|
| 177 | #define LDRINVALID 0x00002000 /* module not loadable */
|
|---|
| 178 | #define PROGRAMMOD 0x00000000 /* program module */
|
|---|
| 179 | #define DEVDRVMOD 0x00004000 /* device driver module */
|
|---|
| 180 | #define LIBRARYMOD 0x00008000 /* DLL module */
|
|---|
| 181 | #define VDDMOD 0x00010000 /* VDD module */
|
|---|
| 182 | #define MVDMMOD 0x00020000 /* Set if VDD Helper MTE (MVDM.DLL) */
|
|---|
| 183 | #define INGRAPH 0x00040000 /* In Module Graph see ldrgc.c */
|
|---|
| 184 | #define GINIDONE 0x00080000 /* Global Init has finished */
|
|---|
| 185 | #define MTEADDRALLOCED 0x00100000 /* Allocate specific or not */
|
|---|
| 186 | #define FSDMOD 0x00200000 /* FSD MTE */
|
|---|
| 187 | #define FSHMOD 0x00400000 /* FS helper MTE */
|
|---|
| 188 | #define MTELONGNAMES 0x00800000 /* Module supports longnames */
|
|---|
| 189 | #define MTE_MEDIACONTIG 0x01000000 /* File Media contiguous memory req */
|
|---|
| 190 | #define MTE_MEDIA16M 0x02000000 /* File Media requires mem below 16M */
|
|---|
| 191 | #define MTESWAPONLOAD 0x04000000 /* make code pages swap on load */
|
|---|
| 192 | #define MTEPORTHOLE 0x08000000 /* porthole module */
|
|---|
| 193 | #define MTEMODPROT 0x10000000 /* Module has shared memory protected */
|
|---|
| 194 | #define MTENEWMOD 0x20000000 /* Newly added module */
|
|---|
| 195 | #define MTEDLLTERM 0x40000000 /* Gets instance termination */
|
|---|
| 196 | #define MTESYMLOADED 0x80000000 /* Set if debugger symbols loaded */
|
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 | /***********/
|
|---|
| 200 | /* flags 2 */
|
|---|
| 201 | /***********/
|
|---|
| 202 | #define MTEFORMATMASK 0x0003 /* Module format mask */
|
|---|
| 203 | #define MTEFORMATR1 0x0000 /* Module format reserved */
|
|---|
| 204 | #define MTEFORMATNE 0x0001 /* Module format NE */
|
|---|
| 205 | #define MTEFORMATLX 0x0002 /* Module format LX */
|
|---|
| 206 | #define MTEFORMATR2 0x0003 /* Module format reserved */
|
|---|
| 207 | #define MTESYSTEMDLL 0x0004 /* DLL exists in system list */
|
|---|
| 208 | #define MTELOADORATTACH 0x0008 /* Module under load or attach for init */
|
|---|
| 209 | #define MTECIRCLEREF 0x0010 /* Module circular reference detection */
|
|---|
| 210 | #define MTEFREEFIXUPS 0x0020 /* Free system mte's fixup flag d#98488 */
|
|---|
| 211 | #define MTEPRELOADED 0x0040 /* MTE Preload completed */
|
|---|
| 212 | #define MTEGETMTEDONE 0x0080 /* GetMTE already resolved */
|
|---|
| 213 | #define MTEPACKSEGDONE 0x0100 /* Segment packed memory allocated */
|
|---|
| 214 | #define MTE20LIELIST 0x0200 /* Name present in version20 lie list */
|
|---|
| 215 | #define MTESYSPROCESSED 0x0400 /* System DLL already processed */
|
|---|
| 216 | #define MTEDLLONEXTLST 0x1000 /* DLL has term routine on exit list #74177 */
|
|---|
| 217 |
|
|---|
| 218 |
|
|---|
| 219 |
|
|---|
| 220 |
|
|---|
| 221 |
|
|---|
| 222 | #pragma pack()
|
|---|
| 223 |
|
|---|
| 224 | /*
|
|---|
| 225 | * Calling convention for 32-bit OS/2 Kernel functions.
|
|---|
| 226 | */
|
|---|
| 227 | #define KRNLCALL __stdcall
|
|---|
| 228 |
|
|---|
| 229 | /*
|
|---|
| 230 | *
|
|---|
| 231 | * Other Kernel Parts
|
|---|
| 232 | *
|
|---|
| 233 | */
|
|---|
| 234 | #ifdef INCL_OS2KRNL_ALL
|
|---|
| 235 | #define INCL_OS2KRNL_IO
|
|---|
| 236 | #define INCL_OS2KRNL_VM
|
|---|
| 237 | #endif
|
|---|
| 238 |
|
|---|
| 239 | #ifdef INCL_OS2KRNL_IO
|
|---|
| 240 | #include <OS2KIO.h>
|
|---|
| 241 | #endif
|
|---|
| 242 |
|
|---|
| 243 | #ifdef INCL_OS2KRNL_VM
|
|---|
| 244 | #include <OS2KVM.h>
|
|---|
| 245 | #endif
|
|---|
| 246 |
|
|---|
| 247 | #endif
|
|---|