📄 power.cod
字号:
; Listing generated by Microsoft (R) Optimizing Compiler Version 12.00.9044.0
TITLE F:\W2DDK\src\kernel\serial\power.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
PAGESRP0 SEGMENT PARA USE32 PUBLIC ''
PAGESRP0 ENDS
; COMDAT _RtlConvertLongToLargeInteger@4
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
; COMDAT _SerialSystemPowerCompletion@20
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
; COMDAT _SerialSaveDeviceState@4
PAGESRP0 SEGMENT PARA USE32 PUBLIC ''
PAGESRP0 ENDS
; COMDAT _SerialRestoreDeviceState@4
PAGESRP0 SEGMENT PARA USE32 PUBLIC ''
PAGESRP0 ENDS
; COMDAT _SerialPowerDispatch@8
PAGESRP0 SEGMENT PARA USE32 PUBLIC ''
PAGESRP0 ENDS
; COMDAT _SerialSetPowerD0@8
PAGESRP0 SEGMENT PARA USE32 PUBLIC ''
PAGESRP0 ENDS
; COMDAT _SerialGotoPowerState@12
PAGESRP0 SEGMENT PARA USE32 PUBLIC ''
PAGESRP0 ENDS
; COMDAT _SerialSetPowerD3@8
PAGESRP0 SEGMENT PARA USE32 PUBLIC ''
PAGESRP0 ENDS
; COMDAT _SerialSendWaitWake@4
PAGESRP0 SEGMENT PARA USE32 PUBLIC ''
PAGESRP0 ENDS
; COMDAT _SerialWakeCompletion@20
_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 _SerialSystemPowerCompletion@20
EXTRN __imp__KeSetEvent@12:NEAR
; Function compile flags: /Ogs
; File f:\w2ddk\src\kernel\serial\power.c
; COMDAT _SerialSystemPowerCompletion@20
_TEXT SEGMENT
_Context$ = 20
_SerialSystemPowerCompletion@20 PROC NEAR ; COMDAT
; 66 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
; 67 : if (Context != NULL) {
00003 33 c0 xor eax, eax
00005 39 45 14 cmp DWORD PTR _Context$[ebp], eax
00008 74 0b je SHORT $L14816
; 68 : KeSetEvent((PKEVENT)Context, IO_NO_INCREMENT, 0);
0000a 50 push eax
0000b 50 push eax
0000c ff 75 14 push DWORD PTR _Context$[ebp]
0000f ff 15 00 00 00
00 call DWORD PTR __imp__KeSetEvent@12
$L14816:
; 69 : }
; 70 :
; 71 : return STATUS_SUCCESS;
00015 33 c0 xor eax, eax
; 72 : }
00017 5d pop ebp
00018 c2 14 00 ret 20 ; 00000014H
_SerialSystemPowerCompletion@20 ENDP
_TEXT ENDS
PUBLIC _SerialSaveDeviceState@4
EXTRN _SerialDebugLevel:DWORD
EXTRN __imp__KeGetCurrentIrql@0:NEAR
EXTRN __imp__RtlAssert@16:NEAR
EXTRN _DbgPrint:NEAR
EXTRN __imp__READ_PORT_UCHAR@4:NEAR
; COMDAT _SerialSaveDeviceState@4
PAGESRP0 SEGMENT
$SG14824 DB 'EX: Pageable code called at IRQL %d', 0aH, 00H
ORG $+3
$SG14827 DB 'f:\w2ddk\src\kernel\serial\power.c', 00H
ORG $+1
$SG14828 DB 'FALSE', 00H
ORG $+2
$SG14835 DB 'SERIAL: Entering SerialSaveDeviceState', 0aH, 00H
$SG14851 DB 'SERIAL: Leaving SerialSaveDeviceState', 0aH, 00H
; Function compile flags: /Ogs
_PDevExt$ = 8
_SerialSaveDeviceState@4 PROC NEAR ; COMDAT
; 95 : {
000a3 55 push ebp
000a4 8b ec mov ebp, esp
000a6 56 push esi
; 96 : PSERIAL_DEVICE_STATE pDevState = &PDevExt->DeviceState;
000a7 8b 75 08 mov esi, DWORD PTR _PDevExt$[ebp]
000aa 57 push edi
; 97 :
; 98 : PAGED_CODE();
000ab 8b 3d 00 00 00
00 mov edi, DWORD PTR __imp__KeGetCurrentIrql@0
000b1 ff d7 call edi
000b3 3c 01 cmp al, 1
000b5 76 26 jbe SHORT $L14829
000b7 ff d7 call edi
000b9 0f b6 c0 movzx eax, al
000bc 50 push eax
000bd 68 00 00 00 00 push OFFSET FLAT:$SG14824
000c2 e8 00 00 00 00 call _DbgPrint
000c7 59 pop ecx
000c8 59 pop ecx
000c9 6a 00 push 0
000cb 6a 62 push 98 ; 00000062H
000cd 68 00 00 00 00 push OFFSET FLAT:$SG14827
000d2 68 00 00 00 00 push OFFSET FLAT:$SG14828
000d7 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L14829:
; 99 :
; 100 : SerialDump(SERTRACECALLS, ("SERIAL: Entering SerialSaveDeviceState\n"));
000dd f6 05 00 00 00
00 40 test BYTE PTR _SerialDebugLevel, 64 ; 00000040H
000e4 74 0b je SHORT $L14830
000e6 68 00 00 00 00 push OFFSET FLAT:$SG14835
000eb e8 00 00 00 00 call _DbgPrint
000f0 59 pop ecx
$L14830:
; 101 :
; 102 : //
; 103 : // Read necessary registers direct
; 104 : //
; 105 :
; 106 : pDevState->IER = READ_INTERRUPT_ENABLE(PDevExt->Controller);
000f1 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
000f7 8b 3d 00 00 00
00 mov edi, DWORD PTR __imp__READ_PORT_UCHAR@4
000fd 40 inc eax
000fe 50 push eax
000ff ff d7 call edi
00101 88 86 fd 04 00
00 mov BYTE PTR [esi+1277], al
; 107 : pDevState->MCR = READ_MODEM_CONTROL(PDevExt->Controller);
00107 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
0010d 83 c0 04 add eax, 4
00110 50 push eax
00111 ff d7 call edi
00113 88 86 ff 04 00
00 mov BYTE PTR [esi+1279], al
; 108 : pDevState->LCR = READ_LINE_CONTROL(PDevExt->Controller);
00119 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
0011f 83 c0 03 add eax, 3
00122 50 push eax
00123 ff d7 call edi
00125 88 86 fe 04 00
00 mov BYTE PTR [esi+1278], al
0012b 5f pop edi
; 109 :
; 110 :
; 111 : SerialDump(SERTRACECALLS, ("SERIAL: Leaving SerialSaveDeviceState\n"));
0012c f6 05 00 00 00
00 40 test BYTE PTR _SerialDebugLevel, 64 ; 00000040H
00133 5e pop esi
00134 74 0b je SHORT $L14846
00136 68 00 00 00 00 push OFFSET FLAT:$SG14851
0013b e8 00 00 00 00 call _DbgPrint
00140 59 pop ecx
$L14846:
; 112 : }
00141 5d pop ebp
00142 c2 04 00 ret 4
_SerialSaveDeviceState@4 ENDP
PAGESRP0 ENDS
PUBLIC _SerialRestoreDeviceState@4
EXTRN __imp__WRITE_PORT_UCHAR@8:NEAR
EXTRN _SerialSetBaud@4:NEAR
EXTRN _SerialGetDivisorFromBaud@12:NEAR
; COMDAT _SerialRestoreDeviceState@4
PAGESRP0 SEGMENT
$SG14865 DB 'EX: Pageable code called at IRQL %d', 0aH, 00H
ORG $+3
$SG14868 DB 'f:\w2ddk\src\kernel\serial\power.c', 00H
ORG $+1
$SG14869 DB 'FALSE', 00H
ORG $+2
$SG14876 DB 'SERIAL: Enter SerialRestoreDeviceState', 0aH, 00H
$SG14889 DB '------ PDevExt: %x', 0aH, 00H
ORG $+3
$SG14956 DB 'SERIAL: Reopening device', 0aH, 00H
; Function compile flags: /Ogs
_PDevExt$ = 8
_divisor$ = 10
_S$ = -8
_SerialRestoreDeviceState@4 PROC NEAR ; COMDAT
; 134 : {
000ae 55 push ebp
000af 8b ec mov ebp, esp
000b1 51 push ecx
000b2 51 push ecx
000b3 56 push esi
; 135 : PSERIAL_DEVICE_STATE pDevState = &PDevExt->DeviceState;
000b4 8b 75 08 mov esi, DWORD PTR _PDevExt$[ebp]
000b7 57 push edi
; 136 : SHORT divisor;
; 137 : SERIAL_IOCTL_SYNC S;
; 138 :
; 139 : PAGED_CODE();
000b8 8b 3d 00 00 00
00 mov edi, DWORD PTR __imp__KeGetCurrentIrql@0
000be ff d7 call edi
000c0 3c 01 cmp al, 1
000c2 76 29 jbe SHORT $L14870
000c4 ff d7 call edi
000c6 0f b6 c0 movzx eax, al
000c9 50 push eax
000ca 68 00 00 00 00 push OFFSET FLAT:$SG14865
000cf e8 00 00 00 00 call _DbgPrint
000d4 59 pop ecx
000d5 59 pop ecx
000d6 6a 00 push 0
000d8 68 8b 00 00 00 push 139 ; 0000008bH
000dd 68 00 00 00 00 push OFFSET FLAT:$SG14868
000e2 68 00 00 00 00 push OFFSET FLAT:$SG14869
000e7 ff 15 00 00 00
00 call DWORD PTR __imp__RtlAssert@16
$L14870:
; 140 :
; 141 : SerialDump(SERTRACECALLS, ("SERIAL: Enter SerialRestoreDeviceState\n"));
000ed f6 05 00 00 00
00 40 test BYTE PTR _SerialDebugLevel, 64 ; 00000040H
000f4 74 21 je SHORT $L14884
000f6 68 00 00 00 00 push OFFSET FLAT:$SG14876
000fb e8 00 00 00 00 call _DbgPrint
; 142 : SerialDump(SERTRACECALLS, ("------ PDevExt: %x\n", PDevExt));
00100 f6 05 00 00 00
00 40 test BYTE PTR _SerialDebugLevel, 64 ; 00000040H
00107 59 pop ecx
00108 74 0d je SHORT $L14884
0010a 56 push esi
0010b 68 00 00 00 00 push OFFSET FLAT:$SG14889
00110 e8 00 00 00 00 call _DbgPrint
00115 59 pop ecx
00116 59 pop ecx
$L14884:
; 143 :
; 144 : //
; 145 : // Disable interrupts both via OUT2 and IER
; 146 : //
; 147 :
; 148 : WRITE_MODEM_CONTROL(PDevExt->Controller, 0);
00117 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
0011d 8b 3d 00 00 00
00 mov edi, DWORD PTR __imp__WRITE_PORT_UCHAR@8
00123 53 push ebx
00124 83 c0 04 add eax, 4
00127 6a 00 push 0
00129 50 push eax
0012a ff d7 call edi
; 149 : DISABLE_ALL_INTERRUPTS(PDevExt->Controller);
0012c 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
00132 6a 00 push 0
00134 40 inc eax
00135 50 push eax
00136 ff d7 call edi
; 150 :
; 151 : //
; 152 : // Set the baud rate
; 153 : //
; 154 :
; 155 : SerialGetDivisorFromBaud(PDevExt->ClockRate, PDevExt->CurrentBaud, &divisor);
00138 8d 45 0a lea eax, DWORD PTR _divisor$[ebp]
0013b 50 push eax
0013c ff b6 34 01 00
00 push DWORD PTR [esi+308]
00142 ff b6 4c 01 00
00 push DWORD PTR [esi+332]
00148 e8 00 00 00 00 call _SerialGetDivisorFromBaud@12
; 156 : S.Extension = PDevExt;
; 157 : S.Data = (PVOID)divisor;
0014d 0f bf 45 0a movsx eax, WORD PTR _divisor$[ebp]
00151 89 45 fc mov DWORD PTR _S$[ebp+4], eax
; 158 : SerialSetBaud(&S);
00154 8d 45 f8 lea eax, DWORD PTR _S$[ebp]
00157 50 push eax
00158 89 75 f8 mov DWORD PTR _S$[ebp], esi
0015b e8 00 00 00 00 call _SerialSetBaud@4
; 159 :
; 160 : //
; 161 : // Reset / Re-enable the FIFO's
; 162 : //
; 163 :
; 164 : if (PDevExt->FifoPresent) {
00160 80 be dd 01 00
00 00 cmp BYTE PTR [esi+477], 0
00167 8b 1d 00 00 00
00 mov ebx, DWORD PTR __imp__READ_PORT_UCHAR@4
; 165 : WRITE_FIFO_CONTROL(PDevExt->Controller, (UCHAR)0);
0016d 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
00173 6a 00 push 0
00175 74 1c je SHORT $L14924
00177 40 inc eax
00178 40 inc eax
00179 50 push eax
0017a ff d7 call edi
; 166 : READ_RECEIVE_BUFFER(PDevExt->Controller);
0017c ff b6 98 00 00
00 push DWORD PTR [esi+152]
00182 ff d3 call ebx
; 167 : WRITE_FIFO_CONTROL(PDevExt->Controller,
; 168 : (UCHAR)(SERIAL_FCR_ENABLE | PDevExt->RxFifoTrigger
; 169 : | SERIAL_FCR_RCVR_RESET
; 170 : | SERIAL_FCR_TXMT_RESET));
00184 8a 86 df 01 00
00 mov al, BYTE PTR [esi+479]
0018a 0c 07 or al, 7
0018c 50 push eax
0018d 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
$L14924:
; 171 : } else {
; 172 : WRITE_FIFO_CONTROL(PDevExt->Controller, (UCHAR)0);
00193 40 inc eax
00194 40 inc eax
00195 50 push eax
00196 ff d7 call edi
; 173 : }
; 174 :
; 175 : //
; 176 : // In case we are dealing with a bitmasked multiportcard,
; 177 : // that has the mask register enabled, enable the
; 178 : // interrupts.
; 179 : //
; 180 :
; 181 : if (PDevExt->InterruptStatus) {
00198 8b 96 9c 00 00
00 mov edx, DWORD PTR [esi+156]
0019e 85 d2 test edx, edx
001a0 74 2e je SHORT $L14938
; 182 : if (PDevExt->Indexed) {
001a2 80 be c4 01 00
00 00 cmp BYTE PTR [esi+452], 0
001a9 74 07 je SHORT $L14930
; 183 : WRITE_PORT_UCHAR(PDevExt->InterruptStatus, (UCHAR)0xFF);
001ab 68 ff 00 00 00 push 255 ; 000000ffH
; 184 : } else {
001b0 eb 1b jmp SHORT $L15499
$L14930:
; 185 : //
; 186 : // Either we are standalone or already mapped
; 187 : //
; 188 :
; 189 : if (PDevExt->OurIsrContext == PDevExt) {
001b2 8b 86 94 00 00
00 mov eax, DWORD PTR [esi+148]
001b8 3b c6 cmp eax, esi
001ba 75 0d jne SHORT $L14933
; 190 : //
; 191 : // This is a standalone
; 192 : //
; 193 :
; 194 : WRITE_PORT_UCHAR(PDevExt->InterruptStatus,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -