1 | ; $Id: startup.asm,v 1.1.1.1 2003/07/02 13:56:56 eleph Exp $
|
---|
2 | ;*
|
---|
3 | ;* 16bit entrypoints to the PDD with thunks to the 32bit functions
|
---|
4 | ;*
|
---|
5 | ;* (C) 2000-2002 InnoTek Systemberatung GmbH
|
---|
6 | ;* (C) 1998-2001 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
7 | ;*
|
---|
8 | ;* Partly based on MWDD32 (32 bits OS/2 device driver and IFS support driver)
|
---|
9 | ;* Copyright (C) 1995, 1996 Matthieu WILLM
|
---|
10 | ;*
|
---|
11 | ;* This program is free software; you can redistribute it and/or
|
---|
12 | ;* modify it under the terms of the GNU General Public License as
|
---|
13 | ;* published by the Free Software Foundation; either version 2 of
|
---|
14 | ;* the License, or (at your option) any later version.
|
---|
15 | ;*
|
---|
16 | ;* This program is distributed in the hope that it will be useful,
|
---|
17 | ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | ;* GNU General Public License for more details.
|
---|
20 | ;*
|
---|
21 | ;* You should have received a copy of the GNU General Public
|
---|
22 | ;* License along with this program; if not, write to the Free
|
---|
23 | ;* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
|
---|
24 | ;* USA.
|
---|
25 | ;*
|
---|
26 |
|
---|
27 | .386p
|
---|
28 |
|
---|
29 |
|
---|
30 | INCL_DOS equ 1
|
---|
31 | INCL_DOSERRORS equ 1
|
---|
32 | include os2.inc
|
---|
33 |
|
---|
34 | include segments.inc
|
---|
35 | include startup.inc
|
---|
36 |
|
---|
37 | DATA16 segment
|
---|
38 | extrn DOS32FLATDS : abs ; ring 0 FLAT kernel data selector
|
---|
39 | public __OffFinalDS16
|
---|
40 | public help_header
|
---|
41 | public uniaud_header
|
---|
42 | public _MSG_TABLE16
|
---|
43 | public DevHelpInit
|
---|
44 | public fOpen
|
---|
45 | public InitPktSeg
|
---|
46 | public InitPktOff
|
---|
47 | public _MESSAGE_STR
|
---|
48 | public pddname16
|
---|
49 | public FileName
|
---|
50 | public _RM_Help0
|
---|
51 | public _RM_Help1
|
---|
52 | public _RM_Help3
|
---|
53 | public _RMFlags
|
---|
54 |
|
---|
55 | ;*********************************************************************************************
|
---|
56 | ;************************* Device Driver Header **********************************************
|
---|
57 | ;*********************************************************************************************
|
---|
58 | help_header dw OFFSET DATA16:uniaud_header ; Pointer to next driver
|
---|
59 | dw SEG DATA16:uniaud_header
|
---|
60 | dw 1000100110000000b ; Device attributes
|
---|
61 | ; ||||| +-+ ||||
|
---|
62 | ; ||||| | | |||+------------------ STDIN
|
---|
63 | ; ||||| | | ||+------------------- STDOUT
|
---|
64 | ; ||||| | | |+-------------------- NULL
|
---|
65 | ; ||||| | | +--------------------- CLOCK
|
---|
66 | ; ||||| | |
|
---|
67 | ; ||||| | +------------------------+ (001) OS/2
|
---|
68 | ; ||||| | | (010) DosDevIOCtl2 + SHUTDOWN
|
---|
69 | ; ||||| +--------------------------+ (011) Capability bit strip
|
---|
70 | ; |||||
|
---|
71 | ; ||||+----------------------------- OPEN/CLOSE (char) or Removable (blk)
|
---|
72 | ; |||+------------------------------ Sharing support
|
---|
73 | ; ||+------------------------------- IBM
|
---|
74 | ; |+-------------------------------- IDC entry point
|
---|
75 | ; +--------------------------------- char/block device driver
|
---|
76 |
|
---|
77 | dw offset CODE16:help_stub_strategy ; Strategy routine entry point
|
---|
78 | dw 0 ; IDC routine entry point
|
---|
79 | db 'ALSAHLP$' ; Device name
|
---|
80 | db 8 dup (0) ; Reserved
|
---|
81 | dw 0000000000010011b ; Level 3 device driver capabilities
|
---|
82 | ; |||||
|
---|
83 | ; ||||+------------------ DosDevIOCtl2 + Shutdown
|
---|
84 | ; |||+------------------- More than 16 MB support
|
---|
85 | ; ||+-------------------- Parallel port driver
|
---|
86 | ; |+--------------------- Adapter device driver
|
---|
87 | ; +---------------------- InitComplete
|
---|
88 | dw 0000000000000000b
|
---|
89 |
|
---|
90 | uniaud_header dd -1
|
---|
91 | dw 1101100110000000b ; Device attributes
|
---|
92 | ; ||||| +-+ ||||
|
---|
93 | ; ||||| | | |||+------------------ STDIN
|
---|
94 | ; ||||| | | ||+------------------- STDOUT
|
---|
95 | ; ||||| | | |+-------------------- NULL
|
---|
96 | ; ||||| | | +--------------------- CLOCK
|
---|
97 | ; ||||| | |
|
---|
98 | ; ||||| | +------------------------+ (001) OS/2
|
---|
99 | ; ||||| | | (010) DosDevIOCtl2 + SHUTDOWN
|
---|
100 | ; ||||| +--------------------------+ (011) Capability bit strip
|
---|
101 | ; |||||
|
---|
102 | ; ||||+----------------------------- OPEN/CLOSE (char) or Removable (blk)
|
---|
103 | ; |||+------------------------------ Sharing support
|
---|
104 | ; ||+------------------------------- IBM
|
---|
105 | ; |+-------------------------------- IDC entry point
|
---|
106 | ; +--------------------------------- char/block device driver
|
---|
107 |
|
---|
108 | dw offset CODE16:uniaud_stub_strategy ; Strategy routine entry point
|
---|
109 | dw offset CODE16:uniaud_stub_idc ; IDC routine entry point
|
---|
110 | db 'ALSA32$ ' ; Device name
|
---|
111 | db 8 dup (0) ; Reserved
|
---|
112 | dw 0000000000010011b ; Level 3 device driver capabilities
|
---|
113 | ; |||||
|
---|
114 | ; ||||+------------------ DosDevIOCtl2 + Shutdown
|
---|
115 | ; |||+------------------- More than 16 MB support
|
---|
116 | ; ||+-------------------- Parallel port driver
|
---|
117 | ; |+--------------------- Adapter device driver
|
---|
118 | ; +---------------------- InitComplete
|
---|
119 | dw 0000000000000000b
|
---|
120 |
|
---|
121 | DevHelpInit dd 0
|
---|
122 | fOpen dd 0
|
---|
123 | InitPktSeg dw 0
|
---|
124 | InitPktOff dw 0
|
---|
125 | ;needed for rmcalls.lib
|
---|
126 | _RM_Help0 dd 0
|
---|
127 | _RM_Help1 dd 0
|
---|
128 | _RM_Help3 dd 0
|
---|
129 | _RMFlags dd 0
|
---|
130 | _MESSAGE_STR db 1024 dup (0)
|
---|
131 | _MSG_TABLE16 dw 0 ;message length
|
---|
132 | dw OFFSET _MESSAGE_STR ;message far pointer
|
---|
133 | dw SEG _MESSAGE_STR
|
---|
134 |
|
---|
135 | pddname16 db 'ALSA32$'
|
---|
136 | FileName db "ALSAHLP$", 0
|
---|
137 | ResMgr DB 52H,45H,53H,4dH,47H,52H,24H,20H
|
---|
138 | DB 00H
|
---|
139 | _RMIDCTable DB 00H,00H,00H,00H,00H,00H,00H,00H
|
---|
140 | DB 00H,00H,00H,00H
|
---|
141 |
|
---|
142 | ;last byte in 16 bits data segment
|
---|
143 | __OffFinalDS16 label byte
|
---|
144 |
|
---|
145 | DATA16 ends
|
---|
146 |
|
---|
147 | CODE16 segment
|
---|
148 | assume cs:CODE16, ds:DATA16
|
---|
149 |
|
---|
150 | public __OffFinalCS16
|
---|
151 |
|
---|
152 | public help_stub_strategy
|
---|
153 | public uniaud_stub_strategy
|
---|
154 | public uniaud_stub_idc
|
---|
155 | public uniaud_stub_timer
|
---|
156 | public thunk3216_devhelp
|
---|
157 | public thunk3216_devhelp_modified_ds
|
---|
158 | extrn DOSOPEN : far
|
---|
159 | extrn DOSWRITE : far
|
---|
160 | extrn DOSCLOSE : far
|
---|
161 |
|
---|
162 | ALIGN 2
|
---|
163 | help_stub_strategy proc far
|
---|
164 | movzx eax, byte ptr es:[bx].reqCommand
|
---|
165 | cmp eax, 04h ; DosRead
|
---|
166 | je uniaud_stub_strategy
|
---|
167 |
|
---|
168 | enter 0, 0
|
---|
169 | and sp, 0fffch ; align stack
|
---|
170 |
|
---|
171 | pushad
|
---|
172 | push ds
|
---|
173 | push es
|
---|
174 | push fs
|
---|
175 | push gs
|
---|
176 |
|
---|
177 | mov dx, DATA16
|
---|
178 | mov ds, dx
|
---|
179 |
|
---|
180 | cmp eax, 0 ; Init
|
---|
181 | je short @@help_init
|
---|
182 | cmp eax, 0Eh ; DosClose
|
---|
183 | je short @@help_close
|
---|
184 | cmp eax, 0Dh ; DosOpen
|
---|
185 | jne short @@help_error
|
---|
186 | ;DosOpen:
|
---|
187 | cmp word ptr fOpen, 0
|
---|
188 | je short @@help_ret_ok ; not ours
|
---|
189 | push ebx ; save ebx
|
---|
190 | push es
|
---|
191 | mov word ptr fOpen, 0
|
---|
192 | mov ax, word ptr InitPktSeg
|
---|
193 | mov fs, ax ; fs:ebx = req. packet
|
---|
194 | xor ebx, ebx
|
---|
195 | mov bx, word ptr InitPktOff
|
---|
196 | call far ptr FLAT:STRATEGY_
|
---|
197 | pop es
|
---|
198 | pop ebx ; restore ebx ptr
|
---|
199 | @@help_ret:
|
---|
200 | mov word ptr es:[bx].reqStatus, ax
|
---|
201 | @@help_ret_error:
|
---|
202 | pop gs
|
---|
203 | pop fs
|
---|
204 | pop es
|
---|
205 | pop ds
|
---|
206 | popad
|
---|
207 |
|
---|
208 | leave
|
---|
209 | ret
|
---|
210 |
|
---|
211 | @@help_init:
|
---|
212 | mov eax, dword ptr es:[bx].i_devHelp
|
---|
213 | mov dword ptr DevHelpInit, eax
|
---|
214 | mov word ptr es:[bx].o_codeend, offset __OffFinalCS16
|
---|
215 | mov word ptr es:[bx].o_dataend, offset __OffFinalDS16
|
---|
216 |
|
---|
217 | @@help_ret_ok:
|
---|
218 | mov ax, STDON
|
---|
219 | jmp short @@help_ret
|
---|
220 |
|
---|
221 | @@help_close:
|
---|
222 | call far ptr FLAT:HelpClose
|
---|
223 | jmp short @@help_ret_ok
|
---|
224 |
|
---|
225 | @@help_error:
|
---|
226 | mov ax, STDON + STERR + ERROR_I24_BAD_COMMAND
|
---|
227 | mov word ptr es:[bx].reqStatus, ax
|
---|
228 | jmp short @@help_ret_error
|
---|
229 |
|
---|
230 | help_stub_strategy endp
|
---|
231 |
|
---|
232 | ALIGN 2
|
---|
233 | uniaud_stub_strategy proc far
|
---|
234 | enter 0, 0
|
---|
235 | and sp, 0fffch ; align stack
|
---|
236 |
|
---|
237 | pushad
|
---|
238 | push ds
|
---|
239 | push es
|
---|
240 | push fs
|
---|
241 | push gs
|
---|
242 |
|
---|
243 | mov ax, DATA16
|
---|
244 | mov ds, ax
|
---|
245 |
|
---|
246 | movzx eax, byte ptr es:[bx].reqCommand
|
---|
247 | cmp eax, 0
|
---|
248 | jz short @@init
|
---|
249 |
|
---|
250 | push ebx
|
---|
251 | push es
|
---|
252 | mov ax, bx
|
---|
253 | xor ebx, ebx
|
---|
254 | mov bx, ax
|
---|
255 | mov ax, es
|
---|
256 | mov fs, ax ; fs:ebx = req. packet
|
---|
257 |
|
---|
258 | call far ptr FLAT:STRATEGY_ ; 32 bits strategy entry point
|
---|
259 |
|
---|
260 | pop es
|
---|
261 | pop ebx ; oude bx ptr
|
---|
262 | mov word ptr es:[bx].reqStatus, ax ; status code
|
---|
263 |
|
---|
264 | @@uniaud_ret:
|
---|
265 |
|
---|
266 | pop gs
|
---|
267 | pop fs
|
---|
268 | pop es
|
---|
269 | pop ds
|
---|
270 | popad
|
---|
271 | leave
|
---|
272 | ret
|
---|
273 |
|
---|
274 | @@init:
|
---|
275 | ;
|
---|
276 | ; DEVICE= initialization
|
---|
277 | ;
|
---|
278 | mov word ptr InitPktSeg, es
|
---|
279 | mov word ptr InitPktOff, bx
|
---|
280 | inc word ptr fOpen
|
---|
281 | call device_init
|
---|
282 |
|
---|
283 | mov word ptr es:[bx].reqStatus, ax ; status code (ret by device_init)
|
---|
284 | mov word ptr es:[bx].o_codeend, offset __OffFinalCS16
|
---|
285 | mov word ptr es:[bx].o_dataend, offset __OffFinalDS16
|
---|
286 | jmp short @@uniaud_ret
|
---|
287 |
|
---|
288 | init_err:
|
---|
289 | mov dword ptr es:[bx].i_devHelp, 0
|
---|
290 | jmp short @@uniaud_ret
|
---|
291 |
|
---|
292 | uniaud_stub_strategy endp
|
---|
293 |
|
---|
294 | ;in: cx = cmd
|
---|
295 | ; bx = lower 16 bits of ULONG parameter
|
---|
296 | ; dx = upper 16 bits of ULONG parameter
|
---|
297 | ;return value in dx:ax
|
---|
298 | ALIGN 2
|
---|
299 | uniaud_stub_idc proc far
|
---|
300 | enter 0, 0
|
---|
301 | and sp, 0fffch ; align stack
|
---|
302 |
|
---|
303 | shl edx, 16
|
---|
304 | mov dx, bx
|
---|
305 | call far ptr FLAT:IDC_ ; 32 bits strategy entry point
|
---|
306 |
|
---|
307 | mov dx, ax
|
---|
308 | shr eax, 16
|
---|
309 | xchg ax, dx
|
---|
310 |
|
---|
311 | leave
|
---|
312 | retf
|
---|
313 | uniaud_stub_idc endp
|
---|
314 |
|
---|
315 | ALIGN 2
|
---|
316 | uniaud_stub_timer proc far
|
---|
317 | enter 0, 0
|
---|
318 | and sp, 0fffch ; align stack
|
---|
319 |
|
---|
320 | call far ptr FLAT:TIMER_ ; 32 bits timer entry point
|
---|
321 |
|
---|
322 | leave
|
---|
323 | retf
|
---|
324 | uniaud_stub_timer endp
|
---|
325 |
|
---|
326 |
|
---|
327 | ;;*****************************************************************************
|
---|
328 | ; device_init
|
---|
329 | ;
|
---|
330 | ; Use DosOpen to tell the 1st driver to handle init for us. We must do it this
|
---|
331 | ; way since right now our CPL is 3 and the flat code selector has DPL 0, so
|
---|
332 | ; we can't load it. In the open strategy request, CPL is 0
|
---|
333 | ;;*****************************************************************************
|
---|
334 | ALIGN 2
|
---|
335 | device_init proc near
|
---|
336 | enter 24, 0
|
---|
337 | push ds
|
---|
338 | push es
|
---|
339 | push bx
|
---|
340 | push si
|
---|
341 | push di
|
---|
342 |
|
---|
343 | ; bp -> old bp
|
---|
344 | ; bp - 2 -> FileHandle
|
---|
345 | ; bp - 4 -> ActionTaken
|
---|
346 | ; bp - 8 -> IOCTL parm (4 bytes) : union mwdd32_ioctl_init_device_parm
|
---|
347 | ; bp - 24 -> IOCTL data (16 bytes) : union mwdd32_ioctl_init_device_data
|
---|
348 |
|
---|
349 | ;
|
---|
350 | ; Opens wathlp$
|
---|
351 | ;
|
---|
352 | push seg DATA16 ; seg FileName
|
---|
353 | push offset FileName ; ofs FileName
|
---|
354 | push ss ; seg &FileHandle
|
---|
355 | lea ax, [bp - 2]
|
---|
356 | push ax ; ofs &FileHandle
|
---|
357 | push ss ; seg &ActionTaken
|
---|
358 | lea ax, [bp - 4]
|
---|
359 | push ax ; ofs &ActionTaken
|
---|
360 | push dword ptr 0 ; file size
|
---|
361 | push 0 ; file attributes
|
---|
362 | push OPEN_ACTION_FAIL_IF_NEW + OPEN_ACTION_OPEN_IF_EXISTS
|
---|
363 | push OPEN_SHARE_DENYNONE + OPEN_ACCESS_READONLY
|
---|
364 | push dword ptr 0 ; reserved
|
---|
365 | call DOSOPEN
|
---|
366 | cmp ax, NO_ERROR
|
---|
367 | jnz short @@error
|
---|
368 |
|
---|
369 |
|
---|
370 | ;
|
---|
371 | ; Closes wathlp$
|
---|
372 | ;
|
---|
373 | push word ptr [bp - 2] ; FileHandle
|
---|
374 | call DOSCLOSE
|
---|
375 | cmp ax, NO_ERROR
|
---|
376 | jnz short @@error
|
---|
377 |
|
---|
378 | @@out:
|
---|
379 | push eax ;gemold door doswrite
|
---|
380 |
|
---|
381 | push 0001H
|
---|
382 | push ds
|
---|
383 | push offset _MESSAGE_STR
|
---|
384 | push word ptr _MSG_TABLE16
|
---|
385 | push ss
|
---|
386 | lea dx, [bp - 2]
|
---|
387 | push dx
|
---|
388 | call DOSWRITE
|
---|
389 |
|
---|
390 | pop eax
|
---|
391 |
|
---|
392 | pop di
|
---|
393 | pop si
|
---|
394 | pop bx
|
---|
395 | pop es
|
---|
396 | pop ds
|
---|
397 | leave
|
---|
398 | ret
|
---|
399 | @@error:
|
---|
400 | mov ax, STDON + STERR + ERROR_I24_GEN_FAILURE
|
---|
401 | jmp short @@out
|
---|
402 |
|
---|
403 | device_init endp
|
---|
404 |
|
---|
405 | ALIGN 2
|
---|
406 | ;use devhlp pointer stored in 16 bits code segment
|
---|
407 | thunk3216_devhelp:
|
---|
408 | push ds
|
---|
409 | push DATA16
|
---|
410 | pop ds
|
---|
411 | call dword ptr DevHelpInit
|
---|
412 | pop ds
|
---|
413 |
|
---|
414 | jmp far ptr FLAT:thunk1632_devhelp
|
---|
415 |
|
---|
416 | ALIGN 2
|
---|
417 | thunk3216_devhelp_modified_ds:
|
---|
418 | push gs
|
---|
419 | push DATA16
|
---|
420 | pop gs
|
---|
421 | call dword ptr gs:DevHelpInit
|
---|
422 | pop gs
|
---|
423 | jmp far ptr FLAT:thunk1632_devhelp_modified_ds
|
---|
424 |
|
---|
425 |
|
---|
426 | ALIGN 2
|
---|
427 | PUBLIC _RMAllocResourceOrg
|
---|
428 | _RMAllocResourceOrg proc far
|
---|
429 | enter16
|
---|
430 | test byte ptr _RMFlags, 01H
|
---|
431 | je short AllocL1
|
---|
432 | lea eax, [bp+6]
|
---|
433 | push ss
|
---|
434 | push ax
|
---|
435 | push 0008H
|
---|
436 | push cs
|
---|
437 | call near ptr _CallRM
|
---|
438 | mov sp,bp
|
---|
439 | ret16
|
---|
440 | AllocL1: test byte ptr _RMFlags,02H
|
---|
441 | je short AllocL2
|
---|
442 | push es
|
---|
443 | push bx
|
---|
444 | les bx,dword ptr [bp+10]
|
---|
445 | mov word ptr es:[bx],0ffffH
|
---|
446 | mov word ptr es:+2H[bx],0ffffH
|
---|
447 | sub ax,ax
|
---|
448 | pop bx
|
---|
449 | pop es
|
---|
450 | ret16
|
---|
451 | AllocL2: mov ax,0001H
|
---|
452 | ret16
|
---|
453 | _RMAllocResourceOrg endp
|
---|
454 |
|
---|
455 | ALIGN 2
|
---|
456 | PUBLIC _RMAllocResource16
|
---|
457 | _RMAllocResource16 proc far
|
---|
458 | enter32
|
---|
459 | xor eax, eax
|
---|
460 | push dword ptr [bp+18]
|
---|
461 | push dword ptr [bp+14]
|
---|
462 | push dword ptr [bp+10]
|
---|
463 | call _RMAllocResourceOrg
|
---|
464 | add sp, 12
|
---|
465 | ret32
|
---|
466 | _RMAllocResource16 endp
|
---|
467 |
|
---|
468 | ALIGN 2
|
---|
469 | PUBLIC _RMCreateAdapterOrg
|
---|
470 | _RMCreateAdapterOrg proc far
|
---|
471 | enter16
|
---|
472 | test byte ptr _RMFlags,01H
|
---|
473 | je short CreateAdL1
|
---|
474 | lea eax, [bp+6]
|
---|
475 | push ss
|
---|
476 | push ax
|
---|
477 | push 0004H
|
---|
478 | push cs
|
---|
479 | call near ptr _CallRM
|
---|
480 | mov sp,bp
|
---|
481 | ret16
|
---|
482 | CreateAdL1: test byte ptr _RMFlags,02H
|
---|
483 | je short CreateAdL2
|
---|
484 | push es
|
---|
485 | push bx
|
---|
486 | les bx,dword ptr [bp+10]
|
---|
487 | mov word ptr es:[bx],0ffffH
|
---|
488 | mov word ptr es:+2H[bx],0ffffH
|
---|
489 | sub ax,ax
|
---|
490 | pop bx
|
---|
491 | pop es
|
---|
492 | ret16
|
---|
493 | CreateAdL2: mov ax,0001H
|
---|
494 | ret16
|
---|
495 | _RMCreateAdapterOrg endp
|
---|
496 |
|
---|
497 | ALIGN 2
|
---|
498 | PUBLIC _RMCreateAdapter16
|
---|
499 | _RMCreateAdapter16 proc far
|
---|
500 | enter32
|
---|
501 | xor eax, eax
|
---|
502 | push dword ptr [bp+26]
|
---|
503 | push dword ptr [bp+22]
|
---|
504 | push dword ptr [bp+18]
|
---|
505 | push dword ptr [bp+14]
|
---|
506 | push dword ptr [bp+10]
|
---|
507 | call _RMCreateAdapterOrg
|
---|
508 | add sp, 20
|
---|
509 | ret32
|
---|
510 | _RMCreateAdapter16 endp
|
---|
511 |
|
---|
512 | ALIGN 2
|
---|
513 | PUBLIC _RMCreateDeviceOrg
|
---|
514 | _RMCreateDeviceOrg proc far
|
---|
515 | enter16
|
---|
516 | test byte ptr _RMFlags,01H
|
---|
517 | je short CreateDevL1
|
---|
518 | lea ax, [bp+6]
|
---|
519 | push ss
|
---|
520 | push ax
|
---|
521 | push 0006H
|
---|
522 | push cs
|
---|
523 | call near ptr _CallRM
|
---|
524 | mov sp,bp
|
---|
525 | ret16
|
---|
526 | CreateDevL1: test byte ptr _RMFlags,02H
|
---|
527 | je short CreateDevL2
|
---|
528 | push es
|
---|
529 | push bx
|
---|
530 | les bx,dword ptr [bp+10]
|
---|
531 | mov word ptr es:[bx],0ffffH
|
---|
532 | mov word ptr es:+2H[bx],0ffffH
|
---|
533 | sub ax,ax
|
---|
534 | pop bx
|
---|
535 | pop es
|
---|
536 | ret16
|
---|
537 | CreateDevL2: mov ax,0001H
|
---|
538 | ret16
|
---|
539 | _RMCreateDeviceOrg endp
|
---|
540 |
|
---|
541 | ALIGN 2
|
---|
542 | PUBLIC _RMCreateDevice16
|
---|
543 | _RMCreateDevice16 proc far
|
---|
544 | enter32
|
---|
545 | xor eax, eax
|
---|
546 | push dword ptr [bp+26]
|
---|
547 | push dword ptr [bp+22]
|
---|
548 | push dword ptr [bp+18]
|
---|
549 | push dword ptr [bp+14]
|
---|
550 | push dword ptr [bp+10]
|
---|
551 | call _RMCreateDeviceOrg
|
---|
552 | add sp, 20
|
---|
553 | ret32
|
---|
554 | _RMCreateDevice16 endp
|
---|
555 |
|
---|
556 | ALIGN 2
|
---|
557 | PUBLIC _RMDestroyDeviceOrg
|
---|
558 | _RMDestroyDeviceOrg proc far
|
---|
559 | enter16
|
---|
560 | test byte ptr _RMFlags,01H
|
---|
561 | je short DestroyL1
|
---|
562 | lea ax, [bp+6]
|
---|
563 | push ss
|
---|
564 | push ax
|
---|
565 | push 0007H
|
---|
566 | push cs
|
---|
567 | call near ptr _CallRM
|
---|
568 | mov sp,bp
|
---|
569 | ret16
|
---|
570 | DestroyL1: test byte ptr _RMFlags,02H
|
---|
571 | je short DestroyL2
|
---|
572 | sub ax,ax
|
---|
573 | ret16
|
---|
574 | DestroyL2: mov ax,0001H
|
---|
575 | ret16
|
---|
576 | _RMDestroyDeviceOrg endp
|
---|
577 |
|
---|
578 | ALIGN 2
|
---|
579 | PUBLIC _RMDestroyDevice16
|
---|
580 | _RMDestroyDevice16 proc far
|
---|
581 | enter32
|
---|
582 | xor eax, eax
|
---|
583 | push dword ptr [bp+10]
|
---|
584 | call _RMDestroyDeviceOrg
|
---|
585 | add sp, 4
|
---|
586 | ret32
|
---|
587 | _RMDestroyDevice16 endp
|
---|
588 |
|
---|
589 | ALIGN 2
|
---|
590 | PUBLIC _RMDeallocResourceOrg
|
---|
591 | _RMDeallocResourceOrg proc far
|
---|
592 | enter16
|
---|
593 | test byte ptr _RMFlags,01H
|
---|
594 | je short DeAllocL1
|
---|
595 | lea ax, [bp+6]
|
---|
596 | push ss
|
---|
597 | push ax
|
---|
598 | push 0009H
|
---|
599 | push cs
|
---|
600 | call near ptr _CallRM
|
---|
601 | mov sp,bp
|
---|
602 | ret16
|
---|
603 | DeAllocL1: test byte ptr _RMFlags,02H
|
---|
604 | je short DeAllocL2
|
---|
605 | sub ax,ax
|
---|
606 | ret16
|
---|
607 | DeAllocL2: mov ax,0001H
|
---|
608 | ret16
|
---|
609 | _RMDeallocResourceOrg endp
|
---|
610 |
|
---|
611 | ALIGN 2
|
---|
612 | PUBLIC _RMDeallocResource16
|
---|
613 | _RMDeallocResource16 proc far
|
---|
614 | enter32
|
---|
615 | xor eax, eax
|
---|
616 | push dword ptr [bp+14]
|
---|
617 | push dword ptr [bp+10]
|
---|
618 | call _RMDeallocResourceOrg
|
---|
619 | add sp, 8
|
---|
620 | ret32
|
---|
621 | _RMDeallocResource16 endp
|
---|
622 |
|
---|
623 | ALIGN 2
|
---|
624 | PUBLIC MY_DEVHELP_ATTACHDD
|
---|
625 | MY_DEVHELP_ATTACHDD proc near
|
---|
626 | push bp
|
---|
627 | mov bp,sp
|
---|
628 | push di
|
---|
629 | push es
|
---|
630 | mov ax, ds
|
---|
631 | mov es, ax
|
---|
632 | mov bx,word ptr +8H[bp]
|
---|
633 | mov di,word ptr +6H[bp]
|
---|
634 | mov dl,2aH
|
---|
635 | call dword ptr DevHelpInit
|
---|
636 | jb short L2
|
---|
637 | sub ax,ax
|
---|
638 | pop es
|
---|
639 | pop di
|
---|
640 | leave
|
---|
641 | ret 0004H
|
---|
642 | L2: pop es
|
---|
643 | pop di
|
---|
644 | leave
|
---|
645 | ret 0004H
|
---|
646 | MY_DEVHELP_ATTACHDD endp
|
---|
647 |
|
---|
648 | ALIGN 2
|
---|
649 | PUBLIC _RMCreateDriverOrg
|
---|
650 | _RMCreateDriverOrg proc far
|
---|
651 | enter16
|
---|
652 | test byte ptr _RMFlags,01H
|
---|
653 | je short CreateDrL4
|
---|
654 | CreateDrL3: lea ax, [bp+6]
|
---|
655 | push ss
|
---|
656 | push ax
|
---|
657 | push 0002H
|
---|
658 | push cs
|
---|
659 | call near ptr _CallRM
|
---|
660 | add sp,0006H
|
---|
661 | ret16
|
---|
662 | CreateDrL4: test byte ptr _RMFlags,02H
|
---|
663 | je short CreateDrL6
|
---|
664 | CreateDrL5: push es
|
---|
665 | push bx
|
---|
666 | les bx,dword ptr [bp+10]
|
---|
667 | mov word ptr es:[bx],0ffffH
|
---|
668 | mov word ptr es:+2H[bx],0ffffH
|
---|
669 | sub ax,ax
|
---|
670 | pop bx
|
---|
671 | pop es
|
---|
672 | ret16
|
---|
673 | CreateDrL6: mov ax, word ptr DevHelpInit + 2H
|
---|
674 | or ax, word ptr DevHelpInit
|
---|
675 | jne short CreateDrL7
|
---|
676 | mov ax,0008H
|
---|
677 | ret16
|
---|
678 | CreateDrL7: push offset ResMgr
|
---|
679 | push offset _RMIDCTable
|
---|
680 | push cs
|
---|
681 | call near ptr MY_DEVHELP_ATTACHDD
|
---|
682 | or ax,ax
|
---|
683 | je short CreateDrL8
|
---|
684 | or byte ptr _RMFlags, 02H
|
---|
685 | jmp short CreateDrL5
|
---|
686 | CreateDrL8: mov ax,word ptr _RMIDCTable+4H
|
---|
687 | mov word ptr _RM_Help3+2H,ax
|
---|
688 | mov word ptr _RM_Help3,0000H
|
---|
689 | mov ax,word ptr _RMIDCTable+2H
|
---|
690 | mov word ptr _RM_Help0+2H,ax
|
---|
691 | mov ax,word ptr _RMIDCTable+6H
|
---|
692 | mov word ptr _RM_Help0,ax
|
---|
693 | or byte ptr _RMFlags,05H
|
---|
694 | jmp short CreateDrL3
|
---|
695 | _RMCreateDriverOrg endp
|
---|
696 |
|
---|
697 | ALIGN 2
|
---|
698 | PUBLIC _RMCreateDriver16
|
---|
699 | _RMCreateDriver16 proc far
|
---|
700 | enter32
|
---|
701 | xor eax, eax
|
---|
702 | push dword ptr [bp+14]
|
---|
703 | push dword ptr [bp+10]
|
---|
704 | call _RMCreateDriverOrg
|
---|
705 | add sp, 8
|
---|
706 | ret32
|
---|
707 | _RMCreateDriver16 endp
|
---|
708 |
|
---|
709 | ALIGN 2
|
---|
710 | PUBLIC _CallRM
|
---|
711 | _CallRM proc near
|
---|
712 | enter 0002H,00H
|
---|
713 | call near ptr _GetCS
|
---|
714 | test al,03H
|
---|
715 | je short L1
|
---|
716 | push word ptr +0aH[bp]
|
---|
717 | push word ptr +8H[bp]
|
---|
718 | push word ptr +6H[bp]
|
---|
719 | call dword ptr _RM_Help3
|
---|
720 | add sp,0006H
|
---|
721 | leave
|
---|
722 | ret
|
---|
723 | L1: push word ptr +6H[bp]
|
---|
724 | call dword ptr _RM_Help0
|
---|
725 | leave
|
---|
726 | ret
|
---|
727 | _CallRM endp
|
---|
728 |
|
---|
729 | ALIGN 2
|
---|
730 | _GetCS proc near
|
---|
731 | enter 0002H,00H
|
---|
732 | push cs
|
---|
733 | pop word ptr -2H[bp]
|
---|
734 | mov ax,word ptr -2H[bp]
|
---|
735 | leave
|
---|
736 | ret
|
---|
737 | _GetCS endp
|
---|
738 |
|
---|
739 | ALIGN 2
|
---|
740 | PUBLIC _RMDestroyDriverOrg
|
---|
741 | _RMDestroyDriverOrg proc far
|
---|
742 | enter16
|
---|
743 | test byte ptr _RMFlags,01H
|
---|
744 | je short DestroyDrvL1
|
---|
745 | lea ax, [bp+6]
|
---|
746 | push ss
|
---|
747 | push ax
|
---|
748 | push 0003H
|
---|
749 | push cs
|
---|
750 | call near ptr _CallRM
|
---|
751 | mov sp,bp
|
---|
752 | ret16
|
---|
753 | DestroyDrvL1: test byte ptr _RMFlags,02H
|
---|
754 | je short DestroyDrvL2
|
---|
755 | sub ax,ax
|
---|
756 | ret16
|
---|
757 | DestroyDrvL2: mov ax,0001H
|
---|
758 | ret16
|
---|
759 | _RMDestroyDriverOrg endp
|
---|
760 |
|
---|
761 | ALIGN 2
|
---|
762 | PUBLIC _RMDestroyDriver16
|
---|
763 | _RMDestroyDriver16 proc far
|
---|
764 | enter32
|
---|
765 | xor eax, eax
|
---|
766 | push dword ptr [bp+10]
|
---|
767 | call _RMDestroyDriverOrg
|
---|
768 | add sp, 4
|
---|
769 | ret32
|
---|
770 | _RMDestroyDriver16 endp
|
---|
771 |
|
---|
772 |
|
---|
773 | ALIGN 2
|
---|
774 | _RMGetNodeInfoOrg proc far
|
---|
775 | enter16
|
---|
776 | test byte ptr _RMFlags,01H
|
---|
777 | je short GetNodeInfo_L3
|
---|
778 | test byte ptr _RMFlags,04H
|
---|
779 | je short GetNodeInfo_L1
|
---|
780 | lea ax,+6H[bp]
|
---|
781 | push ss
|
---|
782 | push ax
|
---|
783 | push 001cH
|
---|
784 | push cs
|
---|
785 | call near ptr _CallRM
|
---|
786 | mov sp,bp
|
---|
787 | ret16
|
---|
788 | GetNodeInfo_L1: mov ax,0014H
|
---|
789 | ret16
|
---|
790 | nop
|
---|
791 | GetNodeInfo_L2: test byte ptr _RMFlags,02H
|
---|
792 | je short GetNodeInfo_L3
|
---|
793 | mov ax,0015H
|
---|
794 | ret16
|
---|
795 | GetNodeInfo_L3: mov ax,0001H
|
---|
796 | ret16
|
---|
797 | _RMGetNodeInfoOrg endp
|
---|
798 |
|
---|
799 | ALIGN 2
|
---|
800 | PUBLIC _RMGetNodeInfo16
|
---|
801 | _RMGetNodeInfo16 proc far
|
---|
802 | enter32
|
---|
803 | xor eax, eax
|
---|
804 | push word ptr [bp+18] ;pushed as dword by watcom
|
---|
805 | push dword ptr [bp+14]
|
---|
806 | push dword ptr [bp+10]
|
---|
807 | call _RMGetNodeInfoOrg
|
---|
808 | add sp, 10
|
---|
809 | ret32
|
---|
810 | _RMGetNodeInfo16 endp
|
---|
811 |
|
---|
812 | ALIGN 2
|
---|
813 | _RMDevIDToHandleListOrg proc far
|
---|
814 | enter16
|
---|
815 | test byte ptr _RMFlags,01H
|
---|
816 | je short RMDevIDToHandleList_L2
|
---|
817 | test byte ptr _RMFlags,04H
|
---|
818 | je short RMDevIDToHandleList_L1
|
---|
819 | lea ax,+6H[bp]
|
---|
820 | push ss
|
---|
821 | push ax
|
---|
822 | push 0020H
|
---|
823 | push cs
|
---|
824 | call near ptr _CallRM
|
---|
825 | mov sp,bp
|
---|
826 | ret16
|
---|
827 | RMDevIDToHandleList_L1:
|
---|
828 | mov ax,0014H
|
---|
829 | ret16
|
---|
830 | nop
|
---|
831 | RMDevIDToHandleList_L2:
|
---|
832 | test byte ptr _RMFlags,02H
|
---|
833 | je short RMDevIDToHandleList_L3
|
---|
834 | sub ax,ax
|
---|
835 | ret16
|
---|
836 | nop
|
---|
837 | RMDevIDToHandleList_L3:
|
---|
838 | mov ax,0001H
|
---|
839 | ret16
|
---|
840 | nop
|
---|
841 | _RMDevIDToHandleListOrg endp
|
---|
842 |
|
---|
843 | ALIGN 2
|
---|
844 | PUBLIC _RMDevIDToHandleList16
|
---|
845 | _RMDevIDToHandleList16 proc far
|
---|
846 | enter32
|
---|
847 | xor eax, eax
|
---|
848 | push dword ptr [bp+42]
|
---|
849 | push dword ptr [bp+38]
|
---|
850 | push dword ptr [bp+34]
|
---|
851 | push dword ptr [bp+30]
|
---|
852 | push dword ptr [bp+26]
|
---|
853 | push dword ptr [bp+22]
|
---|
854 | push dword ptr [bp+18]
|
---|
855 | push dword ptr [bp+14]
|
---|
856 | push dword ptr [bp+10]
|
---|
857 | call _RMDevIDToHandleListOrg
|
---|
858 | add sp, 36
|
---|
859 | ret32
|
---|
860 | _RMDevIDToHandleList16 endp
|
---|
861 |
|
---|
862 | ALIGN 2
|
---|
863 | _RMHandleToResourceHandleListOrg proc far
|
---|
864 | enter16
|
---|
865 | test byte ptr _RMFlags,01H
|
---|
866 | je short RMHandleToResourceHandleList_L2
|
---|
867 | test byte ptr _RMFlags,04H
|
---|
868 | je short RMHandleToResourceHandleList_L1
|
---|
869 | lea ax,+6H[bp]
|
---|
870 | push ss
|
---|
871 | push ax
|
---|
872 | push 0021H
|
---|
873 | push cs
|
---|
874 | call near ptr _CallRM
|
---|
875 | ret16
|
---|
876 | nop
|
---|
877 | RMHandleToResourceHandleList_L1:
|
---|
878 | mov ax,0014H
|
---|
879 | ret16
|
---|
880 | nop
|
---|
881 | RMHandleToResourceHandleList_L2:
|
---|
882 | test byte ptr _RMFlags,02H
|
---|
883 | je short RMHandleToResourceHandleList_L3
|
---|
884 | sub ax,ax
|
---|
885 | ret16
|
---|
886 | nop
|
---|
887 | RMHandleToResourceHandleList_L3:
|
---|
888 | mov ax,0001H
|
---|
889 | ret16
|
---|
890 | nop
|
---|
891 | _RMHandleToResourceHandleListOrg endp
|
---|
892 |
|
---|
893 | ALIGN 2
|
---|
894 | PUBLIC _RMHandleToResourceHandleList16
|
---|
895 | _RMHandleToResourceHandleList16 proc far
|
---|
896 | enter32
|
---|
897 | xor eax, eax
|
---|
898 | push dword ptr [bp+14]
|
---|
899 | push dword ptr [bp+10]
|
---|
900 | call _RMHandleToResourceHandleListOrg
|
---|
901 | add sp, 8
|
---|
902 | ret32
|
---|
903 | _RMHandleToResourceHandleList16 endp
|
---|
904 |
|
---|
905 | ALIGN 2
|
---|
906 | ISR00_16 proc far
|
---|
907 | push ebx
|
---|
908 | mov ebx, 0
|
---|
909 | call far ptr FLAT:Interrupt32
|
---|
910 | pop ebx
|
---|
911 | retf
|
---|
912 | ISR00_16 endp
|
---|
913 |
|
---|
914 | ALIGN 2
|
---|
915 | ISR01_16 proc far
|
---|
916 | push ebx
|
---|
917 | mov ebx, 1
|
---|
918 | call far ptr FLAT:Interrupt32
|
---|
919 | pop ebx
|
---|
920 | retf
|
---|
921 | ISR01_16 endp
|
---|
922 |
|
---|
923 | ALIGN 2
|
---|
924 | ISR02_16 proc far
|
---|
925 | push ebx
|
---|
926 | mov ebx, 2
|
---|
927 | call far ptr FLAT:Interrupt32
|
---|
928 | pop ebx
|
---|
929 | retf
|
---|
930 | ISR02_16 endp
|
---|
931 |
|
---|
932 | ALIGN 2
|
---|
933 | ISR03_16 proc far
|
---|
934 | push ebx
|
---|
935 | mov ebx, 3
|
---|
936 | call far ptr FLAT:Interrupt32
|
---|
937 | pop ebx
|
---|
938 | retf
|
---|
939 | ISR03_16 endp
|
---|
940 |
|
---|
941 | ALIGN 2
|
---|
942 | ISR04_16 proc far
|
---|
943 | push ebx
|
---|
944 | mov ebx, 4
|
---|
945 | call far ptr FLAT:Interrupt32
|
---|
946 | pop ebx
|
---|
947 | retf
|
---|
948 | ISR04_16 endp
|
---|
949 |
|
---|
950 | ALIGN 2
|
---|
951 | ISR05_16 proc far
|
---|
952 | push ebx
|
---|
953 | mov ebx, 5
|
---|
954 | call far ptr FLAT:Interrupt32
|
---|
955 | pop ebx
|
---|
956 | retf
|
---|
957 | ISR05_16 endp
|
---|
958 |
|
---|
959 | ALIGN 2
|
---|
960 | ISR06_16 proc far
|
---|
961 | push ebx
|
---|
962 | mov ebx, 6
|
---|
963 | call far ptr FLAT:Interrupt32
|
---|
964 | pop ebx
|
---|
965 | retf
|
---|
966 | ISR06_16 endp
|
---|
967 |
|
---|
968 | ALIGN 2
|
---|
969 | ISR07_16 proc far
|
---|
970 | push ebx
|
---|
971 | mov ebx, 7
|
---|
972 | call far ptr FLAT:Interrupt32
|
---|
973 | pop ebx
|
---|
974 | retf
|
---|
975 | ISR07_16 endp
|
---|
976 |
|
---|
977 | ;end of 16 bits code segment
|
---|
978 | __OffFinalCS16 label byte
|
---|
979 |
|
---|
980 | CODE16 ends
|
---|
981 |
|
---|
982 | CODE32 segment
|
---|
983 | ASSUME CS:FLAT, DS:FLAT, ES:FLAT
|
---|
984 |
|
---|
985 | public __GETDS
|
---|
986 | public thunk1632_devhelp
|
---|
987 | public thunk1632_devhelp_modified_ds
|
---|
988 | public DevHlp
|
---|
989 | public DevHlp_ModifiedDS
|
---|
990 | public STRATEGY_
|
---|
991 | public IDC_
|
---|
992 | public TIMER_
|
---|
993 | extrn ALSA_STRATEGY : near
|
---|
994 | extrn ALSA_IDC : near
|
---|
995 | extrn ALSA_TIMER_ : near
|
---|
996 | extrn ALSA_Interrupt : near
|
---|
997 | extrn GetTKSSBase : near
|
---|
998 | extrn _rdOffset: dword
|
---|
999 |
|
---|
1000 | IFDEF KEE
|
---|
1001 | extrn KernThunkStackTo16 : near
|
---|
1002 | extrn KernThunkStackTo32 : near
|
---|
1003 | ELSE
|
---|
1004 | extrn StackAlloc : near
|
---|
1005 | extrn StackFree : near
|
---|
1006 | ENDIF
|
---|
1007 |
|
---|
1008 | ;Called by Watcom to set the DS
|
---|
1009 | ALIGN 4
|
---|
1010 | __GETDS proc near
|
---|
1011 | push eax
|
---|
1012 | mov eax, DOS32FLATDS
|
---|
1013 | mov ds, eax
|
---|
1014 | pop eax
|
---|
1015 | ret
|
---|
1016 | __GETDS endp
|
---|
1017 |
|
---|
1018 | ALIGN 4
|
---|
1019 | DevHelpDebug proc near
|
---|
1020 | int 3
|
---|
1021 | int 3
|
---|
1022 | ret
|
---|
1023 | DevHelpDebug endp
|
---|
1024 |
|
---|
1025 | ALIGN 4
|
---|
1026 |
|
---|
1027 | ALIGN 4
|
---|
1028 | DevHlp proc near
|
---|
1029 | IFDEF FLATSTACK
|
---|
1030 | DevThunkStackTo16_Int
|
---|
1031 | ENDIF
|
---|
1032 |
|
---|
1033 | jmp far ptr CODE16:thunk3216_devhelp
|
---|
1034 | ALIGN 4
|
---|
1035 | thunk1632_devhelp:
|
---|
1036 | IFDEF FLATSTACK
|
---|
1037 | DevThunkStackTo32_Int
|
---|
1038 | ENDIF
|
---|
1039 | ret
|
---|
1040 | DevHlp endp
|
---|
1041 |
|
---|
1042 | ALIGN 4
|
---|
1043 | DevHlp_ModifiedDS proc near
|
---|
1044 | IFDEF FLATSTACK
|
---|
1045 | DevThunkStackTo16_Int
|
---|
1046 | ENDIF
|
---|
1047 | jmp far ptr CODE16:thunk3216_devhelp_modified_ds
|
---|
1048 | ALIGN 4
|
---|
1049 | thunk1632_devhelp_modified_ds:
|
---|
1050 | IFDEF FLATSTACK
|
---|
1051 | DevThunkStackTo32_Int
|
---|
1052 | ENDIF
|
---|
1053 | ret
|
---|
1054 | DevHlp_ModifiedDS endp
|
---|
1055 |
|
---|
1056 |
|
---|
1057 | IFNDEF KEE
|
---|
1058 | ;;******************************************************************************
|
---|
1059 | ;FixSelDPL:
|
---|
1060 | ;
|
---|
1061 | ; Set DPL of DOS32FLATDS selector to 0 or else we'll get a trap D when loading
|
---|
1062 | ; it into the SS register (DPL must equal CPL when loading a selector into SS)
|
---|
1063 | ;;******************************************************************************
|
---|
1064 | PUBLIC FixSelDPL
|
---|
1065 | ALIGN 4
|
---|
1066 | FixSelDPL proc near
|
---|
1067 | cmp fWrongDPL, 1
|
---|
1068 | jne short @@fixdpl_end
|
---|
1069 | cmp SelRef, 0
|
---|
1070 | jne short @@fixdpl_endfix
|
---|
1071 | push eax
|
---|
1072 | push ebx
|
---|
1073 | push edx
|
---|
1074 | sgdt fword ptr [gdtsave] ; access the GDT ptr
|
---|
1075 | mov ebx, dword ptr [gdtsave+2] ; get lin addr of GDT
|
---|
1076 | mov eax, ds ; build offset into table
|
---|
1077 | and eax, 0fffffff8h ; mask away DPL
|
---|
1078 | add ebx, eax ; build address
|
---|
1079 |
|
---|
1080 | mov eax, dword ptr [ebx+4]
|
---|
1081 | mov edx, eax
|
---|
1082 | shr edx, 13
|
---|
1083 | and edx, 3
|
---|
1084 |
|
---|
1085 | ;has the OS/2 kernel finally changed the DPL to 0?
|
---|
1086 | cmp edx, 0
|
---|
1087 | jne @@changedpl
|
---|
1088 | mov fWrongDPL, 0 ;don't bother anymore
|
---|
1089 | mov SelRef, 0
|
---|
1090 | jmp short @@endchange
|
---|
1091 |
|
---|
1092 | @@changedpl:
|
---|
1093 | mov oldDPL, eax
|
---|
1094 | and eax, NOT 6000h ;clear bits 5 & 6 in the high word (DPL)
|
---|
1095 | mov dword ptr [ebx+4], eax
|
---|
1096 | @@endchange:
|
---|
1097 | pop edx
|
---|
1098 | pop ebx
|
---|
1099 | pop eax
|
---|
1100 | @@fixdpl_endfix:
|
---|
1101 | inc SelRef
|
---|
1102 | @@fixdpl_end:
|
---|
1103 | ret
|
---|
1104 | FixSelDPL endp
|
---|
1105 | ;;******************************************************************************
|
---|
1106 | ; RestoreSelDPL:
|
---|
1107 | ;
|
---|
1108 | ; Restore DPL of DOS32FLATDS selector or else OS/2 kernel code running in ring 3
|
---|
1109 | ; will trap (during booting only; this sel has a DPL of 0 when PM starts up)
|
---|
1110 | ;;******************************************************************************
|
---|
1111 | PUBLIC RestoreSelDPL
|
---|
1112 | ALIGN 4
|
---|
1113 | RestoreSelDPL proc near
|
---|
1114 | cmp fWrongDPL, 1
|
---|
1115 | jne short @@restdpl_end
|
---|
1116 |
|
---|
1117 | cmp SelRef, 1
|
---|
1118 | jne short @@restdpl_endrest
|
---|
1119 | push eax
|
---|
1120 | push ebx
|
---|
1121 | sgdt fword ptr [gdtsave] ; access the GDT ptr
|
---|
1122 | mov ebx, dword ptr [gdtsave+2] ; get lin addr of GDT
|
---|
1123 | mov eax, ds ; build offset into table
|
---|
1124 | and eax, 0fffffff8h ; mask away DPL
|
---|
1125 | add ebx, eax ; build address
|
---|
1126 |
|
---|
1127 | mov eax, oldDPL
|
---|
1128 | mov dword ptr [ebx+4], eax
|
---|
1129 | pop ebx
|
---|
1130 | pop eax
|
---|
1131 | @@restdpl_endrest:
|
---|
1132 | dec SelRef
|
---|
1133 | @@restdpl_end:
|
---|
1134 | ret
|
---|
1135 | RestoreSelDPL endp
|
---|
1136 | ENDIF
|
---|
1137 |
|
---|
1138 | ;*******************************************************************************
|
---|
1139 | ;Copy parameters to 16 bits stack and call 16:32 IDC handler
|
---|
1140 | ;
|
---|
1141 | ; Paramters: IDC16_HANDLER pHandler
|
---|
1142 | ; ULONG cmd
|
---|
1143 | ; ULONG param1
|
---|
1144 | ; ULONG param2
|
---|
1145 | ;*******************************************************************************
|
---|
1146 | PUBLIC _CallPDD16
|
---|
1147 | ALIGN 4
|
---|
1148 | _CallPDD16 proc near
|
---|
1149 | push ebp
|
---|
1150 | mov ebp, esp
|
---|
1151 | push ebx
|
---|
1152 |
|
---|
1153 | lea ebx, [ebp+8]
|
---|
1154 | DevThunkStackTo16_Int
|
---|
1155 |
|
---|
1156 | push dword ptr [ebx+16] ;param2
|
---|
1157 | push dword ptr [ebx+12] ;param1
|
---|
1158 | push dword ptr [ebx+8] ;cmd
|
---|
1159 | call fword ptr [ebx]
|
---|
1160 | add sp, 12
|
---|
1161 |
|
---|
1162 | DevThunkStackTo32_Int
|
---|
1163 |
|
---|
1164 | pop ebx
|
---|
1165 | pop ebp
|
---|
1166 | ret
|
---|
1167 | _CallPDD16 endp
|
---|
1168 |
|
---|
1169 | ;*******************************************************************************
|
---|
1170 | ;Strategy entrypoint
|
---|
1171 | ; Parameter:
|
---|
1172 | ; fs:ebx -> request packet pointer
|
---|
1173 | ;*******************************************************************************
|
---|
1174 | ALIGN 4
|
---|
1175 | STRATEGY_ proc far
|
---|
1176 | push ds
|
---|
1177 | push es
|
---|
1178 | push fs
|
---|
1179 | push gs
|
---|
1180 |
|
---|
1181 | mov eax, DOS32FLATDS
|
---|
1182 | mov ds, eax
|
---|
1183 | mov es, eax
|
---|
1184 |
|
---|
1185 | IFDEF FLATSTACK
|
---|
1186 |
|
---|
1187 | IFNDEF KEE
|
---|
1188 | ;done in init.cpp for the KEE version
|
---|
1189 | cmp dword ptr [intSwitchStack], 0
|
---|
1190 | jne stratcontinue
|
---|
1191 |
|
---|
1192 | ;get TKSSBase & intSwitchStack pointers
|
---|
1193 | call GetTKSSBase
|
---|
1194 | stratcontinue:
|
---|
1195 | ENDIF
|
---|
1196 |
|
---|
1197 | DevThunkStackTo32
|
---|
1198 | cmp eax, 0
|
---|
1199 | jne @@stackswitchfail_strat
|
---|
1200 |
|
---|
1201 | call ALSA_STRATEGY
|
---|
1202 |
|
---|
1203 | DevThunkStackTo16
|
---|
1204 |
|
---|
1205 | @@stackswitchfail_strat:
|
---|
1206 | ELSE
|
---|
1207 | int 3
|
---|
1208 | call ALSA_STRATEGY
|
---|
1209 | ENDIF
|
---|
1210 |
|
---|
1211 | pop gs
|
---|
1212 | pop fs
|
---|
1213 | pop es
|
---|
1214 | pop ds
|
---|
1215 | retf
|
---|
1216 | STRATEGY_ endp
|
---|
1217 |
|
---|
1218 | ;*******************************************************************************
|
---|
1219 | ;IDC entrypoint
|
---|
1220 | ;
|
---|
1221 | ;in: ecx = cmd
|
---|
1222 | ; edx = ULONG parameter
|
---|
1223 | ;return value in eax
|
---|
1224 | ;*******************************************************************************
|
---|
1225 | ALIGN 4
|
---|
1226 | IDC_ proc far
|
---|
1227 | push ds
|
---|
1228 | push es
|
---|
1229 | push fs
|
---|
1230 | push gs
|
---|
1231 |
|
---|
1232 | mov eax, DOS32FLATDS
|
---|
1233 | mov ds, eax
|
---|
1234 | mov es, eax
|
---|
1235 |
|
---|
1236 | IFDEF FLATSTACK
|
---|
1237 | DevThunkStackTo32
|
---|
1238 | cmp eax, 0
|
---|
1239 | jne @@stackswitchfail_idc
|
---|
1240 |
|
---|
1241 | call ALSA_IDC
|
---|
1242 |
|
---|
1243 | DevThunkStackTo16
|
---|
1244 |
|
---|
1245 | @@stackswitchfail_idc:
|
---|
1246 |
|
---|
1247 | ELSE
|
---|
1248 | int 3
|
---|
1249 | call ALSA_IDC
|
---|
1250 | ENDIF
|
---|
1251 |
|
---|
1252 | pop gs
|
---|
1253 | pop fs
|
---|
1254 | pop es
|
---|
1255 | pop ds
|
---|
1256 | retf
|
---|
1257 | IDC_ endp
|
---|
1258 | ;*******************************************************************************
|
---|
1259 | ;Timer entrypoint
|
---|
1260 | ;
|
---|
1261 | ;*******************************************************************************
|
---|
1262 | ALIGN 4
|
---|
1263 | TIMER_ proc far
|
---|
1264 | push ds
|
---|
1265 | push es
|
---|
1266 | push fs
|
---|
1267 | push gs
|
---|
1268 |
|
---|
1269 | mov eax, DOS32FLATDS
|
---|
1270 | mov ds, eax
|
---|
1271 | mov es, eax
|
---|
1272 |
|
---|
1273 | IFDEF FLATSTACK
|
---|
1274 | DevThunkStackTo32
|
---|
1275 | cmp eax, 0
|
---|
1276 | jne @@stackswitchfail_timer
|
---|
1277 |
|
---|
1278 | call ALSA_TIMER_
|
---|
1279 |
|
---|
1280 | DevThunkStackTo16
|
---|
1281 |
|
---|
1282 | @@stackswitchfail_timer:
|
---|
1283 |
|
---|
1284 | ELSE
|
---|
1285 | int 3
|
---|
1286 | call ALSA_TIMER_
|
---|
1287 | ENDIF
|
---|
1288 |
|
---|
1289 | pop gs
|
---|
1290 | pop fs
|
---|
1291 | pop es
|
---|
1292 | pop ds
|
---|
1293 | retf
|
---|
1294 | TIMER_ endp
|
---|
1295 |
|
---|
1296 |
|
---|
1297 | ;*******************************************************************************
|
---|
1298 | ;32 bits interrupt wrapper which calls the generic interrupt handler in irq.cpp
|
---|
1299 | ;On entry:
|
---|
1300 | ; EBX = irq nr
|
---|
1301 | ;*******************************************************************************
|
---|
1302 | ALIGN 4
|
---|
1303 | Interrupt32 proc far
|
---|
1304 | enter 0, 0
|
---|
1305 | and sp, 0fffch ; align stack
|
---|
1306 |
|
---|
1307 | pushad
|
---|
1308 | push ds
|
---|
1309 | push es
|
---|
1310 | push fs
|
---|
1311 | push gs
|
---|
1312 |
|
---|
1313 | mov eax, DOS32FLATDS
|
---|
1314 | mov ds, eax
|
---|
1315 | mov es, eax
|
---|
1316 |
|
---|
1317 | pushfd
|
---|
1318 | cli
|
---|
1319 |
|
---|
1320 | IFDEF FLATSTACK
|
---|
1321 | DevThunkStackTo32
|
---|
1322 | cmp eax, 0
|
---|
1323 | jne @@stackswitchfail_irq
|
---|
1324 |
|
---|
1325 | ;returns irq status in eax (1=handled; 0=unhandled)
|
---|
1326 | call ALSA_Interrupt
|
---|
1327 |
|
---|
1328 | DevThunkStackTo16
|
---|
1329 |
|
---|
1330 | @@stackswitchfail_irq:
|
---|
1331 | ELSE
|
---|
1332 | int 3
|
---|
1333 | call ALSA_Interrupt
|
---|
1334 | ENDIF
|
---|
1335 |
|
---|
1336 | ;restore flags
|
---|
1337 | popfd
|
---|
1338 |
|
---|
1339 | cmp eax, 1
|
---|
1340 | je irqhandled
|
---|
1341 | stc ;tell OS/2 kernel we didn't handle this interrupt
|
---|
1342 | jmp short endofirq
|
---|
1343 |
|
---|
1344 | irqhandled:
|
---|
1345 | clc ;tell OS/2 kernel this interrupt was ours
|
---|
1346 |
|
---|
1347 | endofirq:
|
---|
1348 |
|
---|
1349 | pop gs
|
---|
1350 | pop fs
|
---|
1351 | pop es
|
---|
1352 | pop ds
|
---|
1353 | popad
|
---|
1354 |
|
---|
1355 | leave
|
---|
1356 | retf
|
---|
1357 | Interrupt32 endp
|
---|
1358 |
|
---|
1359 | ALIGN 4
|
---|
1360 | HelpClose proc far
|
---|
1361 | push ds
|
---|
1362 | mov eax, DOS32FLATDS
|
---|
1363 | mov ds, eax
|
---|
1364 | mov _rdOffset, 0
|
---|
1365 | pop ds
|
---|
1366 | retf
|
---|
1367 | HelpClose endp
|
---|
1368 |
|
---|
1369 |
|
---|
1370 | ;*******************************************************************************
|
---|
1371 | ;resource manager wrappers (switch stack and call 16 bits function)
|
---|
1372 | ;*******************************************************************************
|
---|
1373 | public _RMAllocResource
|
---|
1374 | public _RMDeallocResource
|
---|
1375 | public _RMCreateDevice
|
---|
1376 | public _RMCreateAdapter
|
---|
1377 | public _RMCreateDriver
|
---|
1378 | public _RMDestroyDriver
|
---|
1379 | public _RMGetNodeInfo
|
---|
1380 | public _RMDevIDToHandleList
|
---|
1381 | public _RMHandleToResourceHandleList
|
---|
1382 |
|
---|
1383 | ALIGN 4
|
---|
1384 |
|
---|
1385 | ALIGN 4
|
---|
1386 | _RMAllocResource proc near
|
---|
1387 | enterKEERM
|
---|
1388 | xor eax, eax
|
---|
1389 | push dword ptr [edi+16]
|
---|
1390 | push dword ptr [edi+12]
|
---|
1391 | push dword ptr [edi+8]
|
---|
1392 | call fword ptr RMAllocResource1632
|
---|
1393 | add sp, 12
|
---|
1394 | retKEERM
|
---|
1395 | _RMAllocResource endp
|
---|
1396 |
|
---|
1397 | ALIGN 4
|
---|
1398 | _RMDeallocResource proc near
|
---|
1399 | enterKEERM
|
---|
1400 | xor eax, eax
|
---|
1401 | push dword ptr [edi+12]
|
---|
1402 | push dword ptr [edi+8]
|
---|
1403 | call fword ptr RMDeallocResource1632
|
---|
1404 | add sp, 8
|
---|
1405 | retKEERM
|
---|
1406 | _RMDeallocResource endp
|
---|
1407 |
|
---|
1408 | ALIGN 4
|
---|
1409 | _RMCreateDevice proc near
|
---|
1410 | enterKEERM
|
---|
1411 | xor eax, eax
|
---|
1412 | push dword ptr [edi+24]
|
---|
1413 | push dword ptr [edi+20]
|
---|
1414 | push dword ptr [edi+16]
|
---|
1415 | push dword ptr [edi+12]
|
---|
1416 | push dword ptr [edi+8]
|
---|
1417 | call fword ptr RMCreateDevice1632
|
---|
1418 | add sp, 20
|
---|
1419 | retKEERM
|
---|
1420 | _RMCreateDevice endp
|
---|
1421 |
|
---|
1422 | ALIGN 4
|
---|
1423 | _RMCreateAdapter proc near
|
---|
1424 | enterKEERM
|
---|
1425 | xor eax, eax
|
---|
1426 | push dword ptr [edi+24]
|
---|
1427 | push dword ptr [edi+20]
|
---|
1428 | push dword ptr [edi+16]
|
---|
1429 | push dword ptr [edi+12]
|
---|
1430 | push dword ptr [edi+8]
|
---|
1431 | call fword ptr RMCreateAdapter1632
|
---|
1432 | add sp, 20
|
---|
1433 | retKEERM
|
---|
1434 | _RMCreateAdapter endp
|
---|
1435 |
|
---|
1436 | ALIGN 4
|
---|
1437 | _RMCreateDriver proc near
|
---|
1438 | enterKEERM
|
---|
1439 | xor eax, eax
|
---|
1440 | push dword ptr [edi+12]
|
---|
1441 | push dword ptr [edi+8]
|
---|
1442 | call fword ptr RMCreateDriver1632
|
---|
1443 | add sp, 8
|
---|
1444 | retKEERM
|
---|
1445 | _RMCreateDriver endp
|
---|
1446 |
|
---|
1447 | ALIGN 4
|
---|
1448 | _RMDestroyDriver proc near
|
---|
1449 | enterKEERM
|
---|
1450 | xor eax, eax
|
---|
1451 | push dword ptr [edi+8]
|
---|
1452 | call fword ptr RMDestroyDriver1632
|
---|
1453 | add sp, 4
|
---|
1454 | ret32
|
---|
1455 | _RMDestroyDriver endp
|
---|
1456 |
|
---|
1457 | ALIGN 4
|
---|
1458 | _RMGetNodeInfo proc near
|
---|
1459 | enterKEERM
|
---|
1460 | xor eax, eax
|
---|
1461 | push dword ptr [edi+16]
|
---|
1462 | push dword ptr [edi+12]
|
---|
1463 | push dword ptr [edi+8]
|
---|
1464 | call fword ptr RMGetNodeInfo1632
|
---|
1465 | add sp, 12
|
---|
1466 | retKEERM
|
---|
1467 | _RMGetNodeInfo endp
|
---|
1468 |
|
---|
1469 | ALIGN 4
|
---|
1470 | _RMDevIDToHandleList proc near
|
---|
1471 | enterKEERM
|
---|
1472 | xor eax, eax
|
---|
1473 | push dword ptr [edi+40]
|
---|
1474 | push dword ptr [edi+36]
|
---|
1475 | push dword ptr [edi+32]
|
---|
1476 | push dword ptr [edi+28]
|
---|
1477 | push dword ptr [edi+24]
|
---|
1478 | push dword ptr [edi+20]
|
---|
1479 | push dword ptr [edi+16]
|
---|
1480 | push dword ptr [edi+12]
|
---|
1481 | push dword ptr [edi+8]
|
---|
1482 | call fword ptr RMDevIDToHandleList1632
|
---|
1483 | add sp, 36
|
---|
1484 | retKEERM
|
---|
1485 | _RMDevIDToHandleList endp
|
---|
1486 |
|
---|
1487 | ALIGN 4
|
---|
1488 | _RMHandleToResourceHandleList proc near
|
---|
1489 | enterKEERM
|
---|
1490 | xor eax, eax
|
---|
1491 | push dword ptr [edi+12]
|
---|
1492 | push dword ptr [edi+8]
|
---|
1493 | call fword ptr RMHandleToResourceHandleList1632
|
---|
1494 | add sp, 8
|
---|
1495 | retKEERM
|
---|
1496 | _RMHandleToResourceHandleList endp
|
---|
1497 |
|
---|
1498 |
|
---|
1499 | CODE32 ends
|
---|
1500 |
|
---|
1501 | DATA32 segment
|
---|
1502 | public __OffsetFinalCS16
|
---|
1503 | public __OffsetFinalDS16
|
---|
1504 | public PDDName
|
---|
1505 | public _MSG_TABLE32
|
---|
1506 | public RMAllocResource1632
|
---|
1507 | public RMDeallocResource1632
|
---|
1508 | public RMCreateDevice1632
|
---|
1509 | public RMCreateAdapter1632
|
---|
1510 | public RMCreateDriver1632
|
---|
1511 | public RMDestroyDriver1632
|
---|
1512 | public RMGetNodeInfo1632
|
---|
1513 | public RMDevIDToHandleList1632
|
---|
1514 | public RMHandleToResourceHandleList1632
|
---|
1515 | public _TimerHandler16
|
---|
1516 | public _ISR00
|
---|
1517 | public _ISR01
|
---|
1518 | public _ISR02
|
---|
1519 | public _ISR03
|
---|
1520 | public _ISR04
|
---|
1521 | public _ISR05
|
---|
1522 | public _ISR06
|
---|
1523 | public _ISR07
|
---|
1524 |
|
---|
1525 | IFDEF FLATSTACK
|
---|
1526 | extrn intSwitchStack : dword
|
---|
1527 | ENDIF
|
---|
1528 |
|
---|
1529 | IFDEF KEE
|
---|
1530 | public stackbase
|
---|
1531 | public stacksel
|
---|
1532 |
|
---|
1533 | stackbase dd 0
|
---|
1534 | stacksel dd 0
|
---|
1535 | ELSE
|
---|
1536 |
|
---|
1537 | public gdtsave
|
---|
1538 | public fWrongDPL
|
---|
1539 | public oldDPL
|
---|
1540 | public SelRef
|
---|
1541 |
|
---|
1542 | tempeax dd 0
|
---|
1543 | tempedx dd 0
|
---|
1544 | tempesi dd 0
|
---|
1545 | cpuflags dd 0
|
---|
1546 |
|
---|
1547 | gdtsave dq 0
|
---|
1548 | fWrongDPL dd 1 ;DOS32FLATDS has the wrong DPL for SS
|
---|
1549 | SelRef dd 0
|
---|
1550 | oldDPL dd 0
|
---|
1551 |
|
---|
1552 | fInitStack dd 0
|
---|
1553 | ENDIF
|
---|
1554 |
|
---|
1555 | __OffsetFinalCS16 dw OFFSET CODE16:__OffFinalCS16
|
---|
1556 | __OffsetFinalDS16 dw OFFSET DATA16:__OffFinalDS16
|
---|
1557 |
|
---|
1558 | _MSG_TABLE32 dw OFFSET DATA16:_MSG_TABLE16
|
---|
1559 | dw SEG DATA16:_MSG_TABLE16
|
---|
1560 |
|
---|
1561 | ;16:16 address of driver name
|
---|
1562 | PDDName dw OFFSET DATA16:pddname16
|
---|
1563 | dw SEG DATA16:pddname16
|
---|
1564 |
|
---|
1565 | ;16:32 addresses of resource manager functions in 16 bits code segment
|
---|
1566 | RMAllocResource1632 dd OFFSET CODE16:_RMAllocResource16
|
---|
1567 | dw SEG CODE16:_RMAllocResource16
|
---|
1568 | dw 0
|
---|
1569 | RMDeallocResource1632 dd OFFSET CODE16:_RMDeallocResource16
|
---|
1570 | dw SEG CODE16:_RMDeallocResource16
|
---|
1571 | dw 0
|
---|
1572 | RMCreateDevice1632 dd OFFSET CODE16:_RMCreateDevice16
|
---|
1573 | dw SEG CODE16:_RMCreateDevice16
|
---|
1574 | dw 0
|
---|
1575 | RMCreateAdapter1632 dd OFFSET CODE16:_RMCreateAdapter16
|
---|
1576 | dw SEG CODE16:_RMCreateAdapter16
|
---|
1577 | dw 0
|
---|
1578 | RMCreateDriver1632 dd OFFSET CODE16:_RMCreateDriver16
|
---|
1579 | dw SEG CODE16:_RMCreateDriver16
|
---|
1580 | dw 0
|
---|
1581 | RMDestroyDriver1632 dd OFFSET CODE16:_RMDestroyDriver16
|
---|
1582 | dw SEG CODE16:_RMDestroyDriver16
|
---|
1583 | dw 0
|
---|
1584 | RMGetNodeInfo1632 dd OFFSET CODE16:_RMGetNodeInfo16
|
---|
1585 | dw SEG CODE16:_RMGetNodeInfo16
|
---|
1586 | dw 0
|
---|
1587 | RMDevIDToHandleList1632 dd OFFSET CODE16:_RMDevIDToHandleList16
|
---|
1588 | dw SEG CODE16:_RMDevIDToHandleList16
|
---|
1589 | dw 0
|
---|
1590 |
|
---|
1591 | RMHandleToResourceHandleList1632 dd OFFSET CODE16:_RMHandleToResourceHandleList16
|
---|
1592 | dw SEG CODE16:_RMHandleToResourceHandleList16
|
---|
1593 | dw 0
|
---|
1594 |
|
---|
1595 | ;16:16 address of uniaud_stub_timer
|
---|
1596 | _TimerHandler16 dd OFFSET CODE16:uniaud_stub_timer
|
---|
1597 | dw OFFSET CODE16:uniaud_stub_timer
|
---|
1598 |
|
---|
1599 | ;16:16 addresses of interrupt dispatchers
|
---|
1600 | _ISR00 dw OFFSET CODE16:ISR00_16
|
---|
1601 | dw SEG CODE16:ISR00_16
|
---|
1602 | _ISR01 dw OFFSET CODE16:ISR01_16
|
---|
1603 | dw SEG CODE16:ISR01_16
|
---|
1604 | _ISR02 dw OFFSET CODE16:ISR02_16
|
---|
1605 | dw SEG CODE16:ISR02_16
|
---|
1606 | _ISR03 dw OFFSET CODE16:ISR03_16
|
---|
1607 | dw SEG CODE16:ISR03_16
|
---|
1608 | _ISR04 dw OFFSET CODE16:ISR04_16
|
---|
1609 | dw SEG CODE16:ISR04_16
|
---|
1610 | _ISR05 dw OFFSET CODE16:ISR05_16
|
---|
1611 | dw SEG CODE16:ISR05_16
|
---|
1612 | _ISR06 dw OFFSET CODE16:ISR06_16
|
---|
1613 | dw SEG CODE16:ISR06_16
|
---|
1614 | _ISR07 dw OFFSET CODE16:ISR07_16
|
---|
1615 | dw SEG CODE16:ISR07_16
|
---|
1616 | DATA32 ends
|
---|
1617 |
|
---|
1618 | end
|
---|
1619 |
|
---|