📄 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: /Ogsy
; File f:\w2ddk\src\kernel\serial\power.c
; COMDAT _SerialSystemPowerCompletion@20
_TEXT SEGMENT
_Context$ = 20
_SerialSystemPowerCompletion@20 PROC NEAR ; COMDAT
; 67 : if (Context != NULL) {
00000 33 c0 xor eax, eax
00002 39 44 24 10 cmp DWORD PTR _Context$[esp-4], eax
00006 74 0c je SHORT $L14778
; 68 : KeSetEvent((PKEVENT)Context, IO_NO_INCREMENT, 0);
00008 50 push eax
00009 50 push eax
0000a ff 74 24 18 push DWORD PTR _Context$[esp+4]
0000e ff 15 00 00 00
00 call DWORD PTR __imp__KeSetEvent@12
$L14778:
; 69 : }
; 70 :
; 71 : return STATUS_SUCCESS;
00014 33 c0 xor eax, eax
; 72 : }
00016 c2 14 00 ret 20 ; 00000014H
_SerialSystemPowerCompletion@20 ENDP
_TEXT ENDS
PUBLIC _SerialSaveDeviceState@4
EXTRN __imp__READ_PORT_UCHAR@4:NEAR
; Function compile flags: /Ogsy
; COMDAT _SerialSaveDeviceState@4
PAGESRP0 SEGMENT
_PDevExt$ = 8
_SerialSaveDeviceState@4 PROC NEAR ; COMDAT
; 95 : {
00000 56 push esi
; 96 : PSERIAL_DEVICE_STATE pDevState = &PDevExt->DeviceState;
00001 8b 74 24 08 mov esi, DWORD PTR _PDevExt$[esp]
00005 57 push edi
; 97 :
; 98 : PAGED_CODE();
; 99 :
; 100 : SerialDump(SERTRACECALLS, ("SERIAL: Entering SerialSaveDeviceState\n"));
; 101 :
; 102 : //
; 103 : // Read necessary registers direct
; 104 : //
; 105 :
; 106 : pDevState->IER = READ_INTERRUPT_ENABLE(PDevExt->Controller);
00006 8b 3d 00 00 00
00 mov edi, DWORD PTR __imp__READ_PORT_UCHAR@4
0000c 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
00012 40 inc eax
00013 50 push eax
00014 ff d7 call edi
00016 88 86 fd 04 00
00 mov BYTE PTR [esi+1277], al
; 107 : pDevState->MCR = READ_MODEM_CONTROL(PDevExt->Controller);
0001c 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
00022 83 c0 04 add eax, 4
00025 50 push eax
00026 ff d7 call edi
00028 88 86 ff 04 00
00 mov BYTE PTR [esi+1279], al
; 108 : pDevState->LCR = READ_LINE_CONTROL(PDevExt->Controller);
0002e 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
00034 83 c0 03 add eax, 3
00037 50 push eax
00038 ff d7 call edi
0003a 88 86 fe 04 00
00 mov BYTE PTR [esi+1278], al
00040 5f pop edi
00041 5e pop esi
; 109 :
; 110 :
; 111 : SerialDump(SERTRACECALLS, ("SERIAL: Leaving SerialSaveDeviceState\n"));
; 112 : }
00042 c2 04 00 ret 4
_SerialSaveDeviceState@4 ENDP
PAGESRP0 ENDS
PUBLIC _SerialRestoreDeviceState@4
EXTRN _SerialSetBaud@4:NEAR
EXTRN _SerialGetDivisorFromBaud@12:NEAR
EXTRN __imp__WRITE_PORT_UCHAR@8:NEAR
; Function compile flags: /Ogsy
; COMDAT _SerialRestoreDeviceState@4
PAGESRP0 SEGMENT
_PDevExt$ = 8
_divisor$ = 8
_S$ = -8
_SerialRestoreDeviceState@4 PROC NEAR ; COMDAT
; 134 : {
00000 51 push ecx
00001 51 push ecx
00002 53 push ebx
00003 55 push ebp
00004 56 push esi
; 135 : PSERIAL_DEVICE_STATE pDevState = &PDevExt->DeviceState;
00005 8b 74 24 18 mov esi, DWORD PTR _PDevExt$[esp+16]
; 136 : SHORT divisor;
; 137 : SERIAL_IOCTL_SYNC S;
; 138 :
; 139 : PAGED_CODE();
; 140 :
; 141 : SerialDump(SERTRACECALLS, ("SERIAL: Enter SerialRestoreDeviceState\n"));
; 142 : SerialDump(SERTRACECALLS, ("------ PDevExt: %x\n", PDevExt));
; 143 :
; 144 : //
; 145 : // Disable interrupts both via OUT2 and IER
; 146 : //
; 147 :
; 148 : WRITE_MODEM_CONTROL(PDevExt->Controller, 0);
00009 33 db xor ebx, ebx
0000b 57 push edi
0000c 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
00012 8b 3d 00 00 00
00 mov edi, DWORD PTR __imp__WRITE_PORT_UCHAR@8
00018 83 c0 04 add eax, 4
0001b 53 push ebx
0001c 50 push eax
0001d ff d7 call edi
; 149 : DISABLE_ALL_INTERRUPTS(PDevExt->Controller);
0001f 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
00025 53 push ebx
00026 40 inc eax
00027 50 push eax
00028 ff d7 call edi
; 150 :
; 151 : //
; 152 : // Set the baud rate
; 153 : //
; 154 :
; 155 : SerialGetDivisorFromBaud(PDevExt->ClockRate, PDevExt->CurrentBaud, &divisor);
0002a 8d 44 24 1c lea eax, DWORD PTR _divisor$[esp+20]
0002e 50 push eax
0002f ff b6 34 01 00
00 push DWORD PTR [esi+308]
00035 ff b6 4c 01 00
00 push DWORD PTR [esi+332]
0003b e8 00 00 00 00 call _SerialGetDivisorFromBaud@12
; 156 : S.Extension = PDevExt;
00040 89 74 24 10 mov DWORD PTR _S$[esp+24], esi
; 157 : S.Data = (PVOID)divisor;
00044 0f bf 44 24 1c movsx eax, WORD PTR _divisor$[esp+20]
00049 89 44 24 14 mov DWORD PTR _S$[esp+28], eax
; 158 : SerialSetBaud(&S);
0004d 8d 44 24 10 lea eax, DWORD PTR _S$[esp+24]
00051 50 push eax
00052 e8 00 00 00 00 call _SerialSetBaud@4
; 159 :
; 160 : //
; 161 : // Reset / Re-enable the FIFO's
; 162 : //
; 163 :
; 164 : if (PDevExt->FifoPresent) {
00057 38 9e dd 01 00
00 cmp BYTE PTR [esi+477], bl
0005d 8b 2d 00 00 00
00 mov ebp, DWORD PTR __imp__READ_PORT_UCHAR@4
; 165 : WRITE_FIFO_CONTROL(PDevExt->Controller, (UCHAR)0);
00063 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
00069 53 push ebx
0006a 74 1c je SHORT $L14834
0006c 40 inc eax
0006d 40 inc eax
0006e 50 push eax
0006f ff d7 call edi
; 166 : READ_RECEIVE_BUFFER(PDevExt->Controller);
00071 ff b6 98 00 00
00 push DWORD PTR [esi+152]
00077 ff d5 call ebp
; 167 : WRITE_FIFO_CONTROL(PDevExt->Controller,
; 168 : (UCHAR)(SERIAL_FCR_ENABLE | PDevExt->RxFifoTrigger
; 169 : | SERIAL_FCR_RCVR_RESET
; 170 : | SERIAL_FCR_TXMT_RESET));
00079 8a 86 df 01 00
00 mov al, BYTE PTR [esi+479]
0007f 0c 07 or al, 7
00081 50 push eax
00082 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
$L14834:
; 171 : } else {
; 172 : WRITE_FIFO_CONTROL(PDevExt->Controller, (UCHAR)0);
00088 40 inc eax
00089 40 inc eax
0008a 50 push eax
0008b 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) {
0008d 8b 86 9c 00 00
00 mov eax, DWORD PTR [esi+156]
00093 3b c3 cmp eax, ebx
00095 74 2e je SHORT $L14848
; 182 : if (PDevExt->Indexed) {
00097 38 9e c4 01 00
00 cmp BYTE PTR [esi+452], bl
0009d 74 07 je SHORT $L14840
; 183 : WRITE_PORT_UCHAR(PDevExt->InterruptStatus, (UCHAR)0xFF);
0009f 68 ff 00 00 00 push 255 ; 000000ffH
; 184 : } else {
000a4 eb 1c jmp SHORT $L15161
$L14840:
; 185 : //
; 186 : // Either we are standalone or already mapped
; 187 : //
; 188 :
; 189 : if (PDevExt->OurIsrContext == PDevExt) {
000a6 8b 8e 94 00 00
00 mov ecx, DWORD PTR [esi+148]
000ac 3b ce cmp ecx, esi
000ae 75 0e jne SHORT $L14843
; 190 : //
; 191 : // This is a standalone
; 192 : //
; 193 :
; 194 : WRITE_PORT_UCHAR(PDevExt->InterruptStatus,
; 195 : (UCHAR)(1 << (PDevExt->PortIndex - 1)));
000b0 8b 8e c0 01 00
00 mov ecx, DWORD PTR [esi+448]
000b6 b2 01 mov dl, 1
000b8 49 dec ecx
000b9 d2 e2 shl dl, cl
000bb 52 push edx
; 196 : } else {
000bc eb 04 jmp SHORT $L15161
$L14843:
; 197 : //
; 198 : // One of many
; 199 : //
; 200 :
; 201 : WRITE_PORT_UCHAR(PDevExt->InterruptStatus,
; 202 : (UCHAR)((PSERIAL_MULTIPORT_DISPATCH)PDevExt->
; 203 : OurIsrContext)->UsablePortMask);
000be 8a 49 48 mov cl, BYTE PTR [ecx+72]
000c1 51 push ecx
$L15161:
000c2 50 push eax
000c3 ff d7 call edi
$L14848:
; 204 : }
; 205 : }
; 206 : }
; 207 :
; 208 : //
; 209 : // Restore a couple more registers
; 210 : //
; 211 :
; 212 : WRITE_INTERRUPT_ENABLE(PDevExt->Controller, pDevState->IER);
000c5 8a 86 fd 04 00
00 mov al, BYTE PTR [esi+1277]
000cb 50 push eax
000cc 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
000d2 40 inc eax
000d3 50 push eax
000d4 ff d7 call edi
; 213 : WRITE_LINE_CONTROL(PDevExt->Controller, pDevState->LCR);
000d6 8a 86 fe 04 00
00 mov al, BYTE PTR [esi+1278]
000dc 50 push eax
000dd 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
000e3 83 c0 03 add eax, 3
000e6 50 push eax
000e7 ff d7 call edi
; 214 :
; 215 : //
; 216 : // Clear out any stale interrupts
; 217 : //
; 218 :
; 219 : READ_INTERRUPT_ID_REG(PDevExt->Controller);
000e9 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
000ef 40 inc eax
000f0 40 inc eax
000f1 50 push eax
000f2 ff d5 call ebp
; 220 : READ_LINE_STATUS(PDevExt->Controller);
000f4 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
000fa 83 c0 05 add eax, 5
000fd 50 push eax
000fe ff d5 call ebp
; 221 : READ_MODEM_STATUS(PDevExt->Controller);
00100 8b 86 98 00 00
00 mov eax, DWORD PTR [esi+152]
00106 83 c0 06 add eax, 6
00109 50 push eax
0010a ff d5 call ebp
; 222 :
; 223 :
; 224 : if (PDevExt->DeviceState.Reopen == TRUE) {
0010c 80 be fc 04 00
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -