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