1 | /* $Id: DEVHELP.H,v 1.1.1.1 2003/07/02 13:56:58 eleph Exp $ */
|
---|
2 | /*
|
---|
3 | * OS/2 device driver APIs (DevHelp)
|
---|
4 | *
|
---|
5 | * (C) 2000-2002 InnoTek Systemberatung GmbH
|
---|
6 | * (C) 2000-2001 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
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 |
|
---|
26 |
|
---|
27 | // DevHelp.h
|
---|
28 | //
|
---|
29 | // Watcom C++ callable entry points to the OS/2 DevHlp interface.
|
---|
30 | //
|
---|
31 | // All of the DevHlp functions in this library are prefaced with the string
|
---|
32 | // "Dev" rather than "DevHlp_" which is used by the IBM DDK libraries. The
|
---|
33 | // names were made incompatible so that calls to the IBM DevHlp routines
|
---|
34 | // are not confused with calls to these routines (which may have different
|
---|
35 | // calling signatures). If you need the IBM calling signatures, just use
|
---|
36 | // some inline functions which call the Dev* functions.
|
---|
37 | //
|
---|
38 | // Also, the ordering of words in multi-word names has been changed so that
|
---|
39 | // the object of an operation is the first word, and the operation name is
|
---|
40 | // the second word. For example, "DevHlp_AllocPhys" has been renamed to
|
---|
41 | // "DevPhysAlloc".
|
---|
42 | //
|
---|
43 | // This DevHlp library does not include certain categories of DevHlps that
|
---|
44 | // are available in the IBM DDK. In particular, ABIOS specific functions
|
---|
45 | // (function codes 29h and 34h to 37h), monitors (function codes 31h to
|
---|
46 | // 35h), and some virtual memory functions (function codes 55h to 5Ah and
|
---|
47 | // 66h) are not (yet) supported. Also, functions which are no longer
|
---|
48 | // meaningful under OS/2 2.1, such as UnPhysToVirt and SetRomVector are not
|
---|
49 | // included either. However, some undocumented or only partially
|
---|
50 | // documented DevHlps such as the RAS tracing facility (DevSysTrace,
|
---|
51 | // function code 28h) are included in this library.
|
---|
52 | //
|
---|
53 | // History:
|
---|
54 | //
|
---|
55 | // Sep 30, 94 David Bollo Initial version
|
---|
56 |
|
---|
57 | // Prevent multiple inclusion
|
---|
58 | #if !defined(DevHelp_h)
|
---|
59 | #define DevHelp_h 1
|
---|
60 |
|
---|
61 | #if !defined(__WATCOMC__) || !defined(__cplusplus)
|
---|
62 | //#error Watcom C++ must be used for the inline DevHlp interface.
|
---|
63 | #endif
|
---|
64 |
|
---|
65 |
|
---|
66 | #include "devtype.h"
|
---|
67 | #include <stacktoflat.h>
|
---|
68 |
|
---|
69 |
|
---|
70 | // Calling conventions for device driver functions
|
---|
71 | //
|
---|
72 | //
|
---|
73 |
|
---|
74 | // Strategy call calling convention
|
---|
75 | #pragma aux STRATEGY parm [fs ebx];
|
---|
76 |
|
---|
77 | #pragma aux VDD __far loadds parm [ax] modify [bx cx dx si di];
|
---|
78 |
|
---|
79 | // Dynamic API calling convention
|
---|
80 | #pragma aux DYNAMIC __far loadds parm [si] value [ax];
|
---|
81 |
|
---|
82 | // Interface to the OS/2 Ring 0 Device Helper functions
|
---|
83 | //
|
---|
84 | //
|
---|
85 |
|
---|
86 | extern void DevHelp();
|
---|
87 | #pragma aux DevHelp "DevHlp"
|
---|
88 |
|
---|
89 | extern void DevHelp_ModifiedDS();
|
---|
90 | #pragma aux DevHelp_ModifiedDS "DevHlp_ModifiedDS"
|
---|
91 |
|
---|
92 | VOID DevCli // Disable interrupts
|
---|
93 | (
|
---|
94 | ); // Returns: Nothing
|
---|
95 |
|
---|
96 | #pragma aux DevCli = \
|
---|
97 | "cli";
|
---|
98 |
|
---|
99 | VOID DevSti // Enable interrupts
|
---|
100 | (
|
---|
101 | ); // Returns: Nothing
|
---|
102 |
|
---|
103 | #pragma aux DevSti = \
|
---|
104 | "sti";
|
---|
105 |
|
---|
106 | DWORD DevPushfCli();
|
---|
107 | #pragma aux DevPushfCli = \
|
---|
108 | "pushfd" \
|
---|
109 | "cli" \
|
---|
110 | "pop eax" \
|
---|
111 | value [eax];
|
---|
112 |
|
---|
113 | VOID DevPopf(DWORD cpuflags);
|
---|
114 | #pragma aux DevPopf = \
|
---|
115 | "push eax" \
|
---|
116 | "popfd" \
|
---|
117 | parm [eax];
|
---|
118 |
|
---|
119 | WORD16 DevBlock // Block the current thread
|
---|
120 | (
|
---|
121 | WORD32 Id, // Id to be used by DevRun call
|
---|
122 | WORD32 WaitMilliSec, // Milliseconds to wait for (-1 = forever)
|
---|
123 | BYTE InterruptableFlag // 0 if block is interruptable, else 1
|
---|
124 | ); // Returns: 0 = Ran, 1 = Timeout, 2 = Ctrl+C
|
---|
125 |
|
---|
126 | #pragma aux DevBlock = \
|
---|
127 | "mov bx, ax" \
|
---|
128 | "shr eax,16" \
|
---|
129 | "mov cx, di" \
|
---|
130 | "shr edi,16" \
|
---|
131 | "mov dl,04h" \
|
---|
132 | "call DevHelp" \
|
---|
133 | "setnz al" \
|
---|
134 | "setc bl" \
|
---|
135 | "inc al" \
|
---|
136 | "neg bl" \
|
---|
137 | "and al,bl" \
|
---|
138 | "xor ah,ah" \
|
---|
139 | modify [edx ebx ecx] \
|
---|
140 | parm [eax] [edi] [dh] \
|
---|
141 | value [ax];
|
---|
142 |
|
---|
143 |
|
---|
144 |
|
---|
145 | WORD16 DevRun // Run a blocked thread
|
---|
146 | (
|
---|
147 | WORD32 Id // Id used in DevBlock call
|
---|
148 | ); // Returns: Count of awakened threads
|
---|
149 |
|
---|
150 | #pragma aux DevRun = \
|
---|
151 | "mov bx, ax" \
|
---|
152 | "shr eax, 16" \
|
---|
153 | "mov dl,05h" \
|
---|
154 | "call DevHelp" \
|
---|
155 | modify [edx ebx] \
|
---|
156 | parm [eax] \
|
---|
157 | value [ax];
|
---|
158 |
|
---|
159 | WORD16 DevSegLock // Lock a segment down in memory
|
---|
160 | (
|
---|
161 | SEL Selector, // Selector of memory to lock down
|
---|
162 | WORD16 Type, // Type (0 = short, 1 = long, 3 = long & hi,
|
---|
163 | // 4 = short & verify)
|
---|
164 | WORD16 NoWaitFlag, // 0 to wait for lock or 1 to return immediately
|
---|
165 | HLOCK *Handle // Storage for segment lock handle
|
---|
166 | ); // Returns: 0 = success, 1 = error
|
---|
167 |
|
---|
168 | #pragma aux DevSegLock = \
|
---|
169 | "push edx" \
|
---|
170 | "mov bh,cl" \
|
---|
171 | "mov dl,13h" \
|
---|
172 | "call DevHelp" \
|
---|
173 | "setc cl" \
|
---|
174 | "xor ch,ch" \
|
---|
175 | "pop edx" \
|
---|
176 | "mov [edx],bx" \
|
---|
177 | "mov [edx+2],ax" \
|
---|
178 | parm [ax] [cx] [bx] [edx] \
|
---|
179 | modify [eax ebx] \
|
---|
180 | value [cx];
|
---|
181 |
|
---|
182 |
|
---|
183 |
|
---|
184 | WORD16 DevSegUnlock // Unlock a segment locked by DevSegLock
|
---|
185 | (
|
---|
186 | HLOCK Handle // Handle of locked segment
|
---|
187 | ); // Returns: 0 = success, other = error code
|
---|
188 |
|
---|
189 | #pragma aux DevSegUnlock = \
|
---|
190 | "mov bx, ax" \
|
---|
191 | "shr eax,16" \
|
---|
192 | "mov dl,14h" \
|
---|
193 | "call DevHelp" \
|
---|
194 | "setc dl" \
|
---|
195 | "xor dh,dh" \
|
---|
196 | "neg dx" \
|
---|
197 | "and ax,dx" \
|
---|
198 | modify [edx ebx] \
|
---|
199 | parm [eax] \
|
---|
200 | value [ax];
|
---|
201 |
|
---|
202 | #define VMDHL_NOBLOCK 0x0001
|
---|
203 | #define VMDHL_CONTIGUOUS 0x0002
|
---|
204 | #define VMDHL_16M 0x0004
|
---|
205 | #define VMDHL_WRITE 0x0008
|
---|
206 | #define VMDHL_LONG 0x0010
|
---|
207 | #define VMDHL_VERIFY 0x0020
|
---|
208 |
|
---|
209 | int DevVMLock
|
---|
210 | (
|
---|
211 | unsigned long flags,
|
---|
212 | unsigned long lin,
|
---|
213 | unsigned long length,
|
---|
214 | LINEAR pPageList,
|
---|
215 | LINEAR pLockHandle,
|
---|
216 | LINEAR pPageListCount
|
---|
217 | ); // Returns: 0 = success, 1 = error
|
---|
218 |
|
---|
219 | #pragma aux DevVMLock = \
|
---|
220 | "push edx" \
|
---|
221 | "mov dl,55h" \
|
---|
222 | "call DevHelp" \
|
---|
223 | "setc dl" \
|
---|
224 | "pop ebx" \
|
---|
225 | "mov dword ptr [ebx], eax" \
|
---|
226 | "xor eax, eax" \
|
---|
227 | "mov al, dl" \
|
---|
228 | parm [eax] [ebx] [ecx] [edi] [esi] [edx] \
|
---|
229 | modify [edx ebx] \
|
---|
230 | value [eax];
|
---|
231 |
|
---|
232 | #define VMDHA_16M 0x0001
|
---|
233 | #define VMDHA_FIXED 0x0002
|
---|
234 | #define VMDHA_SWAP 0x0004
|
---|
235 | #define VMDHA_CONTIG 0x0008
|
---|
236 | #define VMDHA_PHYS 0x0010
|
---|
237 | #define VMDHA_PROCESS 0x0020
|
---|
238 | #define VMDHA_SGSCONT 0x0040
|
---|
239 | #define VMDHA_RESERVE 0x0100
|
---|
240 | #define VMDHA_USEHIGHMEM 0x0800
|
---|
241 |
|
---|
242 | int DevVMAlloc(ULONG flags, ULONG size, LINEAR physaddr, LINEAR addr);
|
---|
243 | #pragma aux DevVMAlloc = \
|
---|
244 | "mov dl,57h" \
|
---|
245 | "call DevHelp" \
|
---|
246 | "setc dl" \
|
---|
247 | "mov dword ptr [esi], eax" \
|
---|
248 | "xor eax, eax" \
|
---|
249 | "mov al, dl" \
|
---|
250 | parm [eax] [ecx] [edi] [esi] \
|
---|
251 | modify [edx] \
|
---|
252 | value [eax];
|
---|
253 |
|
---|
254 | ULONG DevVMFree(LINEAR LinearAddr);
|
---|
255 | #pragma aux DevVMFree = \
|
---|
256 | "mov dl,58h" \
|
---|
257 | "call DevHelp" \
|
---|
258 | "setc dl" \
|
---|
259 | "xor eax, eax" \
|
---|
260 | "mov al, dl" \
|
---|
261 | parm [eax] \
|
---|
262 | modify [edx] \
|
---|
263 | value [eax];
|
---|
264 |
|
---|
265 | #define VMDHGP_WRITE 0x0001
|
---|
266 | #define VMDHGP_SELMAP 0x0002
|
---|
267 | #define VMDHGP_SGSCONTROL 0x0004
|
---|
268 | #define VMDHGP_4MEG 0x0008
|
---|
269 |
|
---|
270 | ULONG DevVMGlobalToProcess(ULONG Flags, LINEAR LinearAddr, ULONG Length,
|
---|
271 | LINEAR ProcessLinearAddr);
|
---|
272 | #pragma aux DevVMGlobalToProcess = \
|
---|
273 | "mov dl,5Ah" \
|
---|
274 | "call DevHelp" \
|
---|
275 | "setc dl" \
|
---|
276 | "mov dword ptr [edi], eax" \
|
---|
277 | "xor eax, eax" \
|
---|
278 | "mov al, dl" \
|
---|
279 | parm [eax] [ebx] [ecx] [edi]\
|
---|
280 | modify [edx] \
|
---|
281 | value [eax];
|
---|
282 |
|
---|
283 | #define VMDHPG_READONLY 0x0000
|
---|
284 | #define VMDHPG_WRITE 0x0001
|
---|
285 |
|
---|
286 | ULONG DevVMProcessToGlobal(ULONG Flags, LINEAR LinearAddr, ULONG Length,
|
---|
287 | LINEAR GlobalLinearAddr);
|
---|
288 | #pragma aux DevVMProcessToGlobal = \
|
---|
289 | "mov dl,59h" \
|
---|
290 | "call DevHelp" \
|
---|
291 | "setc dl" \
|
---|
292 | "mov dword ptr [edi], eax" \
|
---|
293 | "xor eax, eax" \
|
---|
294 | "mov al, dl" \
|
---|
295 | parm [eax] [ebx] [ecx] [edi] \
|
---|
296 | modify [edx] \
|
---|
297 | value [eax];
|
---|
298 |
|
---|
299 | #define VMDHS_DECOMMIT 0x0001
|
---|
300 | #define VMDHS_RESIDENT 0x0002
|
---|
301 | #define VMDHS_SWAP 0x0004
|
---|
302 |
|
---|
303 | ULONG DevVMSetMem(ULONG Flags, LINEAR LinearAddr, ULONG Size);
|
---|
304 | #pragma aux DevHelp_VMSetMem = \
|
---|
305 | "mov dl,66h" \
|
---|
306 | "call DevHelp" \
|
---|
307 | parm [eax] [ebx] [ecx] \
|
---|
308 | modify [edx] \
|
---|
309 | value [eax];
|
---|
310 |
|
---|
311 | ULONG DevVMUnLock(LINEAR pLockHandle);
|
---|
312 | #pragma aux DevVMUnLock = \
|
---|
313 | "mov dl,56h" \
|
---|
314 | "call DevHelp" \
|
---|
315 | "setc dl" \
|
---|
316 | "xor eax, eax" \
|
---|
317 | "mov al, dl" \
|
---|
318 | parm [esi] \
|
---|
319 | modify [edx] \
|
---|
320 | value [eax];
|
---|
321 |
|
---|
322 |
|
---|
323 | WORD16 DevPhysToVirt // Convert a physical address to a 16:16 address
|
---|
324 | (
|
---|
325 | PHYSICAL PhysAddr, // Physical address to convert
|
---|
326 | WORD16 Length, // Length of virtual segment
|
---|
327 | VIRTUAL FAR *VirtAddr // Storage for virtual address
|
---|
328 | ); // Returns: 0 = success, other = error code
|
---|
329 |
|
---|
330 | #pragma aux DevPhysToVirt = \
|
---|
331 | "xchg ax,bx" \
|
---|
332 | "mov dx,0115h" \
|
---|
333 | "call DevHelp" \
|
---|
334 | "setc dl" \
|
---|
335 | "xor dh,dh" \
|
---|
336 | "neg dx" \
|
---|
337 | "mov fs:[esi],di" \
|
---|
338 | "mov fs:[esi+2],es" \
|
---|
339 | "and ax,dx" \
|
---|
340 | modify [dx es di] \
|
---|
341 | parm [bx ax] [cx] [fs esi] \
|
---|
342 | value [ax];
|
---|
343 |
|
---|
344 |
|
---|
345 |
|
---|
346 | WORD16 DevVirtToPhys // Convert a locked 16:16 address to physical
|
---|
347 | (
|
---|
348 | VIRTUAL VirtAddr, // Virtual address to convert (must be locked)
|
---|
349 | PHYSICAL FAR *PhysAddr // Storage for physical address
|
---|
350 | ); // Returns: Nothing
|
---|
351 |
|
---|
352 | #pragma aux DevVirtToPhys = \
|
---|
353 | "push ecx" \
|
---|
354 | "push ds" \
|
---|
355 | "mov si, ax" \
|
---|
356 | "shr eax, 16" \
|
---|
357 | "mov ds, ax" \
|
---|
358 | "mov dl,16h" \
|
---|
359 | "call DevHelp_ModifiedDS" \
|
---|
360 | "setc dl" \
|
---|
361 | "xor dh,dh" \
|
---|
362 | "pop ds" \
|
---|
363 | "pop ecx" \
|
---|
364 | "mov fs:[ecx],bx" \
|
---|
365 | "mov fs:[ecx+2],ax" \
|
---|
366 | "mov ax,dx" \
|
---|
367 | modify [edx ebx esi] \
|
---|
368 | parm [eax] [fs ecx] \
|
---|
369 | value [ax];
|
---|
370 |
|
---|
371 |
|
---|
372 |
|
---|
373 | WORD16 DevPhysToUVirt // Convert a physical address to an LDT address
|
---|
374 | (
|
---|
375 | PHYSICAL PhysAddr, // Physical address to convert
|
---|
376 | WORD16 Length, // Length of virtual segment
|
---|
377 | BYTE Type, // Type (0 = code, 1 = data, 2 = free, 5 = video)
|
---|
378 | BYTE Tag, // Tag (only with type 5)
|
---|
379 | VIRTUAL FAR *VirtAddr // Storage for virtual address
|
---|
380 | ); // Returns: 0 = success, 1 = error
|
---|
381 |
|
---|
382 | #pragma aux DevPhysToUVirt = \
|
---|
383 | "push es" \
|
---|
384 | "push edi" \
|
---|
385 | "mov bx,ax" \
|
---|
386 | "shr eax, 16" \
|
---|
387 | "mov dl,17h" \
|
---|
388 | "call DevHelp" \
|
---|
389 | "setc dl" \
|
---|
390 | "xor dh,dh" \
|
---|
391 | "pop edi" \
|
---|
392 | "mov word ptr fs:[edi], bx" \
|
---|
393 | "mov word ptr fs:[edi+2], es" \
|
---|
394 | "pop es" \
|
---|
395 | modify [ebx eax] \
|
---|
396 | parm [eax] [cx] [dh] [si] [fs edi] \
|
---|
397 | value [dx];
|
---|
398 |
|
---|
399 |
|
---|
400 |
|
---|
401 | WORD16 DevPhysAlloc // Allocate a block of physical memory
|
---|
402 | (
|
---|
403 | WORD32 Size, // Size of memory to allocate
|
---|
404 | BYTE LoFlag, // Flag: 0 = above 1 MB, 1 = below 1 MB
|
---|
405 | PHYSICAL FAR *PhysAddr // Storage for address of memory block
|
---|
406 | ); // Returns: 0 = success, other = error code
|
---|
407 |
|
---|
408 | #pragma aux DevPhysAlloc = \
|
---|
409 | "mov bx, ax" \
|
---|
410 | "shr eax,16" \
|
---|
411 | "mov dl,18h" \
|
---|
412 | "call DevHelp" \
|
---|
413 | "setc dl" \
|
---|
414 | "xor dh,dh" \
|
---|
415 | "neg dx" \
|
---|
416 | "mov fs:[esi],bx" \
|
---|
417 | "mov fs:[esi+2],ax" \
|
---|
418 | "and ax,dx" \
|
---|
419 | modify [edx ebx] \
|
---|
420 | parm [eax] [dh] [fs esi] \
|
---|
421 | value [ax];
|
---|
422 |
|
---|
423 |
|
---|
424 |
|
---|
425 | WORD16 DevPhysFree // Free a block of physical memory
|
---|
426 | (
|
---|
427 | PHYSICAL PhysAddr // Address of memory block to be freed
|
---|
428 | ); // Returns: 0 = success, 1 = error
|
---|
429 |
|
---|
430 | #pragma aux DevPhysFree = \
|
---|
431 | "xchg ax,bx" \
|
---|
432 | "mov dl,19h" \
|
---|
433 | "call DevHelp" \
|
---|
434 | "setc dl" \
|
---|
435 | "xor dh,dh" \
|
---|
436 | parm [bx ax] \
|
---|
437 | value [dx];
|
---|
438 |
|
---|
439 |
|
---|
440 |
|
---|
441 | WORD16 DevIRQSet // Register an interrupt handler for an IRQ
|
---|
442 | (
|
---|
443 | WORD16 Handler, // Handler function entry-point
|
---|
444 | WORD16 IRQ, // IRQ Number to handle
|
---|
445 | BYTE SharableFlag // Sharable: 1 = sharable, 0 = exclusive
|
---|
446 | ); // Returns: 0 = success, other = error code
|
---|
447 |
|
---|
448 | #pragma aux DevIRQSet = \
|
---|
449 | "mov dl,1Bh" \
|
---|
450 | "call DevHelp" \
|
---|
451 | "setc dl" \
|
---|
452 | "xor dh,dh" \
|
---|
453 | "neg dx" \
|
---|
454 | "and ax,dx" \
|
---|
455 | modify [dl] \
|
---|
456 | parm [ax] [bx] [dh] \
|
---|
457 | value [ax];
|
---|
458 |
|
---|
459 |
|
---|
460 |
|
---|
461 | WORD16 DevIRQClear // Remove a registered IRQ handler
|
---|
462 | (
|
---|
463 | WORD16 IRQ // IRQ Number to release
|
---|
464 | ); // Returns: 0 = success, 1 = error
|
---|
465 |
|
---|
466 | #pragma aux DevIRQClear = \
|
---|
467 | "mov dl,1Ch" \
|
---|
468 | "call DevHelp" \
|
---|
469 | "setc dl" \
|
---|
470 | "xor dh,dh" \
|
---|
471 | parm [bx] \
|
---|
472 | value [dx];
|
---|
473 |
|
---|
474 | WORD16 DevVerifyAccess // Verify that the caller has access to memory
|
---|
475 | (
|
---|
476 | VIRTUAL Address, // Address of memory to verify
|
---|
477 | WORD16 Length, // Length of memory to verify
|
---|
478 | BYTE Type // Type of access (0 = read, 1 = read/write)
|
---|
479 | ); // Returns: 0 = success, 1 = error
|
---|
480 |
|
---|
481 | #pragma aux DevVerifyAccess = \
|
---|
482 | "mov di, ax" \
|
---|
483 | "shr eax, 16" \
|
---|
484 | "mov dl,27h" \
|
---|
485 | "call DevHelp" \
|
---|
486 | "setc dl" \
|
---|
487 | "xor dh,dh" \
|
---|
488 | modify [edx edi] \
|
---|
489 | parm [eax] [cx] [dh] \
|
---|
490 | value [dx];
|
---|
491 |
|
---|
492 |
|
---|
493 |
|
---|
494 | WORD16 DevAttachDD // Attach to another device driver for IDC
|
---|
495 | (
|
---|
496 | WORD32 DriverName, // Device driver name (from device header)
|
---|
497 | WORD32 IDCData // Storage for IDC data
|
---|
498 | ); // Returns: 0 = success, 1 = error
|
---|
499 |
|
---|
500 | #pragma aux DevAttachDD = \
|
---|
501 | "mov dl,2Ah" \
|
---|
502 | "call DevHelp" \
|
---|
503 | "setc dl" \
|
---|
504 | "xor dh,dh" \
|
---|
505 | parm [ebx] [edi] \
|
---|
506 | value [dx];
|
---|
507 |
|
---|
508 | WORD16 DevAllocGDTSel // Allocate GDT selectors at Init time
|
---|
509 | (
|
---|
510 | WORD32 SelectorArray, // Storage for allocated GDT selectors (16:16)
|
---|
511 | WORD16 Count // Number of GDT selectors to allocate
|
---|
512 | ); // Returns: 0 = success, other = error code
|
---|
513 |
|
---|
514 | #pragma aux DevAllocGDTSel = \
|
---|
515 | "push es" \
|
---|
516 | "mov eax, edi" \
|
---|
517 | "shr eax, 16" \
|
---|
518 | "mov es, ax" \
|
---|
519 | "mov dl,2Dh" \
|
---|
520 | "call DevHelp" \
|
---|
521 | "setc dl" \
|
---|
522 | "xor dh,dh" \
|
---|
523 | "neg dx" \
|
---|
524 | "and ax,dx" \
|
---|
525 | "pop es" \
|
---|
526 | modify [edx eax] \
|
---|
527 | parm [edi] [cx] \
|
---|
528 | value [ax];
|
---|
529 |
|
---|
530 |
|
---|
531 |
|
---|
532 |
|
---|
533 | WORD16 DevPhysToGDTSelector // Convert a 32 bit address to a GDT selector
|
---|
534 | (
|
---|
535 | PHYSICAL Address, // 32 bit physical address to convert
|
---|
536 | WORD16 Length, // Length of fabricated segment
|
---|
537 | SEL Selector // Selector to refer to 32 bit address
|
---|
538 | ); // Returns: 0 = success, other = error code
|
---|
539 |
|
---|
540 | #pragma aux DevPhysToGDTSelector = \
|
---|
541 | "mov ax, bx" \
|
---|
542 | "shr eax,16" \
|
---|
543 | "mov dl,2Eh" \
|
---|
544 | "call DevHelp" \
|
---|
545 | "setc dl" \
|
---|
546 | "xor dh,dh" \
|
---|
547 | "neg dx" \
|
---|
548 | "and ax,dx" \
|
---|
549 | modify [dx bx] \
|
---|
550 | parm [eax] [cx] [si] \
|
---|
551 | value [ax];
|
---|
552 |
|
---|
553 |
|
---|
554 |
|
---|
555 |
|
---|
556 | VOID DevEOI // Signal end of interrupt processing to PIC
|
---|
557 | (
|
---|
558 | WORD16 IRQ // IRQ number to end
|
---|
559 | ); // Returns: Nothing
|
---|
560 |
|
---|
561 | #pragma aux DevEOI = \
|
---|
562 | "mov dl,31h" \
|
---|
563 | "call DevHelp" \
|
---|
564 | modify [dl] \
|
---|
565 | parm [ax];
|
---|
566 |
|
---|
567 |
|
---|
568 | WORD16 DevRegisterPDD // Register driver for PDD-VDD communications
|
---|
569 | (
|
---|
570 | WORD32 Name, // Device driver name
|
---|
571 | WORD32 EntryPoint // Entry point for PDD-VDD communications
|
---|
572 | ); // Returns: 0 = success, 1 = error
|
---|
573 |
|
---|
574 | #pragma aux DevRegisterPDD = \
|
---|
575 | "push ds" \
|
---|
576 | "push es" \
|
---|
577 | "mov si,ax" \
|
---|
578 | "shr eax, 16" \
|
---|
579 | "mov ds, ax" \
|
---|
580 | "mov di, bx" \
|
---|
581 | "shr ebx, 16" \
|
---|
582 | "mov es, bx" \
|
---|
583 | "mov dl,50h" \
|
---|
584 | "call DevHelp" \
|
---|
585 | "setc dl" \
|
---|
586 | "xor dh,dh" \
|
---|
587 | "pop es" \
|
---|
588 | "pop ds" \
|
---|
589 | modify [esi edi ebx] \
|
---|
590 | parm [eax] [ebx] \
|
---|
591 | value [dx];
|
---|
592 |
|
---|
593 |
|
---|
594 |
|
---|
595 | WORD16 DevBeep // Generate a beep
|
---|
596 | (
|
---|
597 | WORD16 Frequency, // Beep pitch in hz
|
---|
598 | WORD16 Duration // Beep duration
|
---|
599 | ); // Returns: 0 = success, other = error code
|
---|
600 |
|
---|
601 | #pragma aux DevBeep = \
|
---|
602 | "mov dl,52h" \
|
---|
603 | "call DevHelp" \
|
---|
604 | "setc dl" \
|
---|
605 | "xor dh,dh" \
|
---|
606 | "neg dx" \
|
---|
607 | "and ax,dx" \
|
---|
608 | modify [dx] \
|
---|
609 | parm [bx] [cx] \
|
---|
610 | value [ax];
|
---|
611 |
|
---|
612 |
|
---|
613 |
|
---|
614 | WORD16 DevFreeGDTSel // Free an allocated GDT selector at task time
|
---|
615 | (
|
---|
616 | SEL Selector // Selector to free
|
---|
617 | ); // Returns: 0 = success, other = error code
|
---|
618 |
|
---|
619 | #pragma aux DevFreeGDTSel = \
|
---|
620 | "mov dl,53h" \
|
---|
621 | "call DevHelp" \
|
---|
622 | "setc dl" \
|
---|
623 | "xor dh,dh" \
|
---|
624 | "neg dx" \
|
---|
625 | "and ax,dx" \
|
---|
626 | modify [dx] \
|
---|
627 | parm [ax] \
|
---|
628 | value [ax];
|
---|
629 |
|
---|
630 | #define GDTSEL_R3CODE 0x0000 /*@V76282*/
|
---|
631 | #define GDTSEL_R3DATA 0x0001 /*@V76282*/
|
---|
632 | #define GDTSEL_R2CODE 0x0003 /*@V76282*/
|
---|
633 | #define GDTSEL_R2DATA 0x0004 /*@V76282*/
|
---|
634 | #define GDTSEL_R0CODE 0x0005 /*@V76282*/
|
---|
635 | #define GDTSEL_R0DATA 0x0006 /*@V76282*/
|
---|
636 |
|
---|
637 | /* GDTSEL_ADDR32 may be OR'd with above defines */ /*@V76282*/
|
---|
638 | #define GDTSEL_ADDR32 0x0080 /*@V76282*/
|
---|
639 |
|
---|
640 |
|
---|
641 | WORD16 DevPhysToGDTSel // Map a physical address to a GDT selector
|
---|
642 | (
|
---|
643 | PHYSICAL Address, // 32 bit physical address to convert
|
---|
644 | WORD32 Length, // Length of fabricated segment
|
---|
645 | SEL Selector, // Selector to refer to 32 bit address
|
---|
646 | BYTE Access // Descriptor access priviledges
|
---|
647 | ); // Returns: 0 = success, other = error code
|
---|
648 |
|
---|
649 | #pragma aux DevPhysToGDTSel = \
|
---|
650 | "and ecx,0000FFFFh" \
|
---|
651 | "mov dl,54h" \
|
---|
652 | "call DevHelp" \
|
---|
653 | "setc dl" \
|
---|
654 | "xor dh,dh" \
|
---|
655 | "neg dx" \
|
---|
656 | "and ax,dx" \
|
---|
657 | parm [eax] [ecx] [si] [dh] \
|
---|
658 | modify [ecx edx] \
|
---|
659 | value [ax];
|
---|
660 |
|
---|
661 |
|
---|
662 |
|
---|
663 | WORD16 DevVirtToLin // Convert a virtual address to linear
|
---|
664 | (
|
---|
665 | SEL Selector, // Selector to convert
|
---|
666 | WORD32 Offset, // Offset to convert
|
---|
667 | LINEAR FAR *Linear // Storage for linear address
|
---|
668 | ); // Returns: 0 = success, other = error code
|
---|
669 |
|
---|
670 | #pragma aux DevVirtToLin = \
|
---|
671 | "mov dl,5Bh" \
|
---|
672 | "call DevHelp" \
|
---|
673 | "setc dl" \
|
---|
674 | "mov fs:[edi], eax" \
|
---|
675 | "xor dh,dh" \
|
---|
676 | "neg dx" \
|
---|
677 | "and ax,dx" \
|
---|
678 | modify [edx] \
|
---|
679 | parm [ax] [esi] [fs edi] \
|
---|
680 | value [ax];
|
---|
681 |
|
---|
682 |
|
---|
683 | ULONG DevResetEventSem(ULONG hEvent, FARPTR16 pNumPosts);
|
---|
684 | #pragma aux DevResetEventSem = \
|
---|
685 | "mov dl,6Ah" \
|
---|
686 | "call DevHelp" \
|
---|
687 | "setc dl" \
|
---|
688 | "xor eax, eax" \
|
---|
689 | "mov al, dl" \
|
---|
690 | parm [eax] [edi] \
|
---|
691 | modify [edx] \
|
---|
692 | value [eax];
|
---|
693 |
|
---|
694 | ULONG DevCloseEventSem(ULONG hEvent);
|
---|
695 | #pragma aux DevCloseEventSem = \
|
---|
696 | "mov dl,68h" \
|
---|
697 | "call DevHelp" \
|
---|
698 | "setc dl" \
|
---|
699 | "xor eax, eax" \
|
---|
700 | "mov al, dl" \
|
---|
701 | parm [eax] \
|
---|
702 | modify [edx] \
|
---|
703 | value [eax];
|
---|
704 |
|
---|
705 | ULONG DevOpenEventSem(ULONG hEvent);
|
---|
706 | #pragma aux DevOpenEventSem = \
|
---|
707 | "mov dl,67h" \
|
---|
708 | "call DevHelp" \
|
---|
709 | "setc dl" \
|
---|
710 | "xor eax, eax" \
|
---|
711 | "mov al, dl" \
|
---|
712 | parm [eax] \
|
---|
713 | modify [edx] \
|
---|
714 | value [eax];
|
---|
715 |
|
---|
716 | ULONG DevPostEventSem(ULONG hEvent);
|
---|
717 | #pragma aux DevPostEventSem = \
|
---|
718 | "mov dl,69h" \
|
---|
719 | "call DevHelp" \
|
---|
720 | "setc dl" \
|
---|
721 | "xor eax, eax" \
|
---|
722 | "mov al, dl" \
|
---|
723 | parm [eax] \
|
---|
724 | modify [edx] \
|
---|
725 | value [eax];
|
---|
726 |
|
---|
727 | ULONG DevFreeCtxHook(ULONG HookHandle);
|
---|
728 | #pragma aux DevFreeCtxHook = \
|
---|
729 | "mov dl,64h", \
|
---|
730 | "call DevHelp" \
|
---|
731 | "setc dl" \
|
---|
732 | "xor eax, eax" \
|
---|
733 | "mov al, dl" \
|
---|
734 | parm [eax] \
|
---|
735 | modify [edx] \
|
---|
736 | value [eax];
|
---|
737 |
|
---|
738 | ULONG DevAllocateCtxHook(ULONG HookHandler, LINEAR HookHandle);
|
---|
739 | #pragma aux DevAllocateCtxHook = \
|
---|
740 | "mov ebx,-1" \
|
---|
741 | "mov dl,63h" \
|
---|
742 | "call DevHelp" \
|
---|
743 | "setc dl" \
|
---|
744 | "mov dword ptr [edi], eax" \
|
---|
745 | "xor eax, eax" \
|
---|
746 | "mov al, dl" \
|
---|
747 | parm [eax] [edi] \
|
---|
748 | modify [edx ebx] \
|
---|
749 | value [eax];
|
---|
750 |
|
---|
751 | ULONG DevArmCtxHook(ULONG HookData, ULONG HookHandle);
|
---|
752 | #pragma aux DevArmCtxHook = \
|
---|
753 | "mov ecx, -1" \
|
---|
754 | "mov dl,65h", \
|
---|
755 | "call DevHelp" \
|
---|
756 | "setc dl" \
|
---|
757 | "xor eax, eax" \
|
---|
758 | "mov al, dl" \
|
---|
759 | parm [eax] [ebx] \
|
---|
760 | modify [edx ecx] \
|
---|
761 | value [eax];
|
---|
762 |
|
---|
763 | typedef struct {
|
---|
764 | DWORD physaddr;
|
---|
765 | DWORD size;
|
---|
766 | } PAGELIST;
|
---|
767 |
|
---|
768 | ULONG DevPageListToLin(ULONG Size, PAGELIST NEAR *pPageList, LINEAR NEAR *LinearAddr);
|
---|
769 | #pragma aux DevPageListToLin = \
|
---|
770 | "mov dl,5Fh" \
|
---|
771 | "call DevHelp" \
|
---|
772 | "setc dl" \
|
---|
773 | "mov [esi], eax" \
|
---|
774 | "xor eax, eax" \
|
---|
775 | "mov al, dl" \
|
---|
776 | parm [ecx] [edi] [esi] \
|
---|
777 | modify [edx] \
|
---|
778 | value [eax];
|
---|
779 |
|
---|
780 | ULONG DevLinToPageList(LINEAR LinearAddr, ULONG Size, PAGELIST NEAR *pPageList);
|
---|
781 | #pragma aux DevLinToPageList = \
|
---|
782 | "mov dl,5Eh" \
|
---|
783 | "call DevHelp" \
|
---|
784 | "setc dl" \
|
---|
785 | "xor eax, eax" \
|
---|
786 | "mov al, dl" \
|
---|
787 | parm [eax] [ecx] [edi] \
|
---|
788 | modify [edx] \
|
---|
789 | value [eax];
|
---|
790 |
|
---|
791 | ULONG DevHelp_LinToGDTSelector(SEL Selector, LINEAR LinearAddr, ULONG Size);
|
---|
792 | #pragma aux DevHelp_LinToGDTSelector = \
|
---|
793 | "mov dl,5Ch" \
|
---|
794 | "call DevHelp" \
|
---|
795 | "setc dl" \
|
---|
796 | "xor eax, eax" \
|
---|
797 | "mov al, dl" \
|
---|
798 | value [eax] \
|
---|
799 | modify [edx] \
|
---|
800 | parm [ax] [ebx] [ecx] \
|
---|
801 |
|
---|
802 | #define DHGETDOSV_SYSINFOSEG 1
|
---|
803 | #define DHGETDOSV_LOCINFOSEG 2
|
---|
804 | #define DHGETDOSV_VECTORSDF 4
|
---|
805 | #define DHGETDOSV_VECTORREBOOT 5
|
---|
806 | #define DHGETDOSV_YIELDFLAG 7
|
---|
807 | #define DHGETDOSV_TCYIELDFLAG 8
|
---|
808 | #define DHGETDOSV_DOSCODEPAGE 11
|
---|
809 | #define DHGETDOSV_INTERRUPTLEV 13
|
---|
810 | #define DHGETDOSV_DEVICECLASSTABLE 14
|
---|
811 | #define DHGETDOSV_DMQSSELECTOR 15
|
---|
812 | #define DHGETDOSV_APMINFO 16
|
---|
813 |
|
---|
814 | ULONG DevGetDOSVar(ULONG VarNumber, ULONG VarMember, VOID NEAR *KernalVar);
|
---|
815 | #pragma aux DevGetDOSVar = \
|
---|
816 | "xor ebx, ebx" \
|
---|
817 | "mov dl,24h" \
|
---|
818 | "call DevHelp" \
|
---|
819 | "setc dl" \
|
---|
820 | "mov word ptr [edi],bx" \
|
---|
821 | "mov word ptr [edi+2],ax" \
|
---|
822 | "xor eax, eax" \
|
---|
823 | "mov al, dl" \
|
---|
824 | value [eax] \
|
---|
825 | parm [eax] [ecx] [edi] \
|
---|
826 | modify [edx ebx];
|
---|
827 |
|
---|
828 | ULONG DevSetTimer(DWORD TimerHandler);
|
---|
829 | #pragma aux DevSetTimer = \
|
---|
830 | "mov dl,1Dh" \
|
---|
831 | "call DevHelp" \
|
---|
832 | "setc dl" \
|
---|
833 | "xor eax, eax" \
|
---|
834 | "mov al, dl" \
|
---|
835 | value [eax] \
|
---|
836 | parm [eax] \
|
---|
837 | modify [eax edx];
|
---|
838 |
|
---|
839 | ULONG DevTickCount(DWORD TimerHandler, DWORD TickCount);
|
---|
840 | #pragma aux DevTickCount = \
|
---|
841 | "mov dl,33h" \
|
---|
842 | "call DevHelp" \
|
---|
843 | "setc dl" \
|
---|
844 | "xor eax, eax" \
|
---|
845 | "mov al, dl" \
|
---|
846 | value [eax] \
|
---|
847 | parm [eax] [ebx] \
|
---|
848 | modify [eax edx];
|
---|
849 |
|
---|
850 | #ifdef FLATSTACK
|
---|
851 | #define kstrcpy strcpy
|
---|
852 | #define kmemcpy memcpy
|
---|
853 | #define kmemset memset
|
---|
854 | #else
|
---|
855 | #define kstrcpy _fstrcpy
|
---|
856 | #define kmemcpy _fmemcpy
|
---|
857 | #define kmemset _fmemset
|
---|
858 | #define strcpy _fstrcpy
|
---|
859 | #define memcpy _fmemcpy
|
---|
860 | #define memset _fmemset
|
---|
861 | #endif
|
---|
862 |
|
---|
863 | #endif // DevHelp_h
|
---|