📄 waitmask.cod
字号:
; Listing generated by Microsoft (R) Optimizing Compiler Version 12.00.9044.0
TITLE F:\W2DDK\src\kernel\serial\waitmask.c
.386P
include listing.inc
if @Version gt 510
.model FLAT
else
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
_DATA SEGMENT DWORD USE32 PUBLIC 'DATA'
_DATA ENDS
CONST SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST ENDS
_BSS SEGMENT DWORD USE32 PUBLIC 'BSS'
_BSS ENDS
$$SYMBOLS SEGMENT BYTE USE32 'DEBSYM'
$$SYMBOLS ENDS
$$TYPES SEGMENT BYTE USE32 'DEBTYP'
$$TYPES ENDS
_TLS SEGMENT DWORD USE32 PUBLIC 'TLS'
_TLS ENDS
PAGESER SEGMENT PARA USE32 PUBLIC ''
PAGESER ENDS
; COMDAT _RtlConvertLongToLargeInteger@4
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
; COMDAT _SerialStartMask@4
PAGESER SEGMENT PARA USE32 PUBLIC ''
PAGESER ENDS
; COMDAT _SerialGrabWaitFromIsr@4
PAGESER SEGMENT PARA USE32 PUBLIC ''
PAGESER ENDS
; COMDAT _SerialGiveWaitToIsr@4
PAGESER SEGMENT PARA USE32 PUBLIC ''
PAGESER ENDS
; COMDAT _SerialFinishOldWait@4
PAGESER SEGMENT PARA USE32 PUBLIC ''
PAGESER ENDS
; COMDAT _SerialCancelWait@8
PAGESER SEGMENT PARA USE32 PUBLIC ''
PAGESER ENDS
; COMDAT _SerialCompleteWait@16
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
FLAT GROUP _DATA, CONST, _BSS
ASSUME CS: FLAT, DS: FLAT, SS: FLAT
endif
INCLUDELIB LIBC
INCLUDELIB OLDNAMES
PUBLIC _SerialGiveWaitToIsr@4
PUBLIC _SerialFinishOldWait@4
PUBLIC _SerialStartMask@4
PUBLIC _SerialCancelWait@8
EXTRN __imp__KeSynchronizeExecution@12:NEAR
EXTRN _SerialDebugLevel:DWORD
EXTRN __imp_@InterlockedExchange@8:NEAR
EXTRN __imp__KeGetCurrentIrql@0:NEAR
EXTRN __imp__RtlAssert@16:NEAR
EXTRN __imp__IoAcquireCancelSpinLock@4:NEAR
EXTRN _DbgPrint:NEAR
EXTRN _SerialGlobals:BYTE
EXTRN _SerialGetNextIrp@20:NEAR
EXTRN __imp__IoReleaseCancelSpinLock@4:NEAR
EXTRN _SerialGetNextIrpLocked@24:NEAR
; COMDAT _SerialStartMask@4
; File f:\w2ddk\src\kernel\serial\waitmask.c
PAGESER SEGMENT
$SG14820 DB 'SERIAL: Pageable code called at IRQL %d without lock ', 0aH
DB 00H
ORG $+1
$SG14823 DB 'f:\w2ddk\src\kernel\serial\waitmask.c', 00H
ORG $+2
$SG14824 DB 'FALSE', 00H
ORG $+2
$SG14831 DB 'SERIAL: In SerialStartMask', 0aH, 00H
$SG14840 DB 'f:\w2ddk\src\kernel\serial\waitmask.c', 00H
ORG $+2
$SG14841 DB 'Extension->CurrentMaskIrp', 00H
ORG $+2
$SG14851 DB 'SERIAL: STARMASK - CurrentMaskIrp: %x', 0aH, 00H
ORG $+1
$SG14860 DB 'f:\w2ddk\src\kernel\serial\waitmask.c', 00H
ORG $+2
$SG14861 DB '(IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCT'
DB 'L_SERIAL_WAIT_ON_MASK) || (IrpSp->Parameters.DeviceIoControl.'
DB 'IoControlCode == IOCTL_SERIAL_SET_WAIT_MASK)', 00H
ORG $+2
$SG14869 DB 'SERIAL - %x is a SETMASK irp', 0aH, 00H
ORG $+2
$SG14878 DB 'f:\w2ddk\src\kernel\serial\waitmask.c', 00H
ORG $+2
$SG14879 DB '!Extension->IrpMaskLocation', 00H
$SG14888 DB 'SERIAL: %x was the first irp processed by this', 0aH, '-'
DB '------ invocation of startmask', 0aH, 00H
$SG14902 DB 'SERIAL: Perhaps another mask irp was found in the queue', 0aH
DB '------- %x/%x <- values should be the same', 0aH, 00H
$SG14963 DB 'SERIAL: %x irp was already marked as cancelled', 0aH, 00H
ORG $+4
$SG14978 DB 'SERIAL: %x was the first irp processed by this', 0aH, '-'
DB '------ invocation of startmask', 0aH, 00H
$SG14992 DB 'SERIAL: Perhaps another mask irp was found in the queue', 0aH
DB '------- %x/%x <- values should be the same', 0aH, 00H
$SG15006 DB 'SERIAL: %x will become the current wait irp', 0aH, 00H
ORG $+7
$SG15020 DB 'SERIAL: %x was the first irp processed by this', 0aH, '-'
DB '------ invocation of startmask', 0aH, 00H
$SG15030 DB 'f:\w2ddk\src\kernel\serial\waitmask.c', 00H
ORG $+2
$SG15031 DB '!Extension->IrpMaskLocation', 00H
$SG15034 DB 'f:\w2ddk\src\kernel\serial\waitmask.c', 00H
ORG $+2
$SG15035 DB '!Extension->CurrentWaitIrp', 00H
ORG $+1
$SG15057 DB 'f:\w2ddk\src\kernel\serial\waitmask.c', 00H
ORG $+2
$SG15058 DB '!(*_arg4 & _refType)', 00H
ORG $+3
$SG15066 DB 'SERIAL: Perhaps another mask irp was found in the queue', 0aH
DB '------- %x/%x <- values should be the same', 0aH, 00H
ORG $+4
$SG14918 DB 'SERIAL: WaitIrp is invalid', 0aH, '------- IsrWaitMask: '
DB '%x', 0aH, '------- CurrentWaitIrp: %x', 0aH, 00H
ORG $+1
$SG14933 DB 'SERIAL: %x was the first irp processed by this', 0aH, '-'
DB '------ invocation of startmask', 0aH, 00H
$SG14947 DB 'SERIAL: Perhaps another mask irp was found in the queue', 0aH
DB '------- %x/%x <- values should be the same', 0aH, 00H
; Function compile flags: /Ogs
_Extension$ = 8
_NewIrp$ = -8
_SetFirstStatus$ = -1
_FirstStatus$ = 8
_OldIrql$14955 = -12
_SerialStartMask@4 PROC NEAR ; COMDAT
; 81 : {
00674 55 push ebp
00675 8b ec mov ebp, esp
00677 83 ec 0c sub esp, 12 ; 0000000cH
; 82 :
; 83 : //
; 84 : // The current stack location. This contains much of the
; 85 : // information we need to process this particular request.
; 86 : //
; 87 : PIO_STACK_LOCATION IrpSp;
; 88 :
; 89 : PIRP NewIrp;
; 90 :
; 91 : BOOLEAN SetFirstStatus = FALSE;
0067a 80 65 ff 00 and BYTE PTR _SetFirstStatus$[ebp], 0
0067e 53 push ebx
0067f 56 push esi
00680 57 push edi
; 92 : NTSTATUS FirstStatus;
; 93 :
; 94 : SERIAL_LOCKED_PAGED_CODE();
00681 8b 3d 00 00 00
00 mov edi, DWORD PTR __imp__KeGetCurrentIrql@0
00687 ff d7 call edi
00689 3c 01 cmp al, 1
0068b 76 2f jbe SHORT $L14825
0068d 83 3d 14 00 00
00 00 cmp DWORD PTR _SerialGlobals+20, 0
00694 75 26 jne SHORT $L14825
00696 ff d7 call edi
00698 0f b6 c0 movzx eax, al
0069b 50 push eax
0069c 68 00 00 00 00 push OFFSET FLAT:$SG14820
006a1 e8 00 00 00 00 call _DbgPrint
006a6 59 pop ecx
006a7 59 pop ecx
006a8 6a 00 push 0
006aa 6a 5e push 94 ; 0000005eH
006ac 68 00 00 00 00 push OFFSET FLAT:$SG14823
006b1 68 00 00 00 00 push OFFSET FLAT:$SG14824
006b6 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L14825:
; 95 :
; 96 : SerialDump(
; 97 : SERDIAG3,
; 98 : ("SERIAL: In SerialStartMask\n")
; 99 : );
006bc f6 05 00 00 00
00 04 test BYTE PTR _SerialDebugLevel, 4
006c3 74 0b je SHORT $L14826
006c5 68 00 00 00 00 push OFFSET FLAT:$SG14831
006ca e8 00 00 00 00 call _DbgPrint
006cf 59 pop ecx
$L14826:
; 100 :
; 101 : ASSERT(Extension->CurrentMaskIrp);
006d0 8b 5d 08 mov ebx, DWORD PTR _Extension$[ebp]
006d3 8d bb cc 00 00
00 lea edi, DWORD PTR [ebx+204]
006d9 83 3f 00 cmp DWORD PTR [edi], 0
006dc 75 14 jne SHORT $L14842
006de 6a 00 push 0
006e0 6a 65 push 101 ; 00000065H
006e2 68 00 00 00 00 push OFFSET FLAT:$SG14840
006e7 68 00 00 00 00 push OFFSET FLAT:$SG14841
006ec ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L14842:
; 102 :
; 103 : do {
; 104 :
; 105 : SerialDump(
; 106 : SERDIAG4,
; 107 : ("SERIAL: STARMASK - CurrentMaskIrp: %x\n",Extension->CurrentMaskIrp)
; 108 : );
006f2 f6 05 00 00 00
00 08 test BYTE PTR _SerialDebugLevel, 8
006f9 74 0e je SHORT $L14846
006fb ff 37 push DWORD PTR [edi]
006fd 68 00 00 00 00 push OFFSET FLAT:$SG14851
00702 e8 00 00 00 00 call _DbgPrint
00707 59 pop ecx
00708 59 pop ecx
$L14846:
; 109 : IrpSp = IoGetCurrentIrpStackLocation(Extension->CurrentMaskIrp);
00709 8b 07 mov eax, DWORD PTR [edi]
0070b 8b 70 60 mov esi, DWORD PTR [eax+96]
; 110 :
; 111 : ASSERT((IrpSp->Parameters.DeviceIoControl.IoControlCode ==
; 112 : IOCTL_SERIAL_WAIT_ON_MASK) ||
; 113 : (IrpSp->Parameters.DeviceIoControl.IoControlCode ==
; 114 : IOCTL_SERIAL_SET_WAIT_MASK));
0070e 8b 46 0c mov eax, DWORD PTR [esi+12]
00711 3d 48 00 1b 00 cmp eax, 1769544 ; 001b0048H
00716 74 1b je SHORT $L14858
00718 3d 44 00 1b 00 cmp eax, 1769540 ; 001b0044H
0071d 74 14 je SHORT $L14858
0071f 6a 00 push 0
00721 6a 72 push 114 ; 00000072H
00723 68 00 00 00 00 push OFFSET FLAT:$SG14860
00728 68 00 00 00 00 push OFFSET FLAT:$SG14861
0072d ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L14858:
; 115 :
; 116 : if (IrpSp->Parameters.DeviceIoControl.IoControlCode ==
; 117 : IOCTL_SERIAL_SET_WAIT_MASK) {
00733 81 7e 0c 44 00
1b 00 cmp DWORD PTR [esi+12], 1769540 ; 001b0044H
0073a 0f 85 a2 00 00
00 jne $L14862
; 118 :
; 119 : SerialDump(
; 120 : SERDIAG4,
; 121 : ("SERIAL - %x is a SETMASK irp\n",Extension->CurrentMaskIrp)
; 122 : );
00740 f6 05 00 00 00
00 08 test BYTE PTR _SerialDebugLevel, 8
00747 74 0e je SHORT $L14864
00749 ff 37 push DWORD PTR [edi]
0074b 68 00 00 00 00 push OFFSET FLAT:$SG14869
00750 e8 00 00 00 00 call _DbgPrint
00755 59 pop ecx
00756 59 pop ecx
$L14864:
; 123 :
; 124 : //
; 125 : // Complete the old wait if there is one.
; 126 : //
; 127 :
; 128 : KeSynchronizeExecution(
; 129 : Extension->Interrupt,
; 130 : SerialFinishOldWait,
; 131 : Extension
; 132 : );
00757 53 push ebx
00758 68 00 00 00 00 push OFFSET FLAT:_SerialFinishOldWait@4
0075d ff b3 a0 00 00
00 push DWORD PTR [ebx+160]
00763 ff 15 00 00 00
00 call DWORD PTR __imp__KeSynchronizeExecution@12
; 133 :
; 134 : //
; 135 : // Any current waits should be on its way to completion
; 136 : // at this point. There certainly shouldn't be any
; 137 : // irp mask location.
; 138 : //
; 139 :
; 140 : ASSERT(!Extension->IrpMaskLocation);
00769 33 f6 xor esi, esi
0076b 39 b3 18 01 00
00 cmp DWORD PTR [ebx+280], esi
00771 74 16 je SHORT $L14876
00773 56 push esi
00774 68 8c 00 00 00 push 140 ; 0000008cH
00779 68 00 00 00 00 push OFFSET FLAT:$SG14878
0077e 68 00 00 00 00 push OFFSET FLAT:$SG14879
00783 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L14876:
; 141 :
; 142 : Extension->CurrentMaskIrp->IoStatus.Status = STATUS_SUCCESS;
00789 8b 07 mov eax, DWORD PTR [edi]
; 143 :
; 144 : if (!SetFirstStatus) {
0078b 80 7d ff 00 cmp BYTE PTR _SetFirstStatus$[ebp], 0
0078f 89 70 18 mov DWORD PTR [eax+24], esi
00792 75 1e jne SHORT $L14881
; 145 :
; 146 : SerialDump(
; 147 : SERDIAG4,
; 148 : ("SERIAL: %x was the first irp processed by this\n"
; 149 : "------- invocation of startmask\n",Extension->CurrentMaskIrp)
; 150 : );
00794 f6 05 00 00 00
00 08 test BYTE PTR _SerialDebugLevel, 8
0079b 74 0e je SHORT $L14883
0079d ff 37 push DWORD PTR [edi]
0079f 68 00 00 00 00 push OFFSET FLAT:$SG14888
007a4 e8 00 00 00 00 call _DbgPrint
007a9 59 pop ecx
007aa 59 pop ecx
$L14883:
; 151 : FirstStatus = STATUS_SUCCESS;
007ab 89 75 08 mov DWORD PTR _FirstStatus$[ebp], esi
; 152 : SetFirstStatus = TRUE;
007ae c6 45 ff 01 mov BYTE PTR _SetFirstStatus$[ebp], 1
$L14881:
; 153 :
; 154 : }
; 155 :
; 156 : //
; 157 : // The following call will also cause the current
; 158 : // call to be completed.
; 159 : //
; 160 :
; 161 : SerialGetNextIrp(
; 162 : &Extension->CurrentMaskIrp,
; 163 : &Extension->MaskQueue,
; 164 : &NewIrp,
; 165 : TRUE,
; 166 : Extension
; 167 : );
007b2 53 push ebx
007b3 8d 45 f8 lea eax, DWORD PTR _NewIrp$[ebp]
007b6 6a 01 push 1
007b8 50 push eax
007b9 8d 83 b4 00 00
00 lea eax, DWORD PTR [ebx+180]
007bf 50 push eax
007c0 57 push edi
007c1 e8 00 00 00 00 call _SerialGetNextIrp@20
; 168 : SerialDump(
; 169 : SERDIAG4,
; 170 : ("SERIAL: Perhaps another mask irp was found in the queue\n"
; 171 : "------- %x/%x <- values should be the same\n",
; 172 : Extension->CurrentMaskIrp,NewIrp)
; 173 : );
007c6 f6 05 00 00 00
00 08 test BYTE PTR _SerialDebugLevel, 8
007cd 0f 84 49 02 00
00 je $L15062
007d3 ff 75 f8 push DWORD PTR _NewIrp$[ebp]
007d6 ff 37 push DWORD PTR [edi]
007d8 68 00 00 00 00 push OFFSET FLAT:$SG14902
; 174 :
; 175 :
; 176 : } else {
007dd e9 32 02 00 00 jmp $L15406
$L14862:
; 177 :
; 178 : //
; 179 : // First make sure that we have a non-zero mask.
; 180 : // If the app queues a wait on a zero mask it can't
; 181 : // be statisfied so it makes no sense to start it.
; 182 : //
; 183 :
; 184 : if ((!Extension->IsrWaitMask) || (Extension->CurrentWaitIrp)) {
007e2 8b 83 10 01 00
00 mov eax, DWORD PTR [ebx+272]
007e8 33 f6 xor esi, esi
007ea 3b c6 cmp eax, esi
007ec 0f 84 b0 01 00
00 je $L14912
007f2 39 b3 d4 00 00
00 cmp DWORD PTR [ebx+212], esi
007f8 0f 85 a4 01 00
00 jne $L14912
; 222 :
; 223 : } else {
; 224 :
; 225 : KIRQL OldIrql;
; 226 :
; 227 : //
; 228 : // Make the current mask irp the current wait irp and
; 229 : // get a new current mask irp. Note that when we get
; 230 : // the new current mask irp we DO NOT complete the
; 231 : // old current mask irp (which is now the current wait
; 232 : // irp.
; 233 : //
; 234 : // Then under the protection of the cancel spin lock
; 235 : // we check to see if the current wait irp needs to
; 236 : // be canceled
; 237 : //
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -