📄 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 __imp_@InterlockedExchange@8:NEAR
EXTRN __imp__IoAcquireCancelSpinLock@4:NEAR
EXTRN _SerialGetNextIrp@20:NEAR
EXTRN _SerialGetNextIrpLocked@24:NEAR
EXTRN __imp__IoReleaseCancelSpinLock@4:NEAR
; Function compile flags: /Ogsy
; File f:\w2ddk\src\kernel\serial\waitmask.c
; COMDAT _SerialStartMask@4
PAGESER SEGMENT
_Extension$ = 8
_NewIrp$ = 8
_SetFirstStatus$ = -1
_FirstStatus$ = -8
_OldIrql$14819 = -12
_SerialStartMask@4 PROC NEAR ; COMDAT
; 81 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 83 ec 0c sub esp, 12 ; 0000000cH
00006 53 push ebx
00007 56 push esi
; 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;
00008 8b 75 08 mov esi, DWORD PTR _Extension$[ebp]
0000b 33 db xor ebx, ebx
0000d 57 push edi
0000e 88 5d ff mov BYTE PTR _SetFirstStatus$[ebp], bl
00011 8d be cc 00 00
00 lea edi, DWORD PTR [esi+204]
$L14784:
; 92 : NTSTATUS FirstStatus;
; 93 :
; 94 : SERIAL_LOCKED_PAGED_CODE();
; 95 :
; 96 : SerialDump(
; 97 : SERDIAG3,
; 98 : ("SERIAL: In SerialStartMask\n")
; 99 : );
; 100 :
; 101 : ASSERT(Extension->CurrentMaskIrp);
; 102 :
; 103 : do {
; 104 :
; 105 : SerialDump(
; 106 : SERDIAG4,
; 107 : ("SERIAL: STARMASK - CurrentMaskIrp: %x\n",Extension->CurrentMaskIrp)
; 108 : );
; 109 : IrpSp = IoGetCurrentIrpStackLocation(Extension->CurrentMaskIrp);
00017 8b 07 mov eax, DWORD PTR [edi]
; 110 :
; 111 : ASSERT((IrpSp->Parameters.DeviceIoControl.IoControlCode ==
; 112 : IOCTL_SERIAL_WAIT_ON_MASK) ||
; 113 : (IrpSp->Parameters.DeviceIoControl.IoControlCode ==
; 114 : IOCTL_SERIAL_SET_WAIT_MASK));
; 115 :
; 116 : if (IrpSp->Parameters.DeviceIoControl.IoControlCode ==
; 117 : IOCTL_SERIAL_SET_WAIT_MASK) {
00019 8b 48 60 mov ecx, DWORD PTR [eax+96]
0001c 81 79 0c 44 00
1b 00 cmp DWORD PTR [ecx+12], 1769540 ; 001b0044H
00023 75 28 jne SHORT $L14790
; 118 :
; 119 : SerialDump(
; 120 : SERDIAG4,
; 121 : ("SERIAL - %x is a SETMASK irp\n",Extension->CurrentMaskIrp)
; 122 : );
; 123 :
; 124 : //
; 125 : // Complete the old wait if there is one.
; 126 : //
; 127 :
; 128 : KeSynchronizeExecution(
; 129 : Extension->Interrupt,
; 130 : SerialFinishOldWait,
; 131 : Extension
; 132 : );
00025 56 push esi
00026 68 00 00 00 00 push OFFSET FLAT:_SerialFinishOldWait@4
0002b ff b6 a0 00 00
00 push DWORD PTR [esi+160]
00031 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);
; 141 :
; 142 : Extension->CurrentMaskIrp->IoStatus.Status = STATUS_SUCCESS;
00037 8b 07 mov eax, DWORD PTR [edi]
; 143 :
; 144 : if (!SetFirstStatus) {
00039 38 5d ff cmp BYTE PTR _SetFirstStatus$[ebp], bl
0003c 89 58 18 mov DWORD PTR [eax+24], ebx
0003f 0f 85 dd 00 00
00 jne $L14810
; 145 :
; 146 : SerialDump(
; 147 : SERDIAG4,
; 148 : ("SERIAL: %x was the first irp processed by this\n"
; 149 : "------- invocation of startmask\n",Extension->CurrentMaskIrp)
; 150 : );
; 151 : FirstStatus = STATUS_SUCCESS;
00045 89 5d f8 mov DWORD PTR _FirstStatus$[ebp], ebx
; 152 : SetFirstStatus = TRUE;
; 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 : );
; 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 : );
; 174 :
; 175 :
; 176 : } else {
00048 e9 d1 00 00 00 jmp $L15008
$L14790:
; 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)) {
0004d 39 9e 10 01 00
00 cmp DWORD PTR [esi+272], ebx
00053 0f 84 b5 00 00
00 je $L14806
00059 39 9e d4 00 00
00 cmp DWORD PTR [esi+212], ebx
0005f 0f 85 a9 00 00
00 jne $L14806
; 216 : SerialDump(
; 217 : SERDIAG4,
; 218 : ("SERIAL: Perhaps another mask irp was found in the queue\n"
; 219 : "------- %x/%x <- values should be the same\n",
; 220 : Extension->CurrentMaskIrp,NewIrp)
; 221 : );
; 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 : //
; 238 :
; 239 : IoAcquireCancelSpinLock(&OldIrql);
00065 8d 45 f4 lea eax, DWORD PTR _OldIrql$14819[ebp]
00068 50 push eax
00069 ff 15 00 00 00
00 call DWORD PTR __imp__IoAcquireCancelSpinLock@4
; 240 :
; 241 : if (Extension->CurrentMaskIrp->Cancel) {
0006f 8b 07 mov eax, DWORD PTR [edi]
00071 38 58 24 cmp BYTE PTR [eax+36], bl
00074 74 24 je SHORT $L14834
; 242 :
; 243 : SerialDump(
; 244 : SERDIAG4,
; 245 : ("SERIAL: %x irp was already marked as cancelled\n",
; 246 : Extension->CurrentMaskIrp)
; 247 : );
; 248 : IoReleaseCancelSpinLock(OldIrql);
00076 ff 75 f4 push DWORD PTR _OldIrql$14819[ebp]
00079 ff 15 00 00 00
00 call DWORD PTR __imp__IoReleaseCancelSpinLock@4
; 249 : Extension->CurrentMaskIrp->IoStatus.Status = STATUS_CANCELLED;
0007f 8b 0f mov ecx, DWORD PTR [edi]
; 250 :
; 251 : if (!SetFirstStatus) {
00081 38 5d ff cmp BYTE PTR _SetFirstStatus$[ebp], bl
00084 b8 20 01 00 c0 mov eax, -1073741536 ; c0000120H
00089 89 41 18 mov DWORD PTR [ecx+24], eax
0008c 0f 85 90 00 00
00 jne $L14810
; 252 :
; 253 : SerialDump(
; 254 : SERDIAG4,
; 255 : ("SERIAL: %x was the first irp processed by this\n"
; 256 : "------- invocation of startmask\n",Extension->CurrentMaskIrp)
; 257 : );
; 258 : FirstStatus = STATUS_CANCELLED;
00092 89 45 f8 mov DWORD PTR _FirstStatus$[ebp], eax
; 259 : SetFirstStatus = TRUE;
; 260 :
; 261 : }
; 262 :
; 263 : SerialGetNextIrp(
; 264 : &Extension->CurrentMaskIrp,
; 265 : &Extension->MaskQueue,
; 266 : &NewIrp,
; 267 : TRUE,
; 268 : Extension
; 269 : );
; 270 : SerialDump(
; 271 : SERDIAG4,
; 272 : ("SERIAL: Perhaps another mask irp was found in the queue\n"
; 273 : "------- %x/%x <- values should be the same\n",
; 274 : Extension->CurrentMaskIrp,NewIrp)
; 275 : );
; 276 :
; 277 : } else {
00095 e9 84 00 00 00 jmp $L15008
$L14834:
; 278 :
; 279 : SerialDump(
; 280 : SERDIAG4,
; 281 : ("SERIAL: %x will become the current wait irp\n",
; 282 : Extension->CurrentMaskIrp)
; 283 : );
; 284 : if (!SetFirstStatus) {
0009a 38 5d ff cmp BYTE PTR _SetFirstStatus$[ebp], bl
0009d 75 12 jne SHORT $L14837
; 285 :
; 286 : SerialDump(
; 287 : SERDIAG4,
; 288 : ("SERIAL: %x was the first irp processed by this\n"
; 289 : "------- invocation of startmask\n",Extension->CurrentMaskIrp)
; 290 : );
; 291 : FirstStatus = STATUS_PENDING;
; 292 : SetFirstStatus = TRUE;
; 293 :
; 294 : //
; 295 : // If we haven't already set a first status
; 296 : // then there is a chance that this packet
; 297 : // was never on the queue. We should mark
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -