| 1 | /* $Id: OS2Krnl.h,v 1.5 2002-12-19 01:49:06 bird Exp $
|
|---|
| 2 | *
|
|---|
| 3 | * OS/2 kernel structures, typedefs and macros.
|
|---|
| 4 | * Top-level include file.
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright (c) 1999-2003 knut st. osmundsen <bird@anduin.net>
|
|---|
| 7 | *
|
|---|
| 8 | *
|
|---|
| 9 | * This file is part of kKrnlLib.
|
|---|
| 10 | *
|
|---|
| 11 | * kKrnlLib is free software; you can redistribute it and/or modify
|
|---|
| 12 | * it under the terms of the GNU General Public License as published by
|
|---|
| 13 | * the Free Software Foundation; either version 2 of the License, or
|
|---|
| 14 | * (at your option) any later version.
|
|---|
| 15 | *
|
|---|
| 16 | * kKrnlLib is distributed in the hope that it will be useful,
|
|---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 19 | * GNU General Public License for more details.
|
|---|
| 20 | *
|
|---|
| 21 | * You should have received a copy of the GNU General Public License
|
|---|
| 22 | * along with kKrnlLib; if not, write to the Free Software
|
|---|
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 24 | *
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 | #ifndef _OS2Krnl_h_
|
|---|
| 28 | #define _OS2Krnl_h_
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 | /*******************************************************************************
|
|---|
| 33 | * Header Files *
|
|---|
| 34 | *******************************************************************************/
|
|---|
| 35 | /*
|
|---|
| 36 | * "OS2KDefs.h"
|
|---|
| 37 | */
|
|---|
| 38 | /* NOASM */
|
|---|
| 39 | #include <os2def.h>
|
|---|
| 40 | /* ASM */
|
|---|
| 41 | #if !defined(OS2_INCLUDED)
|
|---|
| 42 | /* when used with h2inc.exe */
|
|---|
| 43 | #define UCHAR unsigned char
|
|---|
| 44 | #define CHAR char
|
|---|
| 45 | #define USHORT unsigned short
|
|---|
| 46 | #define ULONG unsigned long
|
|---|
| 47 | #define PCHAR char *
|
|---|
| 48 | #endif
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 | /*******************************************************************************
|
|---|
| 52 | * Defined Constants And Macros *
|
|---|
| 53 | *******************************************************************************/
|
|---|
| 54 | /* undefine everything defined below to quite compiler */
|
|---|
| 55 | #undef PAGESIZE
|
|---|
| 56 | #undef PAGESUB1
|
|---|
| 57 | #undef PAGEOFFSET
|
|---|
| 58 | #undef PAGESTART
|
|---|
| 59 | #undef PAGEALIGNUP
|
|---|
| 60 | #undef PAGEALIGNDOWN
|
|---|
| 61 | #undef PAGENEXT
|
|---|
| 62 | #undef PAGESTART
|
|---|
| 63 | #undef PAGESHIFT
|
|---|
| 64 |
|
|---|
| 65 | #define PAGESHIFT 12 /* bytes to pages or pages to bytes shift value. */
|
|---|
| 66 | #define PAGESIZE 0x1000UL/* pagesize on i386 */
|
|---|
| 67 | #define PAGESUB1 0x0FFFUL
|
|---|
| 68 | #define PAGEALIGNMASK 0xFFFFF000UL
|
|---|
| 69 | #define PAGEOFFSET(addr) ((addr) & PAGESUB1) /* Gets the offset into the page addr points into. */
|
|---|
| 70 | #define PAGEALIGNUP(addr) (((addr) + PAGESUB1) & PAGEALIGNMASK) /* Aligns upwards */
|
|---|
| 71 | #define PAGEALIGNDOWN(addr) ((addr) & PAGEALIGNMASK) /* Aligns downwards */
|
|---|
| 72 | #define PAGESTART(addr) PAGEALIGNDOWN(addr)
|
|---|
| 73 | #define PAGENEXT(addr) PAGEALIGNUP(addr)
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 | /*
|
|---|
| 77 | * Handles
|
|---|
| 78 | */
|
|---|
| 79 | typedef USHORT HMTE, *PHMTE; /* Module Table Entry (MTE) handle */
|
|---|
| 80 | typedef USHORT HPTDA, *PHPTDA; /* Per-Task Data Area (PTDA) handle */
|
|---|
| 81 | #ifdef RING0
|
|---|
| 82 | typedef USHORT SFN, *PSFN; /* System File Number (SFN) - ie. file handle. */
|
|---|
| 83 | #else
|
|---|
| 84 | #define SFN HFILE
|
|---|
| 85 | #define PSFN PHFILE
|
|---|
| 86 | #endif
|
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 | /*
|
|---|
| 92 | * Calling convention for 32-bit OS/2 Kernel functions.
|
|---|
| 93 | */
|
|---|
| 94 | #define KRNLCALL __stdcall
|
|---|
| 95 |
|
|---|
| 96 | /*
|
|---|
| 97 | * Calling convention for Security Helpers.
|
|---|
| 98 | */
|
|---|
| 99 | #define SECCALL _System
|
|---|
| 100 |
|
|---|
| 101 | /*
|
|---|
| 102 | *
|
|---|
| 103 | * Other Kernel Parts
|
|---|
| 104 | *
|
|---|
| 105 | */
|
|---|
| 106 | #ifdef INCL_OS2KRNL_ALL
|
|---|
| 107 | #define INCL_OS2KRNL_IO
|
|---|
| 108 | #define INCL_OS2KRNL_VM
|
|---|
| 109 | #define INCL_OS2KRNL_VMOWNER
|
|---|
| 110 | #define INCL_OS2KRNL_SEL
|
|---|
| 111 | #define INCL_OS2KRNL_SM
|
|---|
| 112 | #define INCL_OS2KRNL_SEM
|
|---|
| 113 | #define INCL_OS2KRNL_TK
|
|---|
| 114 | #define INCL_OS2KRNL_PTDA
|
|---|
| 115 | #define INCL_OS2KRNL_PG
|
|---|
| 116 | #define INCL_OS2KRNL_TCB
|
|---|
| 117 | #define INCL_OS2KRNL_SEC
|
|---|
| 118 | #define INCL_OS2KRNL_LDR
|
|---|
| 119 | #endif
|
|---|
| 120 |
|
|---|
| 121 | #if defined(INCL_OS2KRNL_PTDA) && !defined(INCL_OS2KRNL_SEM)
|
|---|
| 122 | #define INCL_OS2KRNL_SEM
|
|---|
| 123 | #endif
|
|---|
| 124 |
|
|---|
| 125 | #ifdef INCL_OS2KRNL_IO
|
|---|
| 126 | #include "OS2KIO.h"
|
|---|
| 127 | #endif
|
|---|
| 128 |
|
|---|
| 129 | #ifdef INCL_OS2KRNL_VM
|
|---|
| 130 | #include "OS2KVM.h"
|
|---|
| 131 | #endif
|
|---|
| 132 |
|
|---|
| 133 | #ifdef INCL_OS2KRNL_VMOWNER
|
|---|
| 134 | #include "OS2KOwn.h"
|
|---|
| 135 | #endif
|
|---|
| 136 |
|
|---|
| 137 | #ifdef INCL_OS2KRNL_SM
|
|---|
| 138 | #include "OS2KSM.h"
|
|---|
| 139 | #endif
|
|---|
| 140 |
|
|---|
| 141 | #ifdef INCL_OS2KRNL_SEM
|
|---|
| 142 | #include "OS2KSEM.h"
|
|---|
| 143 | #endif
|
|---|
| 144 |
|
|---|
| 145 | #ifdef INCL_OS2KRNL_PTDA
|
|---|
| 146 | #include "OS2KPTDA.h"
|
|---|
| 147 | #endif
|
|---|
| 148 |
|
|---|
| 149 | #ifdef INCL_OS2KRNL_TCB
|
|---|
| 150 | #include "OS2KTCB.h"
|
|---|
| 151 | #endif
|
|---|
| 152 |
|
|---|
| 153 | #ifdef INCL_OS2KRNL_PG
|
|---|
| 154 | #include "OS2KPG.h"
|
|---|
| 155 | #endif
|
|---|
| 156 |
|
|---|
| 157 | #ifdef INCL_OS2KRNL_SEL
|
|---|
| 158 | #include "OS2KSEL.h"
|
|---|
| 159 | #endif
|
|---|
| 160 |
|
|---|
| 161 | #ifdef INCL_OS2KRNL_TK
|
|---|
| 162 | #include "OS2KTK.h"
|
|---|
| 163 | #endif
|
|---|
| 164 |
|
|---|
| 165 | #ifdef INCL_OS2KRNL_LDR
|
|---|
| 166 | #include "OS2KLDR.h"
|
|---|
| 167 | #endif
|
|---|
| 168 |
|
|---|
| 169 | #ifdef INCL_OS2KRNL_SEC
|
|---|
| 170 | #include "OS2KSEC.h"
|
|---|
| 171 | #endif
|
|---|
| 172 |
|
|---|
| 173 | #endif
|
|---|