source: trunk/src/include/devhelp.h@ 36

Last change on this file since 36 was 36, checked in by markus, 15 years ago

Heureka! Fixed problems on real hardware (AHCI enabled bit must be set explicitly for each command...)

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