source: trunk/src/include/devhelp.h

Last change on this file was 149, checked in by David Azarewicz, 12 years ago

The rest of the last commit

  • Property svn:eol-style set to native
File size: 31.6 KB
Line 
1/*
2 * devhelp.h OS/2 device help calls for DD 16-bit development.
3 *
4 * Open Watcom Project
5 *
6 * Copyright (c) 2004-2007 The Open Watcom Contributors. All Rights Reserved.
7 *
8 * This file was copied from the updated DDK.
9 *
10 * =========================================================================
11 */
12
13#ifndef DEVHELP_INCLUDED
14#define DEVHELP_INCLUDED
15
16#ifdef __WATCOMC__
17
18#ifndef OS2_INCLUDED
19#define INCL_NOPMAPI
20#include <os2.h>
21#endif
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27typedef ULONG LIN; // 32-Bit Linear Addess
28typedef ULONG __far *PLIN; // 16:16 Ptr to a 32-Bit Linear Addess
29
30typedef struct _PAGELIST {
31 ULONG PhysAddr;
32 ULONG Size;
33} PAGELIST, __near *NPPAGELIST, __far *PPAGELIST;
34
35typedef ULONG HSpinLock;
36
37// Device_Help: dev help offset from INIT
38extern PFN Device_Help;
39
40// 11 Jun 07 SHL change from far ptr to dword ptr
41// MKG - Due to Lars Erdmann comment:
42// Explanation: "CALL DWORD PTR" calls a far routine indirectly through the
43// function pointer saved in the address passed to the call (which is
44// correct since the devhelps use a function pointer) while "CALL FAR PTR"
45// calls a far routine directly, that is, the address passed to the call is
46// the far routine address (which is wrong for the devhelp calls).
47
48#define DEVHELP_CALL \
49 "call dword ptr [Device_Help]" \
50 "jc error" \
51 "sub ax,ax" \
52 "error:" \
53 value [ax]
54
55/* This service starts an ABIOS function for the Operating System Transfer
56 * Convention.
57 */
58USHORT DevHelp_ABIOSCall(USHORT Lid, NPBYTE ReqBlk, USHORT Entry_Type);
59#pragma aux DevHelp_ABIOSCall = \
60 "mov dl,36h" \
61 DEVHELP_CALL \
62 parm caller [ax] [si] [dh] \
63 modify exact [ax dl];
64
65/* This service starts an ABIOS common entry point according to the Advanced
66 * BIOS Transfer Convention.
67 */
68USHORT DevHelp_ABIOSCommonEntry(NPBYTE ReqBlk, USHORT Entry_Type);
69#pragma aux DevHelp_ABIOSCommonEntry = \
70 "mov dl,37h" \
71 DEVHELP_CALL \
72 parm caller [si] [dh] \
73 modify exact [ax dl];
74
75USHORT DevHelp_AcquireSpinLock(HSpinLock spl);
76#pragma aux DevHelp_AcquireSpinLock = \
77 "mov ax,dx" \
78 "mov dl,71h" \
79 DEVHELP_CALL \
80 parm caller nomemory [dx bx] \
81 modify nomemory exact [ax bx cx dx si di];
82
83USHORT DevHelp_AllocateCtxHook(NPFN HookHandler, PULONG HookHandle);
84#pragma aux DevHelp_AllocateCtxHook = \
85 "push bx" \
86 "movzx eax,ax" \
87 "mov ebx,-1" \
88 "mov dl,63h" \
89 "call dword ptr [Device_Help]" \
90 "pop bx" \
91 "jc error" \
92 "mov es:[bx],eax" \
93 "sub ax,ax" \
94 "error:" \
95 value [ax] \
96 parm caller nomemory [ax] [es bx] \
97 modify exact [ax bx dl es];
98
99USHORT DevHelp_AllocGDTSelector(PSEL Selectors, USHORT Count);
100#pragma aux DevHelp_AllocGDTSelector = \
101 "mov dl,2Dh" \
102 DEVHELP_CALL \
103 parm caller [es di] [cx] \
104 modify nomemory exact [ax dl];
105
106#define MEMTYPE_ABOVE_1M 0
107#define MEMTYPE_BELOW_1M 1
108
109USHORT DevHelp_AllocPhys(ULONG lSize, USHORT MemType, PULONG PhysAddr);
110#pragma aux DevHelp_AllocPhys = \
111 "xchg ax,bx" \
112 "mov dl,18h" \
113 "call dword ptr [Device_Help]" \
114 "jc error" \
115 "mov es:[di],bx" \
116 "mov es:[di+2],ax" \
117 "sub ax,ax" \
118 "error:" \
119 value [ax] \
120 parm caller nomemory [ax bx] [dh] [es di] \
121 modify exact [ax bx dx];
122
123#define WAIT_NOT_ALLOWED 0
124#define WAIT_IS_ALLOWED 1
125
126USHORT DevHelp_AllocReqPacket(USHORT WaitFlag, PBYTE __far *ReqPktAddr);
127#pragma aux DevHelp_AllocReqPacket = \
128 "mov dl,0Dh", \
129 "call dword ptr [Device_Help]" \
130 "jc error" \
131 "push es" \
132 "push bx" \
133 "mov bx,sp" \
134 "les bx,ss:[bx]" \
135 "pop es:[bx]" \
136 "pop es:[bx+2]" \
137 "error:" \
138 "mov ax,0" \
139 "sbb ax,0" \
140 value [ax] \
141 parm caller [dh] [] \
142 modify exact [ax bx dl es];
143
144USHORT DevHelp_ArmCtxHook(ULONG HookData, ULONG HookHandle);
145#pragma aux DevHelp_ArmCtxHook = \
146 "mov bx,sp" \
147 "mov dl,65h", \
148 "mov eax,ss:[bx]" \
149 "mov ecx,-1" \
150 "mov ebx,ss:[bx+4]" \
151 DEVHELP_CALL \
152 parm caller nomemory [] \
153 modify nomemory exact [ax bx cx dl];
154
155typedef struct _IDCTABLE {
156 USHORT Reserved[3];
157 VOID (__far *ProtIDCEntry) (VOID);
158 USHORT ProtIDC_DS;
159} IDCTABLE, __near *NPIDCTABLE;
160
161USHORT DevHelp_AttachDD(NPSZ DDName, NPBYTE DDTable);
162#pragma aux DevHelp_AttachDD = \
163 "mov dl,2Ah" \
164 "call dword ptr [Device_Help]" \
165 "mov ax,0" \
166 "sbb ax,0" \
167 value [ax] \
168 parm caller [bx] [di] \
169 modify exact [ax dl];
170
171USHORT DevHelp_Beep(USHORT Frequency, USHORT DurationMS);
172#pragma aux DevHelp_Beep = \
173 "mov dl,52h" \
174 DEVHELP_CALL \
175 parm caller nomemory [bx] [cx] \
176 modify nomemory exact [ax dx];
177
178USHORT DevHelp_CloseEventSem(ULONG hEvent);
179#pragma aux DevHelp_CloseEventSem = \
180 "movzx esp,sp" \
181 "mov dl,68h" \
182 "mov eax,[esp]" \
183 DEVHELP_CALL \
184 parm caller nomemory [] \
185 modify nomemory exact [ax dl];
186
187USHORT DevHelp_CreateSpinLock(HSpinLock FAR * pSpl);
188#pragma aux DevHelp_CreateSpinLock = \
189 "mov ax,dx" \
190 "mov dl,79h" \
191 DEVHELP_CALL \
192 parm caller [dx bx] \
193 modify exact [ax bx cx dx si di];
194
195USHORT DevHelp_DeRegister(USHORT MonitorPID, USHORT MonitorHandle, PUSHORT MonitorsLeft);
196#pragma aux DevHelp_DeRegister = \
197 "mov dl,21h" \
198 "call dword ptr [Device_Help]" \
199 "jc error" \
200 "mov es:[di],ax" \
201 "sub ax,ax" \
202 "error:" \
203 value [ax] \
204 parm caller nomemory [bx] [ax] [es di] \
205 modify exact [ax dl];
206
207USHORT DevHelp_DevDone(PBYTE ReqPktAddr);
208#pragma aux DevHelp_DevDone = \
209 "mov dl,1" \
210 DEVHELP_CALL \
211 parm caller [es bx] \
212 modify exact [ax dl];
213
214#define DYNAPI_CALLGATE16 0x0001 /* 16:16 CallGate */
215#define DYNAPI_CALLGATE32 0x0000 /* 0:32 CallGate */
216
217#define DYNAPI_ROUTINE16 0x0002 /* 16:16 Routine Addr */
218#define DYNAPI_ROUTINE32 0x0000 /* 0:32 Routine Addr */
219
220USHORT DevHelp_DynamicAPI(PVOID RoutineAddress, USHORT ParmCount, USHORT Flags, PSEL CallGateSel);
221#pragma aux DevHelp_DynamicAPI = \
222 "mov dl,6Ch" \
223 "xchg ax,bx" \
224 "call dword ptr [Device_Help]" \
225 "jc error" \
226 "mov es:[si],di" \
227 "sub ax,ax" \
228 "error:" \
229 value [ax] \
230 parm caller [ax bx] [cx] [dh] [es si] \
231 modify exact [ax bx di dl];
232
233USHORT DevHelp_EOI(USHORT IRQLevel);
234#pragma aux DevHelp_EOI = \
235 "mov dl,31h" \
236 "call dword ptr [Device_Help]" \
237 "sub ax,ax" \
238 value [ax] \
239 parm caller nomemory [al] \
240 modify nomemory exact [ax dl];
241
242USHORT DevHelp_FreeCtxHook(ULONG HookHandle);
243#pragma aux DevHelp_FreeCtxHook = \
244 "movzx esp,sp" \
245 "mov dl,64h", \
246 "mov eax,[esp]" \
247 DEVHELP_CALL \
248 parm caller nomemory [] \
249 modify nomemory exact [ax dl];
250
251USHORT DevHelp_FreeGDTSelector(SEL Selector);
252#pragma aux DevHelp_FreeGDTSelector = \
253 "mov dl,53h" \
254 DEVHELP_CALL \
255 parm caller nomemory [ax] \
256 modify nomemory exact [ax dl];
257
258USHORT DevHelp_FreeLIDEntry(USHORT LIDNumber);
259#pragma aux DevHelp_FreeLIDEntry = \
260 "mov dl,35h" \
261 DEVHELP_CALL \
262 parm caller nomemory [ax] \
263 modify nomemory exact [ax dl];
264
265USHORT DevHelp_FreeSpinLock(HSpinLock spl);
266#pragma aux DevHelp_FreeSpinLock = \
267 "mov ax,dx" \
268 "mov dl,7ah" \
269 DEVHELP_CALL \
270 parm caller nomemory [dx bx] \
271 modify nomemory exact [ax bx cx dx si di];
272
273USHORT DevHelp_FreePhys(ULONG PhysAddr);
274#pragma aux DevHelp_FreePhys = \
275 "xchg ax,bx" \
276 "mov dl,19h" \
277 "call dword ptr [Device_Help]" \
278 "mov ax,0" \
279 "sbb ax,0" \
280 value [ax] \
281 parm caller nomemory [ax bx] \
282 modify exact [ax bx dl];
283
284USHORT DevHelp_FreeReqPacket(PBYTE ReqPktAddr);
285#pragma aux DevHelp_FreeReqPacket = \
286 "mov dl,0Eh", \
287 "call dword ptr [Device_Help]" \
288 "sub ax,ax" \
289 value [ax] \
290 parm caller [es bx] \
291 modify exact [ax dl];
292
293typedef struct _SELDESCINFO {
294 UCHAR Type;
295 UCHAR Granularity;
296 LIN BaseAddr;
297 ULONG Limit;
298} SELDESCINFO, __far *PSELDESCINFO;
299
300typedef struct _GATEDESCINFO {
301 UCHAR Type;
302 UCHAR ParmCount;
303 SEL Selector;
304 USHORT Reserved_1;
305 ULONG Offset;
306} GATEDESCINFO, __far *PGATEDESCINFO;
307
308USHORT DevHelp_GetDescInfo(SEL Selector, PBYTE SelInfo);
309#pragma aux DevHelp_GetDescInfo = \
310 "mov dl,5Dh" \
311 "call dword ptr [Device_Help]" \
312 "jc error" \
313 "mov es:[bx],ax" \
314 "mov es:[bx+2],ecx" \
315 "mov es:[bx+6],edx" \
316 "sub ax,ax" \
317 "error:" \
318 value [ax] \
319 parm caller nomemory [ax] [es bx] \
320 modify exact [ax cx dx];
321
322USHORT DevHelp_GetDeviceBlock(USHORT Lid, PPVOID DeviceBlockPtr);
323#pragma aux DevHelp_GetDeviceBlock = \
324 "mov dl,38h" \
325 "call dword ptr [Device_Help]" \
326 "jc error" \
327 "mov es:[si],dx" \
328 "mov es:[si+2],cx" \
329 "sub ax,ax" \
330 "error:" \
331 value [ax] \
332 parm caller nomemory [ax] [es si] \
333 modify exact [ax bx cx dx];
334
335#define DHGETDOSV_SYSINFOSEG 1
336#define DHGETDOSV_LOCINFOSEG 2
337#define DHGETDOSV_VECTORSDF 4
338#define DHGETDOSV_VECTORREBOOT 5
339#define DHGETDOSV_YIELDFLAG 7 /*@V76282*/
340#define DHGETDOSV_TCYIELDFLAG 8 /*@V76282*/
341#define DHGETDOSV_DOSTABLES 9 // Undocumented by IBM, gets the dostables.
342#define DHGETDOSV_DOSCODEPAGE 11 /*@V76282*/
343#define DHGETDOSV_INTERRUPTLEV 13
344#define DHGETDOSV_DEVICECLASSTABLE 14 /*@V76282*/
345#define DHGETDOSV_DMQSSELECTOR 15 /*@V76282*/
346#define DHGETDOSV_APMINFO 16 /*@V76282*/
347
348USHORT DevHelp_GetDOSVar(USHORT VarNumber, USHORT VarMember, PPVOID KernalVar);
349#pragma aux DevHelp_GetDOSVar = \
350 "mov dl,24h" \
351 "call dword ptr [Device_Help]" \
352 "mov es:[di],bx" \
353 "mov es:[di+2],ax" \
354 "sub ax,ax" \
355 value [ax] \
356 parm caller nomemory [al] [cx] [es di] \
357 modify exact [ax bx dl];
358
359USHORT DevHelp_GetLIDEntry(USHORT DeviceType, SHORT LIDIndex, USHORT Type, PUSHORT LID);
360#pragma aux DevHelp_GetLIDEntry = \
361 "mov dl,34h" \
362 "call dword ptr [Device_Help]" \
363 "jc error" \
364 "mov es:[di],ax" \
365 "sub ax,ax" \
366 "error:" \
367 value [ax] \
368 parm caller nomemory [al] [bl] [dh] [es di] \
369 modify exact [ax dl];
370
371USHORT DevHelp_InternalError(PSZ MsgText, USHORT MsgLength );
372#pragma aux DevHelp_InternalError aborts = \
373 "push ds" \
374 "push es" \
375 "pop ds" \
376 "pop es" \
377 "mov dl,2Bh" \
378 "jmp dword ptr es:[Device_Help]" \
379 parm [es si] [di] \
380 modify nomemory exact [];
381
382USHORT DevHelp_LinToGDTSelector(SEL Selector, LIN LinearAddr, ULONG Size);
383#pragma aux DevHelp_LinToGDTSelector = \
384 "mov bx,sp" \
385 "mov dl,5Ch" \
386 "mov ecx,ss:[bx+4]" \
387 "mov ebx,ss:[bx]" \
388 "call dword ptr [Device_Help]" \
389 "jc error" \
390 "sub ax,ax" \
391 "error:" \
392 value [ax] \
393 parm caller nomemory [ax] [] \
394 modify nomemory exact [ax bx cx dl];
395
396#define LOCKTYPE_SHORT_ANYMEM 0x00
397#define LOCKTYPE_LONG_ANYMEM 0x01
398#define LOCKTYPE_LONG_HIGHMEM 0x03
399#define LOCKTYPE_SHORT_VERIFY 0x04
400
401USHORT DevHelp_Lock(SEL Segment, USHORT LockType, USHORT WaitFlag, PULONG LockHandle);
402#pragma aux DevHelp_Lock = \
403 "mov dl,13h" \
404 "call dword ptr [Device_Help]" \
405 "jc error" \
406 "mov es:[di],bx" \
407 "mov es:[di+2],ax" \
408 "sub ax,ax" \
409 "error:" \
410 value [ax] \
411 parm caller [ax] [bh] [bl] [es di] \
412 modify exact [ax dl];
413
414USHORT DevHelp_MonFlush(USHORT MonitorHandle);
415#pragma aux DevHelp_MonFlush = \
416 "mov dl,23h" \
417 DEVHELP_CALL \
418 parm caller [ax] \
419 modify exact [ax dl];
420
421USHORT DevHelp_MonitorCreate(USHORT MonitorHandle, PBYTE FinalBuffer, NPFN NotifyRtn, PUSHORT MonitorChainHandle);
422#pragma aux DevHelp_MonitorCreate = \
423 "mov dl,1Fh" \
424 "call dword ptr [Device_Help]" \
425 "jc error" \
426 "mov si,[esp]" \
427 "mov es,[esp+2]" \
428 "mov es:[si],ax" \
429 "sub ax,ax" \
430 "error:" \
431 value [ax] \
432 parm caller [ax] [es si] [di] [] \
433 modify exact [ax dl es si];
434
435/* DevHelp_MonWrite has one change compared to the original specification.
436 The DataRecord parameter was originally a far (16:16) pointer. It has
437 been changed to a near pointer because DS must point to the default data
438 segment and therefore the DataRecord parameter must be near. This
439 allows the compiler to catch the error.
440*/
441
442USHORT DevHelp_MonWrite(USHORT MonitorHandle, NPBYTE DataRecord, USHORT Count, ULONG TimeStampMS, USHORT WaitFlag);
443#pragma aux DevHelp_MonWrite = \
444 "mov dl,22h" \
445 DEVHELP_CALL \
446 parm caller [ax] [si] [cx] [di bx] [dh] \
447 modify exact [ax dl];
448
449USHORT DevHelp_OpenEventSem(ULONG hEvent);
450#pragma aux DevHelp_OpenEventSem = \
451 "mov eax,[esp]" \
452 "mov dl,67h" \
453 DEVHELP_CALL \
454 parm caller nomemory [] \
455 modify nomemory exact [ax dl];
456
457#define GDTSEL_R3CODE 0x0000 /*@V76282*/
458#define GDTSEL_R3DATA 0x0001 /*@V76282*/
459#define GDTSEL_R2CODE 0x0003 /*@V76282*/
460#define GDTSEL_R2DATA 0x0004 /*@V76282*/
461#define GDTSEL_R0CODE 0x0005 /*@V76282*/
462#define GDTSEL_R0DATA 0x0006 /*@V76282*/
463
464/* GDTSEL_ADDR32 may be OR'd with above defines */ /*@V76282*/
465#define GDTSEL_ADDR32 0x0080 /*@V76282*/
466
467USHORT DevHelp_PageListToGDTSelector(SEL Selector, ULONG Size, USHORT Access, LIN pPageList);
468#pragma aux DevHelp_PageListToGDTSelector = \
469 "mov ecx,[esp]" \
470 "mov dh,[esp+4]" \
471 "mov edi,[esp+6]" \
472 "mov dl,60h" \
473 "call dword ptr [Device_Help]" \
474 "jc error" \
475 "sub ax,ax" \
476 "error:" \
477 value [ax] \
478 parm caller [] \
479 modify nomemory exact [ax cx dx di];
480
481USHORT DevHelp_PageListToLin(ULONG Size, LIN pPageList, PLIN LinearAddr);
482#pragma aux DevHelp_PageListToLin = \
483 "mov ecx,[esp]" \
484 "mov edi,[esp+4]" \
485 "mov dl,5Fh" \
486 "call dword ptr [Device_Help]" \
487 "jc error" \
488 "les di,[esp+8]" \
489 "mov es:[di],eax" \
490 "sub ax,ax" \
491 "error:" \
492 value [ax] \
493 parm caller [] \
494 modify exact [ax cx dx di];
495
496/* NOTE: After the DevHelp call, SI contains the modified selector. However,
497 the C interface has no provisions for returning this value to the caller.
498 You can, however, use the _SI() inline function defined in include.h.
499*/
500
501USHORT DevHelp_PhysToGDTSel(ULONG PhysAddr, ULONG Count, SEL Selector, UCHAR Access);
502#pragma aux DevHelp_PhysToGDTSel = \
503 "push bp" \
504 "mov dl,54h" \
505 "mov bp,sp" \
506 "mov eax,[bp+2]" \
507 "mov ecx,[bp+6]" \
508 "mov si,[bp+10]" \
509 "mov dh,[bp+12]" \
510 "call dword ptr [Device_Help]" \
511 "jc error" \
512 "sub ax,ax" \
513 "error:" \
514 "pop bp" \
515 value [ax] \
516 parm caller nomemory [] \
517 modify nomemory exact [ax cx dx si];
518
519USHORT DevHelp_PhysToGDTSelector(ULONG PhysAddr, USHORT Count, SEL Selector);
520#pragma aux DevHelp_PhysToGDTSelector = \
521 "xchg ax,bx" \
522 "mov dl,2Eh" \
523 DEVHELP_CALL \
524 parm nomemory [ax bx] [cx] [si] \
525 modify nomemory exact [ax bx dl];
526
527#define SELTYPE_R3CODE 0
528#define SELTYPE_R3DATA 1
529#define SELTYPE_FREE 2
530#define SELTYPE_R2CODE 3
531#define SELTYPE_R2DATA 4
532#define SELTYPE_R3VIDEO 5
533
534USHORT DevHelp_PhysToUVirt(ULONG PhysAddr, USHORT Length, USHORT flags, USHORT TagType, PVOID SelOffset);
535#pragma aux DevHelp_PhysToUVirt = \
536 "xchg ax,bx" \
537 "mov dl,17h" \
538 "call dword ptr [Device_Help]" \
539 "jc error" \
540 "push es" \
541 "push bx" \
542 "mov bx,sp" \
543 "les bx,ss:[bx+4]" \
544 "pop es:[bx]" \
545 "pop es:[bx+2]" \
546 "sub ax,ax" \
547 "error:" \
548 value [ax] \
549 parm caller nomemory [bx ax] [cx] [dh] [si] [] \
550 modify exact [ax bx dl es];
551
552USHORT DevHelp_PhysToVirt(ULONG PhysAddr, USHORT usLength, PVOID SelOffset, PUSHORT ModeFlag);
553#pragma aux DevHelp_PhysToVirt = \
554 "xchg ax,bx" \
555 "mov dx,15h" \
556 "push ds" \
557 "call dword ptr [Device_Help]" \
558 "jc error" \
559 "sub ax,ax" \
560 "mov es:[di],si" \
561 "mov es:[di+2],ds" \
562 "error:" \
563 "pop ds" \
564 value [ax] \
565 parm caller nomemory [bx ax] [cx] [es di] [] \
566 modify exact [ax bx dx si];
567
568USHORT DevHelp_PostEventSem(ULONG hEvent);
569#pragma aux DevHelp_PostEventSem = \
570 "mov eax,[esp]" \
571 "mov dl,69h" \
572 DEVHELP_CALL \
573 parm caller nomemory [] \
574 modify nomemory exact [ax dl];
575
576#define WAIT_IS_INTERRUPTABLE 0
577#define WAIT_IS_NOT_INTERRUPTABLE 1
578
579#define WAIT_INTERRUPTED 0x2
580#define WAIT_TIMED_OUT 0x1
581
582USHORT DevHelp_ProcBlock(ULONG EventId, ULONG WaitTime, USHORT IntWaitFlag);
583#pragma aux DevHelp_ProcBlock = \
584 "mov dl,4" \
585 "xchg ax,bx" \
586 "xchg cx,di" \
587 "call dword ptr [Device_Help]" \
588 "setnz al" \
589 "setc bl" \
590 "inc al" \
591 "neg bl" \
592 "and al,bl" \
593 "xor ah,ah" \
594 value [ax] \
595 parm caller nomemory [ax bx] [di cx] [dh] \
596 modify nomemory exact [ax bx cx dl di];
597
598USHORT DevHelp_ProcRun(ULONG EventId, PUSHORT AwakeCount);
599#pragma aux DevHelp_ProcRun = \
600 "mov dl,5" \
601 "xchg ax,bx" \
602 "call dword ptr [Device_Help]" \
603 "mov es:[si],ax" \
604 "sub ax,ax" \
605 value [ax] \
606 parm caller nomemory [ax bx] [es si] \
607 modify exact [ax bx dl];
608
609USHORT DevHelp_PullParticular(NPBYTE Queue, PBYTE ReqPktAddr);
610#pragma aux DevHelp_PullParticular= \
611 "mov dl,0Bh" \
612 DEVHELP_CALL \
613 parm [si] [es bx] \
614 modify exact [ax dl];
615
616USHORT DevHelp_PullRequest(NPBYTE Queue, PBYTE __far *ReqPktAddr);
617#pragma aux DevHelp_PullRequest = \
618 "push es" \
619 "mov dl,0Ah" \
620 "call dword ptr [Device_Help]" \
621 "jc error" \
622 "movzx esp,sp" \
623 "push es" \
624 "push bx" \
625 "mov bx,sp" \
626 "les bx,[esp]" \
627 "pop es:[bx]" \
628 "pop es:[bx+2]" \
629 "sub ax,ax" \
630 "error:" \
631 value [ax] \
632 parm [si] [] \
633 modify exact [ax bx dl es];
634
635USHORT DevHelp_PushRequest(NPBYTE Queue, PBYTE ReqPktddr);
636#pragma aux DevHelp_PushRequest = \
637 "mov dl,09h" \
638 "call dword ptr [Device_Help]" \
639 "sub ax,ax" \
640 value [ax] \
641 parm [si] [es bx] \
642 modify exact [ax dl];
643
644USHORT DevHelp_QueueFlush(NPBYTE Queue);
645#pragma aux DevHelp_QueueFlush = \
646 "mov dl,10h" \
647 "call dword ptr [Device_Help]" \
648 "sub ax,ax" \
649 value [ax] \
650 parm [bx] \
651 modify exact [ax dl];
652
653typedef struct _QUEUEHDR {
654 USHORT QSize;
655 USHORT QChrOut;
656 USHORT QCount;
657 BYTE Queue[1];
658} QUEUEHDR, __far *PQUEUEHDR;
659
660USHORT DevHelp_QueueInit(NPBYTE Queue);
661#pragma aux DevHelp_QueueInit = \
662 "mov dl,0Fh" \
663 "call dword ptr [Device_Help]" \
664 "sub ax,ax" \
665 value [ax] \
666 parm [bx] \
667 modify exact [ax dl];
668
669USHORT DevHelp_QueueRead(NPBYTE Queue, PBYTE Char);
670#pragma aux DevHelp_QueueRead = \
671 "mov dl,12h" \
672 "call dword ptr [Device_Help]" \
673 "jc error" \
674 "mov es:[di],al" \
675 "sub ax,ax" \
676 "error:" \
677 value [ax] \
678 parm [bx] [es di] \
679 modify exact [ax dl];
680
681USHORT DevHelp_QueueWrite(NPBYTE Queue, UCHAR Char);
682#pragma aux DevHelp_QueueWrite = \
683 "mov dl,11h" \
684 DEVHELP_CALL \
685 parm [bx] [al] \
686 modify exact [ax dl];
687
688USHORT DevHelp_RAS(USHORT Major, USHORT Minor, USHORT Size, PBYTE Data);
689#pragma aux DevHelp_RAS = \
690 "push ds" \
691 "push es" \
692 "pop ds" \
693 "pop es" \
694 "mov dl,28h" \
695 "call dword ptr es:[Device_Help]" \
696 "push es" \
697 "pop ds" \
698 "mov ax,0" \
699 "sbb ax,0" \
700 value [ax] \
701 parm [ax] [cx] [bx] [es si] \
702 modify nomemory exact [ax dl es];
703
704#define CHAIN_AT_TOP 0
705#define CHAIN_AT_BOTTOM 1
706
707USHORT DevHelp_Register(USHORT MonitorHandle, USHORT MonitorPID, PBYTE InputBuffer, NPBYTE OutputBuffer, USHORT ChainFlag);
708#pragma aux DevHelp_Register = \
709 "mov dl,20h" \
710 DEVHELP_CALL \
711 parm caller nomemory [ax] [cx] [es si] [di] [dh] \
712 modify nomemory exact [ax dl];
713
714USHORT DevHelp_RegisterBeep(PFN BeepHandler);
715#pragma aux DevHelp_RegisterBeep = \
716 "mov dl,51h" \
717 "call dword ptr [Device_Help]" \
718 "sub ax,ax" \
719 value [ax] \
720 parm caller nomemory [cx di] \
721 modify nomemory exact [ax dl];
722
723#define DEVICECLASS_ADDDM 1 /*@V74979*/
724#define DEVICECLASS_MOUSE 2 /*@V74979*/
725
726USHORT DevHelp_RegisterDeviceClass(NPSZ DeviceString, PFN DriverEP, USHORT DeviceFlags, USHORT DeviceClass, PUSHORT DeviceHandle);
727#pragma aux DevHelp_RegisterDeviceClass = \
728 "mov dl,43h" \
729 "xchg ax,bx" \
730 "call dword ptr [Device_Help]" \
731 "jc error" \
732 "les bx,[esp]" \
733 "mov es:[bx],ax" \
734 "sub ax,ax" \
735 "error:" \
736 value [ax] \
737 parm [si] [ax bx] [di] [cx] [] \
738 modify exact [ax bx dl es];
739
740USHORT DevHelp_RegisterPDD(NPSZ PhysDevName, PFN HandlerRoutine);
741#pragma aux DevHelp_RegisterPDD = \
742 "mov dl,50h" \
743 DEVHELP_CALL \
744 parm caller [si] [es di] \
745 modify nomemory exact [ax dl];
746
747typedef struct _STACKUSAGEDATA {
748 USHORT Size;
749 USHORT Flags;
750 USHORT IRQLevel;
751 USHORT CLIStack;
752 USHORT STIStack;
753 USHORT EOIStack;
754 USHORT NestingLevel;
755} STACKUSAGEDATA;
756
757USHORT DevHelp_RegisterStackUsage(PVOID StackUsageData);
758#pragma aux DevHelp_RegisterStackUsage = \
759 "mov dl,3Ah" \
760 "call dword ptr [Device_Help]" \
761 "mov ax,0" \
762 "sbb ax,0" \
763 value [ax] \
764 parm caller [bx] \
765 modify nomemory exact [ax dl];
766
767USHORT DevHelp_RegisterTmrDD(NPFN TimerEntry, PULONG TmrRollover, PULONG Tmr);
768#pragma aux DevHelp_RegisterTmrDD = \
769 "mov dl,61h" \
770 "call dword ptr [Device_Help]" \
771 "mov ax,bx" \
772 "les bx,[esp]" \
773 "mov es:[bx],ax" \
774 "mov es:[bx+2],di" \
775 "les bx,[esp+4]" \
776 "mov es:[bx],cx" \
777 "mov es:[bx+2],di" \
778 "sub ax,ax" \
779 value [ax] \
780 parm caller nomemory [di] [] \
781 modify exact [ax bx cx di dl es];
782
783USHORT DevHelp_ReleaseSpinLock(HSpinLock spl);
784#pragma aux DevHelp_ReleaseSpinLock = \
785 "mov ax,dx" \
786 "mov dl,72h" \
787 DEVHELP_CALL \
788 parm caller nomemory [dx bx] \
789 modify nomemory exact [ax bx cx dx si di];
790
791USHORT DevHelp_ResetEventSem(ULONG hEvent, LIN pNumPosts);
792#pragma aux DevHelp_ResetEventSem = \
793 "mov eax,[esp]" \
794 "mov edi,[esp+4]" \
795 "mov dl,6Ah" \
796 DEVHELP_CALL \
797 parm caller nomemory [] \
798 modify exact [ax di dl];
799
800USHORT DevHelp_ResetTimer(NPFN TimerHandler);
801#pragma aux DevHelp_ResetTimer = \
802 "mov dl,1Eh" \
803 DEVHELP_CALL \
804 parm caller nomemory [ax] \
805 modify nomemory exact [ax dl];
806
807typedef struct _MSGTABLE {
808 USHORT MsgId; /* Message Id # */
809 USHORT cMsgStrings; /* # of (%) substitution strings */
810 PSZ MsgStrings[1]; /* Substitution string pointers */
811} MSGTABLE, __near *NPMSGTABLE;
812
813USHORT DevHelp_Save_Message(NPBYTE MsgTable);
814#pragma aux DevHelp_Save_Message = \
815 "sub bx,bx" \
816 "mov dl,3Dh" \
817 DEVHELP_CALL \
818 parm caller [si] \
819 modify nomemory exact [ax bx dl];
820
821USHORT DevHelp_SchedClock(PFN NEAR *SchedRoutineAddr);
822#pragma aux DevHelp_SchedClock = \
823 "mov dl,0h" \
824 "call dword ptr [Device_Help]" \
825 "sub ax,ax" \
826 value [ax] \
827 parm caller [ax] \
828 modify nomemory exact [ax dl];
829
830USHORT DevHelp_SemClear(ULONG SemHandle);
831#pragma aux DevHelp_SemClear = \
832 "xchg ax,bx" \
833 "mov dl,7h" \
834 DEVHELP_CALL \
835 parm nomemory [ax bx] \
836 modify nomemory exact [ax bx dl];
837
838#define SEMUSEFLAG_IN_USE 0
839#define SEMUSEFLAG_NOT_IN_USE 1
840
841USHORT DevHelp_SemHandle(ULONG SemKey, USHORT SemUseFlag, PULONG SemHandle);
842#pragma aux DevHelp_SemHandle = \
843 "xchg ax,bx" \
844 "mov dl,8h" \
845 "call dword ptr [Device_Help]" \
846 "jc error" \
847 "mov es:[si],bx" \
848 "mov es:[si+2],ax" \
849 "sub ax,ax" \
850 "error:" \
851 value [ax] \
852 parm nomemory [ax bx] [dh] [es si] \
853 modify exact [ax bx dl];
854
855USHORT DevHelp_SemRequest(ULONG SemHandle, ULONG SemTimeout);
856#pragma aux DevHelp_SemRequest = \
857 "xchg ax,bx" \
858 "xchg di,cx" \
859 "mov dl,06h" \
860 DEVHELP_CALL \
861 parm nomemory [ax bx] [cx di] \
862 modify nomemory exact [ax bx cx di dl];
863
864#define EVENT_MOUSEHOTKEY 0
865#define EVENT_CTRLBREAK 1
866#define EVENT_CTRLC 2
867#define EVENT_CTRLNUMLOCK 3
868#define EVENT_CTRLPRTSC 4
869#define EVENT_SHIFTPRTSC 5
870#define EVENT_KBDHOTKEY 6
871#define EVENT_KBDREBOOT 7
872
873USHORT DevHelp_SendEvent(USHORT EventType, USHORT Parm);
874#pragma aux DevHelp_SendEvent = \
875 "mov dl,25h" \
876 "call dword ptr [Device_Help]" \
877 "mov ax,0" \
878 "sbb ax,0" \
879 value [ax] \
880 parm nomemory [ah] [bx] \
881 modify nomemory exact [ax dl];
882
883USHORT DevHelp_SetIRQ(NPFN IRQHandler, USHORT IRQLevel, USHORT SharedFlag);
884#pragma aux DevHelp_SetIRQ = \
885 "mov dl,1Bh" \
886 DEVHELP_CALL \
887 parm caller nomemory [ax] [bx] [dh] \
888 modify nomemory exact [ax dl];
889
890USHORT DevHelp_SetTimer(NPFN TimerHandler);
891#pragma aux DevHelp_SetTimer = \
892 "mov dl,1Dh" \
893 DEVHELP_CALL \
894 parm caller nomemory [ax] \
895 modify nomemory exact [ax dl];
896
897USHORT DevHelp_SortRequest(NPBYTE Queue, PBYTE ReqPktAddr);
898#pragma aux DevHelp_SortRequest = \
899 "mov dl,0Ch" \
900 "call dword ptr [Device_Help]" \
901 "sub ax,ax" \
902 value [ax] \
903 parm [si] [es bx] \
904 modify exact [ax dl];
905
906USHORT DevHelp_TCYield(void);
907#pragma aux DevHelp_TCYield = \
908 "mov dl,3" \
909 "call dword ptr [Device_Help]" \
910 "sub ax,ax" \
911 value [ax] \
912 parm caller nomemory [] \
913 modify nomemory exact [ax dl];
914
915USHORT DevHelp_TickCount(NPFN TimerHandler, USHORT TickCount);
916#pragma aux DevHelp_TickCount = \
917 "mov dl,33h" \
918 DEVHELP_CALL \
919 parm caller nomemory [ax] [bx] \
920 modify nomemory exact [ax dl];
921
922USHORT DevHelp_UnLock(ULONG LockHandle);
923#pragma aux DevHelp_UnLock = \
924 "xchg ax,bx" \
925 "mov dl,14h" \
926 DEVHELP_CALL \
927 parm nomemory [ax bx] \
928 modify nomemory exact [ax bx dl];
929
930USHORT DevHelp_UnSetIRQ(USHORT IRQLevel);
931#pragma aux DevHelp_UnSetIRQ = \
932 "mov dl,1Ch" \
933 DEVHELP_CALL \
934 parm caller nomemory [bx] \
935 modify nomemory exact [ax dl];
936
937#define VERIFY_READONLY 0
938#define VERIFY_READWRITE 1
939
940USHORT DevHelp_VerifyAccess(SEL MemSelector, USHORT Length, USHORT MemOffset, UCHAR AccessFlag);
941#pragma aux DevHelp_VerifyAccess = \
942 "mov dl,27h" \
943 DEVHELP_CALL \
944 parm caller nomemory [ax] [cx] [di] [dh] \
945 modify nomemory exact [ax dl];
946
947#define VIDEO_PAUSE_OFF 0
948#define VIDEO_PAUSE_ON 1
949
950USHORT DevHelp_VideoPause(USHORT OnOff);
951#pragma aux DevHelp_VideoPause = \
952 "mov dl,3Ch" \
953 "call dword ptr [Device_Help]" \
954 "mov ax,0" \
955 "sbb ax,0" \
956 value [ax] \
957 parm nomemory [al] \
958 modify nomemory exact [ax dl];
959
960USHORT DevHelp_VirtToLin(SEL Selector, ULONG Offset, PLIN LinearAddr);
961#pragma aux DevHelp_VirtToLin = \
962 "movzx esp,sp" \
963 "mov esi,[esp]" \
964 "mov dl,5bh" \
965 "call dword ptr [Device_Help]" \
966 "jc error" \
967 "les bx,[esp+4]" \
968 "mov es:[bx],eax" \
969 "sub ax,ax" \
970 "error:" \
971 value [ax] \
972 parm caller nomemory [ax] [] \
973 modify exact [ax si es bx dl];
974
975USHORT DevHelp_VirtToPhys(PVOID SelOffset, PULONG PhysAddr);
976#pragma aux DevHelp_VirtToPhys = \
977 "push ds" \
978 "mov dl,16h" \
979 "push es" \
980 "mov si,ds" \
981 "mov es,si" \
982 "mov ds,bx" \
983 "mov si,ax" \
984 "call dword ptr es:[Device_Help]" \
985 "pop es" \
986 "mov es:[di],bx" \
987 "mov es:[di+2],ax" \
988 "pop ds" \
989 "sub ax,ax" \
990 value [ax] \
991 parm caller nomemory [ax bx] [es di] \
992 modify exact [ax bx dl es si];
993
994#define VMDHA_16M 0x0001 /*@V76282*/
995#define VMDHA_FIXED 0x0002 /*@V76282*/
996#define VMDHA_SWAP 0x0004 /*@V76282*/
997#define VMDHA_CONTIG 0x0008 /*@V76282*/
998#define VMDHA_PHYS 0x0010 /*@V76282*/
999#define VMDHA_PROCESS 0x0020 /*@V76282*/
1000#define VMDHA_SGSCONT 0x0040 /*@V76282*/
1001#define VMDHA_RESERVE 0x0100 /*@V76282*/
1002#define VMDHA_USEHIGHMEM 0x0800 /*@V76282*/
1003
1004USHORT DevHelp_VMAlloc(ULONG Flags, ULONG Size, ULONG PhysAddr, PLIN LinearAddr, PPVOID SelOffset);
1005#pragma aux DevHelp_VMAlloc = \
1006 "movzx esp,sp" \
1007 "mov eax,[esp]" \
1008 "mov ecx,[esp+4]" \
1009 "mov edi,[esp+8]" \
1010 "mov dl,57h" \
1011 "call dword ptr [Device_Help]" \
1012 "jc error" \
1013 "les di,[esp+12]" \
1014 "mov es:[di],eax" \
1015 "les di,[esp+16]" \
1016 "mov es:[di],ecx" \
1017 "sub ax,ax" \
1018 "error:" \
1019 value [ax] \
1020 parm caller nomemory [] \
1021 modify exact [ax cx di dl es];
1022
1023USHORT DevHelp_VMFree(LIN LinearAddr);
1024#pragma aux DevHelp_VMFree = \
1025 "movzx esp,sp" \
1026 "mov dl,58h" \
1027 "mov eax,[esp]" \
1028 DEVHELP_CALL \
1029 parm caller nomemory [] \
1030 modify nomemory exact [ax dl];
1031
1032#define VMDHGP_WRITE 0x0001 /*@V76282*/
1033#define VMDHGP_SELMAP 0x0002 /*@V76282*/
1034#define VMDHGP_SGSCONTROL 0x0004 /*@V76282*/
1035#define VMDHGP_4MEG 0x0008 /*@V76282*/
1036
1037USHORT DevHelp_VMGlobalToProcess(ULONG Flags, LIN LinearAddr, ULONG Length, PLIN ProcessLinearAddr);
1038#pragma aux DevHelp_VMGlobalToProcess = \
1039 "mov dl,5Ah" \
1040 "mov eax,[esp]" \
1041 "mov ebx,[esp+4]" \
1042 "mov ecx,[esp+8]" \
1043 "call dword ptr [Device_Help]" \
1044 "jc error" \
1045 "les bx,[esp+12]" \
1046 "mov es:[bx],eax" \
1047 "sub ax,ax" \
1048 "error:" \
1049 value [ax] \
1050 parm caller nomemory [] \
1051 modify exact [ax bx cx dl es];
1052
1053#define VMDHL_NOBLOCK 0x0001
1054#define VMDHL_CONTIGUOUS 0x0002
1055#define VMDHL_16M 0x0004
1056#define VMDHL_WRITE 0x0008
1057#define VMDHL_LONG 0x0010
1058#define VMDHL_VERIFY 0x0020
1059
1060USHORT DevHelp_VMLock(ULONG Flags, LIN LinearAddr, ULONG Length, LIN pPagelist, LIN pLockHandle, PULONG PageListCount);
1061#pragma aux DevHelp_VMLock = \
1062 "mov dl,55h" \
1063 "mov eax,[esp]" \
1064 "mov ebx,[esp+4]" \
1065 "mov ecx,[esp+8]" \
1066 "mov edi,[esp+12]" \
1067 "mov esi,[esp+16]" \
1068 "call dword ptr [Device_Help]" \
1069 "jc error" \
1070 "les bx,[esp+20]" \
1071 "mov es:[bx],eax" \
1072 "sub ax,ax" \
1073 "error:" \
1074 value [ax] \
1075 parm caller nomemory [] \
1076 modify exact [ax bx cx dl si di es];
1077
1078#define VMDHPG_READONLY 0x0000 /*@V76282*/
1079#define VMDHPG_WRITE 0x0001 /*@V76282*/
1080
1081USHORT DevHelp_VMProcessToGlobal(ULONG Flags, LIN LinearAddr, ULONG Length, PLIN GlobalLinearAddr);
1082#pragma aux DevHelp_VMProcessToGlobal = \
1083 "mov dl,59h" \
1084 "mov eax,[esp]" \
1085 "mov ebx,[esp+4]" \
1086 "mov ecx,[esp+8]" \
1087 "call dword ptr [Device_Help]" \
1088 "jc error" \
1089 "les bx,[esp+12]" \
1090 "mov es:[bx],eax" \
1091 "sub ax,ax" \
1092 "error:" \
1093 value [ax] \
1094 parm caller nomemory [] \
1095 modify exact [ax bx cx dl es];
1096
1097#define VMDHS_DECOMMIT 0x0001 /*@V76282*/
1098#define VMDHS_RESIDENT 0x0002 /*@V76282*/
1099#define VMDHS_SWAP 0x0004 /*@V76282*/
1100
1101USHORT DevHelp_VMSetMem(LIN LinearAddr, ULONG Size, ULONG Flags);
1102#pragma aux DevHelp_VMSetMem = \
1103 "mov dl,66h" \
1104 "mov ebx,[esp]" \
1105 "mov ecx,[esp+4]" \
1106 "mov eax,[esp+8]" \
1107 DEVHELP_CALL \
1108 parm caller nomemory [] \
1109 modify nomemory exact [ax bx cx dl];
1110
1111USHORT DevHelp_VMUnLock(LIN pLockHandle);
1112#pragma aux DevHelp_VMUnLock = \
1113 "mov dl,56h" \
1114 "mov esi,[esp]" \
1115 DEVHELP_CALL \
1116 parm caller [] \
1117 modify exact [ax si dl];
1118
1119USHORT DevHelp_Yield(void);
1120#pragma aux DevHelp_Yield = \
1121 "mov dl,2" \
1122 "call dword ptr [Device_Help]" \
1123 "sub ax,ax" \
1124 value [ax] \
1125 parm caller nomemory [] \
1126 modify nomemory exact [ax dl];
1127
1128/*
1129** DevHlp Error Codes (from ABERROR.INC)
1130*/
1131
1132#define MSG_MEMORY_ALLOCATION_FAILED 0x00
1133#define ERROR_LID_ALREADY_OWNED 0x01
1134#define ERROR_LID_DOES_NOT_EXIST 0x02
1135#define ERROR_ABIOS_NOT_PRESENT 0x03
1136#define ERROR_NOT_YOUR_LID 0x04
1137#define ERROR_INVALID_ENTRY_POINT 0x05
1138
1139#ifdef __cplusplus
1140}
1141#endif
1142
1143#endif // end __WATCOMC__
1144#endif // end DEVHELP_INCLUDED
1145
Note: See TracBrowser for help on using the repository browser.