AsyncQue.asm
上传用户:lnzz01
上传日期:2013-05-23
资源大小:130k
文件大小:3k
- .386p
- .xlist
-
- include vmm.inc
- include blockdev.inc
- include ior.inc
- include iop.inc
- include dcb.inc
- MASM=1
- include ifs.inc
- include ifsmgr.inc
- include ilb.inc
- include debug.inc
- include med.inc ; required for iodebug.inc
- ; include iodebug.inc ; various IOS assertions (like AssertIOP)
-
- .list
- memcpy proto C, pd:ptr, ps:ptr, size_t:DWORD
- VXD_LOCKED_DATA_SEG
- extrn milb:DWORD
- public hFile
- hFile dw 0
- VXD_LOCKED_DATA_ENDS
- ;;;;;;;;;;;;;;;;;;;
- VXD_LOCKED_CODE_SEG
- OnCDRomIOCtl proto stdcall, IOR_ptr:DWORD
- ;;;==========================================
- PAGE
- SUBTTL OnAsyncRequest
- BeginProc OnAsyncRequest,esp
- ArgVar IOP_ptr, DWORD
- TRAP
- EnterProc
-
- mov ebx, IOP_ptr
- ; AssertIOP <ebx>
- .ERRNZ IOR_READ - 0
- .ERRNZ IOR_WRITE - 1
- .ERRNZ IOR_VERIFY - 2
- .ERRNZ IOR_MEDIA_CHECK_RESET - 06H
- mov [ebx].IOP_ior.IOR_status, IORS_SUCCESS
- mov eax, DCB_DEV_IO_ACTIVE
- or [ebx].IOP_physical_dcb.DCB_device_flags, eax
-
- movzx eax, [ebx].IOP_ior.IOR_func
- cmp eax, IOR_FORMAT
- ja On_Call_Down
-
- cmp eax, IOR_READ
- je Read_cd
-
- cmp eax, IOR_MEDIA_CHECK_RESET
- je Media_check
- cmp eax, IOR_GEN_IOCTL
- je Gen_IOctl
- cmp eax, IOR_COMPUTE_GEOM
- je Compute_geom
- On_Call_Down:
-
- mov eax, DCB_DEV_IO_ACTIVE
- xor [ebx].IOP_physical_dcb.DCB_device_flags, eax
- cmp [ebx].IOP_ior.IOR_func, IOR_RESTART_QUEUE
- jne @F
- mov [ebx].IOP_ior.IOR_status, IORS_SUCCESS
- jmp Callback_next
-
- @@:
- mov [ebx].IOP_ior.IOR_status, IORS_INVALID_COMMAND
- On_Call_Back:
-
- mov eax, DCB_DEV_IO_ACTIVE
- xor [ebx].IOP_physical_dcb.DCB_device_flags, eax
- Callback_next:
- mov eax, [ebx].IOP_callback_ptr
- sub eax, size IOP_callback_entry
- mov [ebx].IOP_callback_ptr, eax
-
- push ebx
- call dword ptr [eax]
- add esp, 4
-
- LeaveProc ; deallocute local variable
- Return
- Media_check:
- mov [ebx].IOP_ior.IOR_status, IORS_NOT_READY
- jmp On_Call_Back
- Read_cd:
- cmp [ebx].IOP_ior.IOR_start_addr, 10h
- jb invalid_sector
- movzx eax, hFile
- Test eax, eax
- jnz @F
- ; call OpenImgFile // 用于打开镜像文件的 OpenImgFile 函数未建立。
- ; 可以通过呼叫 0 级文件系统建立。
- test ax,ax
- jz @F
- @@:
- mov [ebx].IOP_ior.IOR_status, IORS_NO_MEDIA
- jmp On_Call_Back
- invalid_sector:
- mov [ebx].IOP_ior.IOR_status, IORS_INVALID_SECTOR
- jmp On_Call_Back
- Gen_IOctl:
- invoke OnCDRomIOCtl, addr [ebx.IOP_ior]
- jmp On_Call_Back
- Compute_geom:
- mov [ebx].IOP_ior.IOR_status, IORS_SUCCESS
- jmp On_Call_Back
- EndProc OnAsyncRequest
- VXD_LOCKED_CODE_ENDS
- end