1 | /* $Id: kee.h,v 1.1.1.1 2003/07/02 13:56:58 eleph Exp $ */
|
---|
2 | /*
|
---|
3 | * OS/2 KEE API definitions
|
---|
4 | *
|
---|
5 | * (C) 1999-2000 Holger Veit
|
---|
6 | * (C) 2000-2002 InnoTek Systemberatung GmbH
|
---|
7 | *
|
---|
8 | * This program is free software; you can redistribute it and/or
|
---|
9 | * modify it under the terms of the GNU General Public License as
|
---|
10 | * published by the Free Software Foundation; either version 2 of
|
---|
11 | * the License, or (at your option) any later version.
|
---|
12 | *
|
---|
13 | * This program is distributed in the hope that it will be useful,
|
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | * GNU General Public License for more details.
|
---|
17 | *
|
---|
18 | * You should have received a copy of the GNU General Public
|
---|
19 | * License along with this program; if not, write to the Free
|
---|
20 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
|
---|
21 | * USA.
|
---|
22 | *
|
---|
23 | */
|
---|
24 |
|
---|
25 | #ifndef __KEE_H__
|
---|
26 | #define __KEE_H__
|
---|
27 |
|
---|
28 | #ifdef __cplusplus
|
---|
29 | extern "C" {
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | /* The spinlock data type. KEE spinlock functions either put 0 (unused)
|
---|
33 | * or 0xff (used) into the variable, and 0xff000000 when the lock is
|
---|
34 | * acquired.
|
---|
35 | */
|
---|
36 | typedef ULONG KEESpinLock;
|
---|
37 |
|
---|
38 | /*ordinal 10 */
|
---|
39 | APIRET APIENTRY KernAllocSpinLock(KEESpinLock* sl);
|
---|
40 |
|
---|
41 | /*ordinal 11*/
|
---|
42 | /* XXX I suppose this routine should receive a KEESpinLock*, but
|
---|
43 | * so far, it just returns NO_ERROR, and not even clearing the Spinlock
|
---|
44 | * ownership. I think this is a bug in 14.039F_SMP
|
---|
45 | */
|
---|
46 | APIRET APIENTRY KernFreeSpinLock(/*KEESpinLock* sl*/);
|
---|
47 |
|
---|
48 | /*ordinal 12*/
|
---|
49 | VOID APIENTRY KernAcquireSpinLock(KEESpinLock* sl);
|
---|
50 |
|
---|
51 | /*ordinal 13*/
|
---|
52 | VOID APIENTRY KernReleaseSpinLock(KEESpinLock* sl);
|
---|
53 |
|
---|
54 | typedef struct {
|
---|
55 | ULONG mtx[2];
|
---|
56 | } KEEMutexLock;
|
---|
57 |
|
---|
58 | /*ordinal 20*/
|
---|
59 | APIRET APIENTRY KernAllocMutexLock(KEEMutexLock* ml);
|
---|
60 |
|
---|
61 | /*ordinal 21*/
|
---|
62 | /* XXX Like ordinal 11, I think this should really do something. Actually,
|
---|
63 | * it just returns NO_ERROR. At least, it accesses the argument. But
|
---|
64 | * it doesn't do anything. Again, likely an error in 14.039F_SMP
|
---|
65 | */
|
---|
66 | APIRET APIENTRY KernFreeMutexLock(KEEMutexLock* ml);
|
---|
67 |
|
---|
68 | /*ordinal 22*/
|
---|
69 | VOID APIENTRY KernRequestSharedMutex(KEEMutexLock* ml);
|
---|
70 |
|
---|
71 | /*ordinal 23*/
|
---|
72 | VOID APIENTRY KernReleaseSharedMutex(KEEMutexLock* ml);
|
---|
73 |
|
---|
74 | /*ordinal 24*/
|
---|
75 | INT APIENTRY KernTryRequestSharedMutex(KEEMutexLock* ml);
|
---|
76 |
|
---|
77 | /*ordinal 25*/
|
---|
78 | VOID APIENTRY KernRequestExclusiveMutex(KEEMutexLock* ml);
|
---|
79 |
|
---|
80 | /*ordinal 26*/
|
---|
81 | VOID APIENTRY KernReleaseExclusiveMutex(KEEMutexLock* ml);
|
---|
82 |
|
---|
83 | /*ordinal 27*/
|
---|
84 | INT APIENTRY KernTryRequestExclusiveMutex(KEEMutexLock* ml);
|
---|
85 |
|
---|
86 | #define KEE_BLOCK_NOSIGNALS 0x00000001
|
---|
87 | #define KEE_BLOCK_SPINLOCK 0x00000002
|
---|
88 | #define KEE_BLOCK_EXMUTEXLOCK 0x00000004
|
---|
89 | #define KEE_BLOCK_SHMUTEXLOCK 0x00000008
|
---|
90 | #define KEE_BLOCK_NOACQUIRE 0x00000010
|
---|
91 |
|
---|
92 | /*ordinal 30*/
|
---|
93 | APIRET APIENTRY KernBlock(ULONG id, ULONG timeout, ULONG flags,
|
---|
94 | PVOID ptr, PULONG retdata);
|
---|
95 |
|
---|
96 | #define KEE_WAKE_SINGLE 0x00000001
|
---|
97 | #define KEE_WAKE_PRIOINCR 0x00000004
|
---|
98 | #define KEE_WAKE_RETDATA 0x00000008
|
---|
99 |
|
---|
100 | /*ordinal 31*/
|
---|
101 | APIRET APIENTRY KernWakeup(ULONG id, ULONG flags, PULONG ptr, ULONG retdata);
|
---|
102 |
|
---|
103 | /*ordinal 40*/
|
---|
104 | // Returns: flat base of kernel stack in eax
|
---|
105 | //NOTE: esp and ebp are modified when this function returns
|
---|
106 | // --> can cause problems if compiler uses i.e. ebp for storing a value!!
|
---|
107 | ULONG APIENTRY KernThunkStackTo16(VOID);
|
---|
108 |
|
---|
109 | /*ordinal 41*/
|
---|
110 | // Returns: flat base of kernel stack in edx
|
---|
111 | // 16 bits stack selector in eax (not during interrupts (bug??))
|
---|
112 | //NOTE: esp and ebp are modified when this function returns
|
---|
113 | // --> can cause problems if compiler uses i.e. ebp for storing a value!!
|
---|
114 |
|
---|
115 | #ifdef __WATCOMC__
|
---|
116 | ULONG KernThunkStackTo32(VOID);
|
---|
117 | #pragma aux KernThunkStackTo32 "KernThunkStackTo32" modify exact [eax ecx edx] value [edx];
|
---|
118 | #else
|
---|
119 | ULONG APIENTRY KernThunkStackTo32(VOID);
|
---|
120 | #endif
|
---|
121 |
|
---|
122 |
|
---|
123 | /*ordinal 42*/
|
---|
124 | VOID APIENTRY KernSerialize16BitDD(VOID);
|
---|
125 |
|
---|
126 | /*ordinal 43*/
|
---|
127 | VOID APIENTRY KernUnserialize16BitDD(VOID);
|
---|
128 |
|
---|
129 | /*ordinal 44*/
|
---|
130 | VOID APIENTRY KernArmHook(ULONG hook,ULONG data);
|
---|
131 |
|
---|
132 | /*ordinal 45*/
|
---|
133 | APIRET APIENTRY KernAllocateContextHook(PVOID pfHandler,ULONG dummy,
|
---|
134 | PULONG pHook);
|
---|
135 |
|
---|
136 | /*ordinal 50*/
|
---|
137 | APIRET APIENTRY KernCopyIn(PVOID trgt, PVOID src, ULONG size);
|
---|
138 |
|
---|
139 | /*ordinal 51*/
|
---|
140 | APIRET APIENTRY KernCopyOut(PVOID trgt, PVOID src, ULONG size);
|
---|
141 |
|
---|
142 |
|
---|
143 | /* same bits as with DevHlp_VMAlloc, see explanation there */
|
---|
144 | #define KEE_VMA_16MB 0x00000001
|
---|
145 | #define KEE_VMA_FIXED 0x00000002
|
---|
146 | #define KEE_VMA_SWAP 0x00000004
|
---|
147 | #define KEE_VMA_CONTIG 0x00000008
|
---|
148 | #define KEE_VMA_PHYS 0x00000010
|
---|
149 | #define KEE_VMA_PROCESS 0x00000020
|
---|
150 | #define KEE_VMA_SGSCONT 0x00000040
|
---|
151 | #define KEE_VMA_GETSEL 0x00000080
|
---|
152 | #define KEE_VMA_RESERVE 0x00000100
|
---|
153 | #define KEE_VMA_SHARED 0x00000400
|
---|
154 | #define KEE_VMA_USEHIGHMEM 0x00000800
|
---|
155 |
|
---|
156 | /*ordinal 60*/
|
---|
157 | APIRET APIENTRY KernVMAlloc(ULONG size, ULONG flags, PVOID* linaddr,
|
---|
158 | PVOID* physaddr, PSHORT sel);
|
---|
159 |
|
---|
160 | /*ordinal 61*/
|
---|
161 | APIRET APIENTRY KernVMFree(PVOID linaddr);
|
---|
162 |
|
---|
163 | /* this is the lockhandle, like with DevHlp_VMLock */
|
---|
164 | typedef struct {
|
---|
165 | UCHAR lock[12];
|
---|
166 | } KEEVMLock;
|
---|
167 |
|
---|
168 | /* this is a page list element, like PageList_s in 16 bit Devhlp */
|
---|
169 | typedef struct {
|
---|
170 | ULONG addr;
|
---|
171 | ULONG size;
|
---|
172 | } KEEVMPageList;
|
---|
173 |
|
---|
174 | /* the same bits as with DevHlp_VMLock */
|
---|
175 | #define KEE_VML_NOTBLOCK 0x00000001
|
---|
176 | #define KEE_VML_CONTIG 0x00000002
|
---|
177 | #define KEE_VML_16M 0x00000004
|
---|
178 | #define KEE_VML_WRITEABLE 0x00000008
|
---|
179 | #define KEE_VML_LONGLOCK 0x00000010
|
---|
180 | #define KEE_VML_VERIFYONLY 0x00000020
|
---|
181 | #define KEE_VML_unknown 0x80000000
|
---|
182 |
|
---|
183 | /*ordinal 62*/
|
---|
184 | APIRET APIENTRY KernVMLock(ULONG flags,PVOID linaddr,ULONG size,
|
---|
185 | KEEVMLock* lock, KEEVMPageList* pglist,
|
---|
186 | PULONG pgsize);
|
---|
187 |
|
---|
188 | /*ordinal 63*/
|
---|
189 | APIRET APIENTRY KernVMUnlock(KEEVMLock* lock);
|
---|
190 |
|
---|
191 | /*ordinal 64*/
|
---|
192 | APIRET APIENTRY KernLinToPageList(PVOID linaddr,ULONG size,KEEVMPageList* list, ULONG *pgcnt);
|
---|
193 |
|
---|
194 | #define KEE_VMS_UNCOMMIT 0x00000001
|
---|
195 | #define KEE_VMS_RESIDENT 0x00000002
|
---|
196 | #define KEE_VMS_SWAPPABLE 0x00000004
|
---|
197 |
|
---|
198 | /*ordinal 65*/
|
---|
199 | APIRET APIENTRY KernVMSetMem(ULONG flags, PVOID linaddr, ULONG size);
|
---|
200 |
|
---|
201 | /*ordinal 66*/
|
---|
202 | ULONG KernSelToFlat(ULONG addr16);
|
---|
203 |
|
---|
204 | /*ordinal 70*/
|
---|
205 | APIRET APIENTRY KernDynamicAPI(PVOID addr, ULONG cnt, ULONG dummy, PUSHORT sel);
|
---|
206 |
|
---|
207 | /*ordinal 80*/
|
---|
208 | APIRET APIENTRY KernRASSysTrace(ULONG major,ULONG minor,PVOID buf, ULONG size);
|
---|
209 |
|
---|
210 | /*ordinal 81*/
|
---|
211 | APIRET APIENTRY KernPerfSysTrace(ULONG major,ULONG minor,PVOID buf, ULONG size);
|
---|
212 |
|
---|
213 | /* this is actually a pointer to the SFT entry for the file */
|
---|
214 | typedef ULONG KEEhfile;
|
---|
215 |
|
---|
216 | /*ordinal 100*/
|
---|
217 | APIRET APIENTRY KernLockFile(HFILE hfd,KEEhfile* khfd);
|
---|
218 |
|
---|
219 | /*ordinal 101*/
|
---|
220 | APIRET APIENTRY KernUnLockFile(KEEhfile khfd);
|
---|
221 |
|
---|
222 | /* this is the file size as returned by ordinal 102 */
|
---|
223 | typedef QWORD KEEfilesize;
|
---|
224 |
|
---|
225 | /*ordinal 102*/
|
---|
226 | APIRET APIENTRY KernGetFileSize(KEEhfile khfd,KEEfilesize* sz);
|
---|
227 |
|
---|
228 | /*ordinal 103*/
|
---|
229 | APIRET APIENTRY KernTestFileCache(KEEhfile khfd);
|
---|
230 |
|
---|
231 | /*ordinal 104*/
|
---|
232 | APIRET APIENTRY KernReadFileAt(KEEhfile khfd,PVOID buf, QWORD off,
|
---|
233 | ULONG nbytes, PULONG nread);
|
---|
234 |
|
---|
235 | typedef struct {
|
---|
236 | ULONG pagelistsz;
|
---|
237 | KEEVMPageList* pagelist;
|
---|
238 | ULONG physlistsz;
|
---|
239 | KEEVMPageList* physlist;
|
---|
240 | } KEECachePages;
|
---|
241 |
|
---|
242 | /*ordinal 105*/
|
---|
243 | APIRET APIENTRY KernReadFileAtCache(KEEhfile khfd,KEECachePages** ptr,
|
---|
244 | QWORD off, ULONG nbytes, PULONG nread);
|
---|
245 |
|
---|
246 | /*ordinal 106*/
|
---|
247 | APIRET APIENTRY KernReturnFileCache(KEEhfile khfd,KEECachePages* ptr);
|
---|
248 |
|
---|
249 | typedef struct {
|
---|
250 | ULONG data[8];
|
---|
251 | } KEEUnicodeStruct;
|
---|
252 |
|
---|
253 | /*ordinal 120*/
|
---|
254 | APIRET APIENTRY KernCreateUconvObject(USHORT codepage, KEEUnicodeStruct* ucs);
|
---|
255 |
|
---|
256 | /*ordinal 121*/
|
---|
257 | APIRET APIENTRY KernStrFromUcs(KEEUnicodeStruct* ucs, PCHAR trgt,
|
---|
258 | PCHAR usrc, ULONG trgtsize, ULONG srcsize);
|
---|
259 | /*ordinal 122*/
|
---|
260 | APIRET APIENTRY KernStrToUcs(KEEUnicodeStruct* ucs, PCHAR utrgt, PCHAR src,
|
---|
261 | ULONG trgtsize,ULONG srcsize);
|
---|
262 |
|
---|
263 | #ifdef __cplusplus
|
---|
264 | }
|
---|
265 | #endif
|
---|
266 |
|
---|
267 |
|
---|
268 | #endif
|
---|