📄 write.cod
字号:
00024 75 59 jne SHORT $L14973
00026 39 9e c8 00 00
00 cmp DWORD PTR [esi+200], ebx
0002c 75 51 jne SHORT $L14973
0002e 8d 86 ac 00 00
00 lea eax, DWORD PTR [esi+172]
00034 39 00 cmp DWORD PTR [eax], eax
00036 75 47 jne SHORT $L14973
; 801 :
; 802 : Extension->HistoryMask |= SERIAL_EV_TXEMPTY;
; 803 : if (Extension->IrpMaskLocation) {
00038 8d 8e 18 01 00
00 lea ecx, DWORD PTR [esi+280]
0003e 8d 86 14 01 00
00 lea eax, DWORD PTR [esi+276]
00044 57 push edi
00045 8b 11 mov edx, DWORD PTR [ecx]
00047 83 08 04 or DWORD PTR [eax], 4
0004a 8b 38 mov edi, DWORD PTR [eax]
0004c 3b d3 cmp edx, ebx
0004e 74 22 je SHORT $L14974
; 804 :
; 805 : *Extension->IrpMaskLocation = Extension->HistoryMask;
00050 89 3a mov DWORD PTR [edx], edi
; 806 : Extension->IrpMaskLocation = NULL;
; 807 : Extension->HistoryMask = 0;
00052 89 18 mov DWORD PTR [eax], ebx
; 808 :
; 809 : Extension->CurrentWaitIrp->IoStatus.Information = sizeof(ULONG);
00054 8b 86 d4 00 00
00 mov eax, DWORD PTR [esi+212]
0005a 89 19 mov DWORD PTR [ecx], ebx
; 810 : SerialInsertQueueDpc(
; 811 : &Extension->CommWaitDpc,
; 812 : NULL,
; 813 : NULL,
; 814 : Extension
; 815 : );
0005c 56 push esi
0005d 53 push ebx
0005e c7 40 1c 04 00
00 00 mov DWORD PTR [eax+28], 4
00065 8d 86 ac 02 00
00 lea eax, DWORD PTR [esi+684]
0006b 53 push ebx
0006c 50 push eax
0006d e8 00 00 00 00 call _SerialInsertQueueDpc@16
$L14974:
; 816 :
; 817 : }
; 818 :
; 819 : Extension->CountOfTryingToLowerRTS++;
00072 ff 86 3c 01 00
00 inc DWORD PTR [esi+316]
; 820 : SerialPerhapsLowerRTS(Extension);
00078 56 push esi
00079 e8 00 00 00 00 call _SerialPerhapsLowerRTS@4
0007e 5f pop edi
$L14973:
0007f 5e pop esi
; 821 :
; 822 : }
; 823 :
; 824 : return FALSE;
00080 32 c0 xor al, al
00082 5b pop ebx
; 825 :
; 826 : }
00083 c2 04 00 ret 4
_SerialProcessEmptyTransmit@4 ENDP
PAGESER ENDS
EXTRN _SerialSetRTS@4:NEAR
EXTRN __imp__WRITE_PORT_UCHAR@8:NEAR
; Function compile flags: /Ogsy
; COMDAT _SerialGiveWriteToIsr@4
PAGESER SEGMENT
_Context$ = 8
_SerialGiveWriteToIsr@4 PROC NEAR ; COMDAT
; 858 : {
00000 56 push esi
; 859 :
; 860 : PSERIAL_DEVICE_EXTENSION Extension = Context;
; 861 :
; 862 : //
; 863 : // The current stack location. This contains all of the
; 864 : // information we need to process this particular request.
; 865 : //
; 866 : PIO_STACK_LOCATION IrpSp;
; 867 :
; 868 : SERIAL_LOCKED_PAGED_CODE();
; 869 :
; 870 : IrpSp = IoGetCurrentIrpStackLocation(Extension->CurrentWriteIrp);
00001 8b 74 24 08 mov esi, DWORD PTR _Context$[esp]
; 871 :
; 872 : //
; 873 : // We might have a xoff counter request masquerading as a
; 874 : // write. The length of these requests will always be one
; 875 : // and we can get a pointer to the actual character from
; 876 : // the data supplied by the user.
; 877 : //
; 878 :
; 879 : if (IrpSp->MajorFunction == IRP_MJ_WRITE) {
00005 33 d2 xor edx, edx
00007 8b 86 c8 00 00
00 mov eax, DWORD PTR [esi+200]
0000d 42 inc edx
0000e 8b 48 60 mov ecx, DWORD PTR [eax+96]
00011 80 39 04 cmp BYTE PTR [ecx], 4
00014 75 0e jne SHORT $L14984
; 880 :
; 881 : Extension->WriteLength = IrpSp->Parameters.Write.Length;
00016 8b 49 04 mov ecx, DWORD PTR [ecx+4]
00019 89 8e e0 00 00
00 mov DWORD PTR [esi+224], ecx
; 882 : Extension->WriteCurrentChar =
; 883 : Extension->CurrentWriteIrp->AssociatedIrp.SystemBuffer;
0001f 8b 48 0c mov ecx, DWORD PTR [eax+12]
; 884 :
; 885 : } else {
00022 eb 0c jmp SHORT $L15204
$L14984:
; 886 :
; 887 : Extension->WriteLength = 1;
00024 89 96 e0 00 00
00 mov DWORD PTR [esi+224], edx
; 888 : Extension->WriteCurrentChar =
; 889 : ((PUCHAR)Extension->CurrentWriteIrp->AssociatedIrp.SystemBuffer) +
; 890 : FIELD_OFFSET(
; 891 : SERIAL_XOFF_COUNTER,
; 892 : XoffChar
; 893 : );
0002a 8b 48 0c mov ecx, DWORD PTR [eax+12]
0002d 83 c1 08 add ecx, 8
$L15204:
00030 89 8e e4 00 00
00 mov DWORD PTR [esi+228], ecx
; 894 :
; 895 : }
; 896 :
; 897 : //
; 898 : // The isr now has a reference to the irp.
; 899 : //
; 900 :
; 901 : SERIAL_SET_REFERENCE(
; 902 : Extension->CurrentWriteIrp,
; 903 : SERIAL_REF_ISR
; 904 : );
00036 8b 40 60 mov eax, DWORD PTR [eax+96]
00039 83 c0 10 add eax, 16 ; 00000010H
0003c 09 10 or DWORD PTR [eax], edx
; 905 :
; 906 : //
; 907 : // Check first to see if an immediate char is transmitting.
; 908 : // If it is then we'll just slip in behind it when its
; 909 : // done.
; 910 : //
; 911 :
; 912 : if (!Extension->TransmitImmediate) {
0003e 33 c0 xor eax, eax
00040 38 86 a1 01 00
00 cmp BYTE PTR [esi+417], al
00046 75 27 jne SHORT $L15007
; 913 :
; 914 : //
; 915 : // If there is no immediate char transmitting then we
; 916 : // will "re-enable" the transmit holding register empty
; 917 : // interrupt. The 8250 family of devices will always
; 918 : // signal a transmit holding register empty interrupt
; 919 : // *ANY* time this bit is set to one. By doing things
; 920 : // this way we can simply use the normal interrupt code
; 921 : // to start off this write.
; 922 : //
; 923 : // We've been keeping track of whether the transmit holding
; 924 : // register is empty so it we only need to do this
; 925 : // if the register is empty.
; 926 : //
; 927 :
; 928 : if (Extension->HoldingEmpty) {
00048 38 86 a0 01 00
00 cmp BYTE PTR [esi+416], al
0004e 74 1f je SHORT $L15007
00050 53 push ebx
00051 57 push edi
; 929 :
; 930 : DISABLE_ALL_INTERRUPTS(Extension->Controller);
00052 8b 1d 00 00 00
00 mov ebx, DWORD PTR __imp__WRITE_PORT_UCHAR@8
00058 8d be 98 00 00
00 lea edi, DWORD PTR [esi+152]
0005e 50 push eax
0005f 8b 07 mov eax, DWORD PTR [edi]
00061 40 inc eax
00062 50 push eax
00063 ff d3 call ebx
; 931 : ENABLE_ALL_INTERRUPTS(Extension->Controller);
00065 8b 07 mov eax, DWORD PTR [edi]
00067 6a 0f push 15 ; 0000000fH
00069 40 inc eax
0006a 50 push eax
0006b ff d3 call ebx
0006d 5f pop edi
0006e 5b pop ebx
$L15007:
; 932 :
; 933 : }
; 934 :
; 935 : }
; 936 :
; 937 : //
; 938 : // The rts line may already be up from previous writes,
; 939 : // however, it won't take much additional time to turn
; 940 : // on the RTS line if we are doing transmit toggling.
; 941 : //
; 942 :
; 943 : if ((Extension->HandFlow.FlowReplace & SERIAL_RTS_MASK) ==
; 944 : SERIAL_TRANSMIT_TOGGLE) {
0006f 8b 86 78 01 00
00 mov eax, DWORD PTR [esi+376]
00075 66 25 c0 00 and ax, 192 ; 000000c0H
00079 3c c0 cmp al, 192 ; 000000c0H
0007b 75 06 jne SHORT $L15015
; 945 :
; 946 : SerialSetRTS(Extension);
0007d 56 push esi
0007e e8 00 00 00 00 call _SerialSetRTS@4
$L15015:
; 947 :
; 948 : }
; 949 :
; 950 : return FALSE;
00083 32 c0 xor al, al
00085 5e pop esi
; 951 :
; 952 : }
00086 c2 04 00 ret 4
_SerialGiveWriteToIsr@4 ENDP
PAGESER ENDS
PUBLIC _SerialGrabWriteFromIsr@4
; Function compile flags: /Ogsy
; COMDAT _SerialCancelCurrentWrite@8
PAGESER SEGMENT
_DeviceObject$ = 8
_Irp$ = 12
_SerialCancelCurrentWrite@8 PROC NEAR ; COMDAT
; 979 :
; 980 : PSERIAL_DEVICE_EXTENSION Extension = DeviceObject->DeviceExtension;
00000 8b 44 24 04 mov eax, DWORD PTR _DeviceObject$[esp-4]
; 981 : SERIAL_LOCKED_PAGED_CODE();
; 982 :
; 983 : SerialTryToCompleteCurrent(
; 984 : Extension,
; 985 : SerialGrabWriteFromIsr,
; 986 : Irp->CancelIrql,
; 987 : STATUS_CANCELLED,
; 988 : &Extension->CurrentWriteIrp,
; 989 : &Extension->WriteQueue,
; 990 : NULL,
; 991 : &Extension->WriteRequestTotalTimer,
; 992 : SerialStartWrite,
; 993 : SerialGetNextWrite,
; 994 : SERIAL_REF_CANCEL
; 995 : );
00004 6a 02 push 2
00006 68 00 00 00 00 push OFFSET FLAT:_SerialGetNextWrite@20
0000b 68 00 00 00 00 push OFFSET FLAT:_SerialStartWrite@4
00010 8b 40 28 mov eax, DWORD PTR [eax+40]
00013 8d 88 00 04 00
00 lea ecx, DWORD PTR [eax+1024]
00019 51 push ecx
0001a 8d 88 ac 00 00
00 lea ecx, DWORD PTR [eax+172]
00020 6a 00 push 0
00022 51 push ecx
00023 8d 88 c8 00 00
00 lea ecx, DWORD PTR [eax+200]
00029 51 push ecx
0002a 8b 4c 24 24 mov ecx, DWORD PTR _Irp$[esp+24]
0002e 68 20 01 00 c0 push -1073741536 ; c0000120H
00033 8a 49 25 mov cl, BYTE PTR [ecx+37]
00036 51 push ecx
00037 68 00 00 00 00 push OFFSET FLAT:_SerialGrabWriteFromIsr@4
0003c 50 push eax
0003d e8 00 00 00 00 call _SerialTryToCompleteCurrent@44
; 996 :
; 997 : }
00042 c2 08 00 ret 8
_SerialCancelCurrentWrite@8 ENDP
PAGESER ENDS
PUBLIC _SerialWriteTimeout@16
; Function compile flags: /Ogsy
; COMDAT _SerialWriteTimeout@16
_TEXT SEGMENT
_Dpc$ = 8
_DeferredContext$ = 12
_OldIrql$ = -4
_SerialWriteTimeout@16 PROC NEAR ; COMDAT
; 1029 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 51 push ecx
; 1030 :
; 1031 : PSERIAL_DEVICE_EXTENSION Extension = DeferredContext;
; 1032 : KIRQL OldIrql;
; 1033 :
; 1034 : UNREFERENCED_PARAMETER(SystemContext1);
; 1035 : UNREFERENCED_PARAMETER(SystemContext2);
; 1036 :
; 1037 : SerialDump(SERTRACECALLS, ("SERIAL: SerialWriteTimeout\n"));
; 1038 :
; 1039 : IoAcquireCancelSpinLock(&OldIrql);
00004 8d 45 fc lea eax, DWORD PTR _OldIrql$[ebp]
00007 56 push esi
00008 50 push eax
00009 ff 15 00 00 00
00 call DWORD PTR __imp__IoAcquireCancelSpinLock@4
; 1040 :
; 1041 : SerialTryToCompleteCurrent(
; 1042 : Extension,
; 1043 : SerialGrabWriteFromIsr,
; 1044 : OldIrql,
; 1045 : STATUS_TIMEOUT,
; 1046 : &Extension->CurrentWriteIrp,
; 1047 : &Extension->WriteQueue,
; 1048 : NULL,
; 1049 : &Extension->WriteRequestTotalTimer,
; 1050 : SerialStartWrite,
; 1051 : SerialGetNextWrite,
; 1052 : SERIAL_REF_TOTAL_TIMER
; 1053 : );
0000f 8b 75 0c mov esi, DWORD PTR _DeferredContext$[ebp]
00012 6a 04 push 4
00014 68 00 00 00 00 push OFFSET FLAT:_SerialGetNextWrite@20
00019 68 00 00 00 00 push OFFSET FLAT:_SerialStartWrite@4
0001e 8d 86 00 04 00
00 lea eax, DWORD PTR [esi+1024]
00024 50 push eax
00025 8d 86 ac 00 00
00 lea eax, DWORD PTR [esi+172]
0002b 6a 00 push 0
0002d 50 push eax
0002e 8d 86 c8 00 00
00 lea eax, DWORD PTR [esi+200]
00034 50 push eax
00035 68 02 01 00 00 push 258 ; 00000102H
0003a ff 75 fc push DWORD PTR _OldIrql$[ebp]
0003d 68 00 00 00 00 push OFFSET FLAT:_SerialGrabWriteFromIsr@4
00042 56 push esi
00043 e8 00 00 00 00 call _SerialTryToCompleteCurrent@44
; 1054 :
; 1055 : SerialDpcEpilogue(Extension, Dpc);
00048 ff 75 08 push DWORD PTR _Dpc$[ebp]
0004b 56 push esi
0004c e8 00 00 00 00 call _SerialDpcEpilogue@8
00051 5e pop esi
; 1056 : }
00052 c9 leave
00053 c2 10 00 ret 16 ; 00000010H
_SerialWriteTimeout@16 ENDP
; Function compile flags: /Ogsy
_TEXT ENDS
; COMDAT _SerialGrabWriteFromIsr@4
PAGESER SEGMENT
_Context$ = 8
_SerialGrabWriteFromIsr@4 PROC NEAR ; COMDAT
; 1086 : {
00000 56 push esi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -