📄 power.cod
字号:
; 195 : (UCHAR)(1 << (PDevExt->PortIndex - 1)));
001bc 8b 8e c0 01 00
00 mov ecx, DWORD PTR [esi+448]
001c2 b0 01 mov al, 1
001c4 49 dec ecx
001c5 d2 e0 shl al, cl
; 196 : } else {
001c7 eb 03 jmp SHORT $L15500
$L14933:
; 197 : //
; 198 : // One of many
; 199 : //
; 200 :
; 201 : WRITE_PORT_UCHAR(PDevExt->InterruptStatus,
; 202 : (UCHAR)((PSERIAL_MULTIPORT_DISPATCH)PDevExt->
; 203 : OurIsrContext)->UsablePortMask);
001c9 8a 40 48 mov al, BYTE PTR [eax+72]
$L15500:
001cc 50 push eax
$L15499:
001cd 52 push edx
001ce ff d7 call edi
$L14938:
; 204 : }
; 205 : }
; 206 : }
; 207 :
; 208 : //
; 209 : // Restore a couple more registers
; 210 : //
; 211 :
; 212 : WRITE_INTERRUPT_ENABLE(PDevExt->Controller, pDevState->IER);
001d0 8a 86 fd 04 00
00 mov al, BYTE PTR [esi+1277]
001d6 50 push eax
001d7 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
001dd 40 inc eax
001de 50 push eax
001df ff d7 call edi
; 213 : WRITE_LINE_CONTROL(PDevExt->Controller, pDevState->LCR);
001e1 8a 86 fe 04 00
00 mov al, BYTE PTR [esi+1278]
001e7 50 push eax
001e8 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
001ee 83 c0 03 add eax, 3
001f1 50 push eax
001f2 ff d7 call edi
; 214 :
; 215 : //
; 216 : // Clear out any stale interrupts
; 217 : //
; 218 :
; 219 : READ_INTERRUPT_ID_REG(PDevExt->Controller);
001f4 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
001fa 40 inc eax
001fb 40 inc eax
001fc 50 push eax
001fd ff d3 call ebx
; 220 : READ_LINE_STATUS(PDevExt->Controller);
001ff 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
00205 83 c0 05 add eax, 5
00208 50 push eax
00209 ff d3 call ebx
; 221 : READ_MODEM_STATUS(PDevExt->Controller);
0020b 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
00211 83 c0 06 add eax, 6
00214 50 push eax
00215 ff d3 call ebx
; 222 :
; 223 :
; 224 : if (PDevExt->DeviceState.Reopen == TRUE) {
00217 80 be fc 04 00
00 01 cmp BYTE PTR [esi+1276], 1
0021e 5b pop ebx
0021f 75 4f jne SHORT $L14977
; 225 : SerialDump(SERPNPPOWER, ("SERIAL: Reopening device\n"));
00221 f6 05 01 00 00
00 01 test BYTE PTR _SerialDebugLevel+1, 1
00228 74 0b je SHORT $L14951
0022a 68 00 00 00 00 push OFFSET FLAT:$SG14956
0022f e8 00 00 00 00 call _DbgPrint
00234 59 pop ecx
$L14951:
; 226 :
; 227 : PDevExt->DeviceIsOpened = TRUE;
; 228 : PDevExt->DeviceState.Reopen = FALSE;
00235 80 a6 fc 04 00
00 00 and BYTE PTR [esi+1276], 0
0023c c6 86 9d 01 00
00 01 mov BYTE PTR [esi+413], 1
; 229 :
; 230 : //
; 231 : // This enables interrupts on the device!
; 232 : //
; 233 :
; 234 : WRITE_MODEM_CONTROL(PDevExt->Controller,
; 235 : (UCHAR)(pDevState->MCR | SERIAL_MCR_OUT2));
00243 8a 86 ff 04 00
00 mov al, BYTE PTR [esi+1279]
00249 0c 08 or al, 8
0024b 50 push eax
0024c 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
00252 83 c0 04 add eax, 4
00255 50 push eax
00256 ff d7 call edi
; 236 :
; 237 : //
; 238 : // Refire the state machine
; 239 : //
; 240 :
; 241 : DISABLE_ALL_INTERRUPTS(PDevExt->Controller);
00258 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
0025e 6a 00 push 0
00260 40 inc eax
00261 50 push eax
00262 ff d7 call edi
; 242 : ENABLE_ALL_INTERRUPTS(PDevExt->Controller);
00264 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
0026a 6a 0f push 15 ; 0000000fH
0026c 40 inc eax
0026d 50 push eax
0026e ff d7 call edi
$L14977:
00270 5f pop edi
00271 5e pop esi
; 243 : }
; 244 :
; 245 : }
00272 c9 leave
00273 c2 04 00 ret 4
_SerialRestoreDeviceState@4 ENDP
PAGESRP0 ENDS
PUBLIC _SerialPowerDispatch@8
PUBLIC _SerialSetPowerD0@8
PUBLIC _SerialSetPowerD3@8
EXTRN _SerialIRPPrologue@8:NEAR
EXTRN _SerialIRPEpilogue@4:NEAR
EXTRN _SerialPoCallDriver@12:NEAR
EXTRN __imp__PoRequestPowerIrp@24:NEAR
EXTRN __imp__PoSetPowerState@12:NEAR
EXTRN __imp__PoStartNextPowerIrp@4:NEAR
EXTRN __imp_@IofCompleteRequest@8:NEAR
; COMDAT _SerialPowerDispatch@8
PAGESRP0 SEGMENT
$SG14995 DB 'EX: Pageable code called at IRQL %d', 0aH, 00H
ORG $+3
$SG14998 DB 'f:\w2ddk\src\kernel\serial\power.c', 00H
ORG $+1
$SG14999 DB 'FALSE', 00H
ORG $+2
$SG15180 DB 'SERIAL: Got IRP_MN_QUERY_POWER Irp', 0aH, 00H
$SG15042 DB 'SERIAL: Got IRP_MN_SET_POWER Irp', 0aH, 00H
ORG $+2
$SG15117 DB '------: UNKNOWN PowerState', 0aH, 00H
$SG15103 DB '------: DevicePowerState', 0aH, 00H
ORG $+2
$SG15132 DB 'SERIAL: Already in requested power state', 0aH, 00H
ORG $+2
$SG15165 DB 'SERIAL: Going to power state D3', 0aH, 00H
ORG $+3
$SG15151 DB 'SERIAL: Going to power state D0', 0aH, 00H
ORG $+3
$SG15061 DB '------: SystemPowerState', 0aH, 00H
ORG $+2
$SG15028 DB 'SERIAL: Got IRP_MN_POWER_SEQUENCE Irp', 0aH, 00H
ORG $+1
$SG15014 DB 'SERIAL: Got IRP_MN_WAIT_WAKE Irp', 0aH, 00H
; Function compile flags: /Ogs
_PDevObj$ = 8
_PIrp$ = 12
_pIrpStack$ = 12
_pLowerDevObj$ = -8
_pPdo$ = -4
_powerState$15054 = 12
_SerialPowerDispatch@8 PROC NEAR ; COMDAT
; 271 : {
001ae 55 push ebp
001af 8b ec mov ebp, esp
001b1 51 push ecx
001b2 51 push ecx
; 272 :
; 273 : PSERIAL_DEVICE_EXTENSION pDevExt = PDevObj->DeviceExtension;
001b3 8b 45 08 mov eax, DWORD PTR _PDevObj$[ebp]
001b6 53 push ebx
001b7 56 push esi
001b8 57 push edi
; 274 : PIO_STACK_LOCATION pIrpStack = IoGetCurrentIrpStackLocation(PIrp);
001b9 8b 7d 0c mov edi, DWORD PTR _PIrp$[ebp]
001bc 8b 70 28 mov esi, DWORD PTR [eax+40]
001bf 8b 47 60 mov eax, DWORD PTR [edi+96]
001c2 89 45 0c mov DWORD PTR _pIrpStack$[ebp], eax
; 275 : NTSTATUS status;
; 276 : PDEVICE_OBJECT pLowerDevObj = pDevExt->LowerDeviceObject;
001c5 8b 86 a0 04 00
00 mov eax, DWORD PTR [esi+1184]
001cb 89 45 f8 mov DWORD PTR _pLowerDevObj$[ebp], eax
; 277 : PDEVICE_OBJECT pPdo = pDevExt->Pdo;
001ce 8b 86 80 05 00
00 mov eax, DWORD PTR [esi+1408]
001d4 89 45 fc mov DWORD PTR _pPdo$[ebp], eax
; 278 : BOOLEAN acceptingIRPs;
; 279 :
; 280 : PAGED_CODE();
001d7 ff 15 00 00 00
00 call DWORD PTR __imp__KeGetCurrentIrql@0
001dd 3c 01 cmp al, 1
001df 76 2d jbe SHORT $L14996
001e1 ff 15 00 00 00
00 call DWORD PTR __imp__KeGetCurrentIrql@0
001e7 0f b6 c0 movzx eax, al
001ea 50 push eax
001eb 68 00 00 00 00 push OFFSET FLAT:$SG14995
001f0 e8 00 00 00 00 call _DbgPrint
001f5 59 pop ecx
001f6 59 pop ecx
001f7 6a 00 push 0
001f9 68 18 01 00 00 push 280 ; 00000118H
001fe 68 00 00 00 00 push OFFSET FLAT:$SG14998
00203 68 00 00 00 00 push OFFSET FLAT:$SG14999
00208 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L14996:
; 281 :
; 282 : if ((status = SerialIRPPrologue(PIrp, pDevExt)) != STATUS_SUCCESS) {
0020e 56 push esi
0020f 57 push edi
00210 e8 00 00 00 00 call _SerialIRPPrologue@8
00215 8b d8 mov ebx, eax
00217 85 db test ebx, ebx
; 283 : PoStartNextPowerIrp(PIrp);
; 284 : SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);
; 285 : return status;
00219 75 60 jne SHORT $L15518
; 286 : }
; 287 :
; 288 : status = STATUS_SUCCESS;
; 289 :
; 290 : switch (pIrpStack->MinorFunction) {
0021b 8b 5d 0c mov ebx, DWORD PTR _pIrpStack$[ebp]
0021e 0f b6 43 01 movzx eax, BYTE PTR [ebx+1]
00222 83 e8 00 sub eax, 0
00225 0f 84 f3 01 00
00 je $L15008
0022b 48 dec eax
0022c 0f 84 dc 01 00
00 je $L15022
00232 48 dec eax
00233 74 6d je SHORT $L15036
00235 48 dec eax
00236 0f 85 f6 01 00
00 jne $PowerExit$15070
; 442 :
; 443 : default:
; 444 : break;
; 445 : }
; 446 : break;
; 447 :
; 448 :
; 449 :
; 450 : case IRP_MN_QUERY_POWER:
; 451 :
; 452 : SerialDump (SERPNPPOWER, ("SERIAL: Got IRP_MN_QUERY_POWER Irp\n"));
0023c f6 05 01 00 00
00 01 test BYTE PTR _SerialDebugLevel+1, 1
00243 74 0b je SHORT $L15175
00245 68 00 00 00 00 push OFFSET FLAT:$SG15180
0024a e8 00 00 00 00 call _DbgPrint
0024f 59 pop ecx
$L15175:
; 453 :
; 454 : //
; 455 : // Check if we have a wait-wake pending and if so,
; 456 : // ensure we don't power down too far.
; 457 : //
; 458 :
; 459 :
; 460 : if (pDevExt->PendingWakeIrp != NULL || pDevExt->SendWaitWake) {
00250 83 be 88 05 00
00 00 cmp DWORD PTR [esi+1416], 0
00257 75 09 jne SHORT $L15189
00259 80 be 84 05 00
00 00 cmp BYTE PTR [esi+1412], 0
00260 74 37 je SHORT $L15190
$L15189:
; 461 : if (pIrpStack->Parameters.Power.Type == DevicePowerState
; 462 : && pIrpStack->Parameters.Power.State.DeviceState
; 463 : > pDevExt->DeviceWake) {
00262 83 7b 08 01 cmp DWORD PTR [ebx+8], 1
00266 75 31 jne SHORT $L15190
00268 8b 43 0c mov eax, DWORD PTR [ebx+12]
0026b 3b 86 7c 05 00
00 cmp eax, DWORD PTR [esi+1404]
00271 7e 26 jle SHORT $L15190
; 464 : status = PIrp->IoStatus.Status = STATUS_INVALID_DEVICE_STATE;
00273 bb 84 01 00 c0 mov ebx, -1073741436 ; c0000184H
00278 89 5f 18 mov DWORD PTR [edi+24], ebx
$L15518:
; 465 : PoStartNextPowerIrp(PIrp);
0027b 57 push edi
0027c ff 15 00 00 00
00 call DWORD PTR __imp__PoStartNextPowerIrp@4
; 466 : SerialCompleteRequest(pDevExt, PIrp, IO_NO_INCREMENT);
00282 32 d2 xor dl, dl
00284 8b cf mov ecx, edi
00286 ff 15 00 00 00
00 call DWORD PTR __imp_@IofCompleteRequest@8
0028c 56 push esi
0028d e8 00 00 00 00 call _SerialIRPEpilogue@4
; 467 : return status;
00292 8b c3 mov eax, ebx
00294 e9 b1 01 00 00 jmp $L14987
$L15190:
; 468 : }
; 469 : }
; 470 :
; 471 : //
; 472 : // If no wait-wake, always successful
; 473 : //
; 474 :
; 475 : PIrp->IoStatus.Status = STATUS_SUCCESS;
00299 83 67 18 00 and DWORD PTR [edi+24], 0
; 476 : status = STATUS_SUCCESS;
; 477 : PoStartNextPowerIrp(PIrp);
; 478 : IoSkipCurrentIrpStackLocation(PIrp);
; 479 : return SerialPoCallDriver(pDevExt, pLowerDevObj, PIrp);
0029d e9 90 01 00 00 jmp $PowerExit$15070
$L15036:
; 300 :
; 301 :
; 302 : case IRP_MN_SET_POWER:
; 303 : SerialDump(SERPNPPOWER, ("SERIAL: Got IRP_MN_SET_POWER Irp\n"));
002a2 a1 00 00 00 00 mov eax, DWORD PTR _SerialDebugLevel
002a7 b9 00 01 00 00 mov ecx, 256 ; 00000100H
002ac 85 c1 test eax, ecx
002ae 74 15 je SHORT $L15037
002b0 68 00 00 00 00 push OFFSET FLAT:$SG15042
002b5 e8 00 00 00 00 call _DbgPrint
002ba a1 00 00 00 00 mov eax, DWORD PTR _SerialDebugLevel
002bf 59 pop ecx
002c0 b9 00 01 00 00 mov ecx, 256 ; 00000100H
$L15037:
; 304 :
; 305 : //
; 306 : // Perform different ops if it was system or device
; 307 : //
; 308 :
; 309 : switch (pIrpStack->Parameters.Power.Type) {
002c5 8b 53 08 mov edx, DWORD PTR [ebx+8]
002c8 83 ea 00 sub edx, 0
002cb 0f 84 99 00 00
00 je $L15055
002d1 4a dec edx
002d2 74 12 je SHORT $L15097
; 409 : break;
; 410 :
; 411 : default:
; 412 : SerialDump(SERPNPPOWER, ("------: UNKNOWN PowerState\n"));
002d4 85 c1 test eax, ecx
002d6 0f 84 56 01 00
00 je $PowerExit$15070
002dc 68 00 00 00 00 push OFFSET FLAT:$SG15117
; 413 : status = STATUS_SUCCESS;
; 414 : goto PowerExit;
002e1 e9 46 01 00 00 jmp $L15517
$L15097:
; 405 : }
; 406 :
; 407 : case DevicePowerState:
; 408 : SerialDump(SERPNPPOWER, ("------: DevicePowerState\n"));
002e6 85 c1 test eax, ecx
002e8 74 15 je SHORT $L15098
002ea 68 00 00 00 00 push OFFSET FLAT:$SG15103
002ef e8 00 00 00 00 call _DbgPrint
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -