| 1 | /* $Id: OS2Krnl.h,v 1.13 2001-07-10 05:23:54 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 | 
 | 
|---|
| 15 | 
 | 
|---|
| 16 | /*
 | 
|---|
| 17 |  * "OS2KDefs.h"
 | 
|---|
| 18 |  */
 | 
|---|
| 19 | #if !defined(OS2_INCLUDED)
 | 
|---|
| 20 |     /* when used with h2inc.exe */
 | 
|---|
| 21 |     #define UCHAR   unsigned char
 | 
|---|
| 22 |     #define CHAR    char
 | 
|---|
| 23 |     #define USHORT  unsigned short
 | 
|---|
| 24 |     #define ULONG   unsigned long
 | 
|---|
| 25 |     #define PCHAR   char *
 | 
|---|
| 26 | #endif
 | 
|---|
| 27 | 
 | 
|---|
| 28 | /* undefine everything defined below to quite compiler */
 | 
|---|
| 29 | #undef  PAGESIZE
 | 
|---|
| 30 | #undef  PAGESUB1
 | 
|---|
| 31 | #undef  PAGEOFFSET
 | 
|---|
| 32 | #undef  PAGESTART
 | 
|---|
| 33 | #undef  PAGEALIGNUP
 | 
|---|
| 34 | #undef  PAGEALIGNDOWN
 | 
|---|
| 35 | #undef  PAGENEXT
 | 
|---|
| 36 | #undef  PAGESTART
 | 
|---|
| 37 | #undef  PAGESHIFT
 | 
|---|
| 38 | 
 | 
|---|
| 39 | #define PAGESHIFT                   12      /* bytes to pages or pages to bytes shift value. */
 | 
|---|
| 40 | #define PAGESIZE                    0x1000UL/* pagesize on i386 */
 | 
|---|
| 41 | #define PAGESUB1                    0x0FFFUL
 | 
|---|
| 42 | #define PAGEALIGNMASK               0xFFFFF000UL
 | 
|---|
| 43 | #define PAGEOFFSET(addr)     ((addr) &  PAGESUB1) /* Gets the offset into the page addr points into. */
 | 
|---|
| 44 | #define PAGEALIGNUP(addr)    (((addr) + PAGESUB1) & PAGEALIGNMASK)  /* Aligns upwards */
 | 
|---|
| 45 | #define PAGEALIGNDOWN(addr)  ((addr) &  PAGEALIGNMASK)              /* Aligns downwards */
 | 
|---|
| 46 | #define PAGESTART(addr)      PAGEALIGNDOWN(addr)
 | 
|---|
| 47 | #define PAGENEXT(addr)       PAGEALIGNUP(addr)
 | 
|---|
| 48 | 
 | 
|---|
| 49 | 
 | 
|---|
| 50 | /*
 | 
|---|
| 51 |  * Handles
 | 
|---|
| 52 |  */
 | 
|---|
| 53 | typedef USHORT HMTE, *PHMTE;            /* Module Table Entry (MTE) handle */
 | 
|---|
| 54 | typedef USHORT HPTDA, *PHPTDA;          /* Per-Task Data Area (PTDA) handle */
 | 
|---|
| 55 | #ifdef RING0
 | 
|---|
| 56 |     typedef USHORT SFN, *PSFN;          /* System File Number (SFN) - ie. file handle. */
 | 
|---|
| 57 | #else
 | 
|---|
| 58 |     #define SFN HFILE
 | 
|---|
| 59 |     #define PSFN PHFILE
 | 
|---|
| 60 | #endif
 | 
|---|
| 61 | 
 | 
|---|
| 62 | 
 | 
|---|
| 63 | 
 | 
|---|
| 64 | 
 | 
|---|
| 65 | /*
 | 
|---|
| 66 |  * Calling convention for 32-bit OS/2 Kernel functions.
 | 
|---|
| 67 |  */
 | 
|---|
| 68 | #define KRNLCALL __stdcall
 | 
|---|
| 69 | 
 | 
|---|
| 70 | /*
 | 
|---|
| 71 |  * Calling convention for Security Helpers.
 | 
|---|
| 72 |  */
 | 
|---|
| 73 | #define SECCALL  _System
 | 
|---|
| 74 | 
 | 
|---|
| 75 | /*
 | 
|---|
| 76 |  *
 | 
|---|
| 77 |  * Other Kernel Parts
 | 
|---|
| 78 |  *
 | 
|---|
| 79 |  */
 | 
|---|
| 80 | #ifdef INCL_OS2KRNL_ALL
 | 
|---|
| 81 |     #define INCL_OS2KRNL_IO
 | 
|---|
| 82 |     #define INCL_OS2KRNL_VM
 | 
|---|
| 83 |     #define INCL_OS2KRNL_SM
 | 
|---|
| 84 |     #define INCL_OS2KRNL_SEM
 | 
|---|
| 85 |     #define INCL_OS2KRNL_TK
 | 
|---|
| 86 |     #define INCL_OS2KRNL_PTDA
 | 
|---|
| 87 |     #define INCL_OS2KRNL_TCB
 | 
|---|
| 88 |     #define INCL_OS2KRNL_SEC
 | 
|---|
| 89 |     #define INCL_OS2KRNL_LDR
 | 
|---|
| 90 | #endif
 | 
|---|
| 91 | 
 | 
|---|
| 92 | #if defined(INCL_OS2KRNL_PTDA) && !defined(INCL_OS2KRNL_SEM)
 | 
|---|
| 93 |     #define INCL_OS2KRNL_SEM
 | 
|---|
| 94 | #endif
 | 
|---|
| 95 | 
 | 
|---|
| 96 | #ifdef INCL_OS2KRNL_IO
 | 
|---|
| 97 |     #include <OS2KIO.h>
 | 
|---|
| 98 | #endif
 | 
|---|
| 99 | 
 | 
|---|
| 100 | #ifdef INCL_OS2KRNL_VM
 | 
|---|
| 101 |     #include <OS2KVM.h>
 | 
|---|
| 102 | #endif
 | 
|---|
| 103 | 
 | 
|---|
| 104 | #ifdef INCL_OS2KRNL_PG
 | 
|---|
| 105 |     #include <OS2KPG.h>
 | 
|---|
| 106 | #endif
 | 
|---|
| 107 | 
 | 
|---|
| 108 | #ifdef INCL_OS2KRNL_SM
 | 
|---|
| 109 |     #include <OS2KSM.h>
 | 
|---|
| 110 | #endif
 | 
|---|
| 111 | 
 | 
|---|
| 112 | #ifdef INCL_OS2KRNL_SEM
 | 
|---|
| 113 |     #include <OS2KSEM.h>
 | 
|---|
| 114 | #endif
 | 
|---|
| 115 | 
 | 
|---|
| 116 | #ifdef INCL_OS2KRNL_PTDA
 | 
|---|
| 117 |     #include <OS2KPTDA.h>
 | 
|---|
| 118 | #endif
 | 
|---|
| 119 | 
 | 
|---|
| 120 | #ifdef INCL_OS2KRNL_TCB
 | 
|---|
| 121 |     #include <OS2KTCB.h>
 | 
|---|
| 122 | #endif
 | 
|---|
| 123 | 
 | 
|---|
| 124 | #ifdef INCL_OS2KRNL_TK
 | 
|---|
| 125 |     #include <OS2KTK.h>
 | 
|---|
| 126 | #endif
 | 
|---|
| 127 | 
 | 
|---|
| 128 | #ifdef INCL_OS2KRNL_LDR
 | 
|---|
| 129 |     #include <OS2KLDR.h>
 | 
|---|
| 130 | #endif
 | 
|---|
| 131 | 
 | 
|---|
| 132 | #ifdef INCL_OS2KRNL_SEC
 | 
|---|
| 133 |     #include <OS2KSEC.h>
 | 
|---|
| 134 | #endif
 | 
|---|
| 135 | 
 | 
|---|
| 136 | #endif
 | 
|---|