📄 pcidppublic.cod
字号:
$L8700:
; 622 : }
; 623 :
; 624 : // Check for a valid interrupt type.
; 625 : switch(Type){
0005a 48 dec eax
0005b 48 dec eax
0005c 74 29 je SHORT $L8706
0005e 83 e8 06 sub eax, 6
00061 74 24 je SHORT $L8706
00063 83 e8 08 sub eax, 8
00066 74 1f je SHORT $L8706
00068 83 e8 10 sub eax, 16 ; 00000010H
0006b 74 1a je SHORT $L8706
0006d 83 e8 60 sub eax, 96 ; 00000060H
00070 74 15 je SHORT $L8706
00072 2d 80 00 00 00 sub eax, 128 ; 00000080H
00077 74 0e je SHORT $L8706
00079 2d 00 01 00 00 sub eax, 256 ; 00000100H
0007e 74 07 je SHORT $L8706
; 626 : case PCIMasterAbort:
; 627 : case PCITargetAbort:
; 628 : case I2OOutboundPostFIFONotEmpty:
; 629 : case DMAComplete:
; 630 : case LocalToHostExternalSignal:
; 631 : case LocalToHostMailbox:
; 632 : case I2OPCIFIFOOverflow:
; 633 : break;
; 634 :
; 635 : default:
; 636 : NTStatus = STATUS_INVALID_PARAMETER;
00080 b8 0d 00 00 c0 mov eax, -1073741811 ; c000000dH
; 637 : goto ExitA;
00085 eb 6b jmp SHORT $ExitA$8696
$L8706:
; 638 : }
; 639 :
; 640 : // Get an empty linked list entry.
; 641 : LLEntry = GetFreeEntry(ObjExt);
00087 53 push ebx
00088 e8 00 00 00 00 call _GetFreeEntry@4
0008d 8b f0 mov esi, eax
; 642 : if(LLEntry != NULL){
0008f 85 f6 test esi, esi
00091 74 5a je SHORT $L8710
; 643 :
; 644 : // Set up a cancel routine and mark the IRP pending.
; 645 : IoMarkIrpPending (Irp);
00093 8b 47 60 mov eax, DWORD PTR [edi+96]
00096 80 48 03 01 or BYTE PTR [eax+3], 1
; 646 : IoAcquireCancelSpinLock (&CancelSpin);
0009a 8d 45 10 lea eax, DWORD PTR _CancelSpin$[ebp]
0009d 50 push eax
0009e ff 15 00 00 00
00 call DWORD PTR __imp__IoAcquireCancelSpinLock@4
; 647 : IoSetCancelRoutine (Irp, PCIDPCancelInterrupt);
000a4 ba 00 00 00 00 mov edx, OFFSET FLAT:_PCIDPCancelInterrupt@8
000a9 8d 4f 38 lea ecx, DWORD PTR [edi+56]
000ac ff 15 00 00 00
00 call DWORD PTR __imp_@InterlockedExchange@8
; 648 : IoReleaseCancelSpinLock (CancelSpin);
000b2 ff 75 10 push DWORD PTR _CancelSpin$[ebp]
000b5 ff 15 00 00 00
00 call DWORD PTR __imp__IoReleaseCancelSpinLock@4
; 649 :
; 650 : // Add this IRP to the linked list
; 651 : LLEntry->RegisteredInterrupt.Irp = Irp;
; 652 : LLEntry->RegisteredInterrupt.Type = Type;
000bb 8b 45 08 mov eax, DWORD PTR _Type$[ebp]
; 653 : InsertEntry(ObjExt, LLEntry);
000be 56 push esi
000bf 53 push ebx
000c0 89 7e 10 mov DWORD PTR [esi+16], edi
000c3 89 46 0c mov DWORD PTR [esi+12], eax
000c6 e8 00 00 00 00 call _InsertEntry@8
; 654 :
; 655 : // Enable the interrupt on the board and clear the status bit.
; 656 : HINTPattern = MemoryBase[HINT] & 0xFFFF0000; //get enabled ints
000cb 8b 45 fc mov eax, DWORD PTR _MemoryBase$[ebp]
; 657 : HINTPattern |= Type; //bit to clear status
; 658 : HINTPattern |= (Type << 16); //bit to enable the interrupt
000ce 8b 55 08 mov edx, DWORD PTR _Type$[ebp]
000d1 05 e4 04 00 00 add eax, 1252 ; 000004e4H
000d6 c1 e2 10 shl edx, 16 ; 00000010H
000d9 8b 08 mov ecx, DWORD PTR [eax]
000db 66 83 e1 00 and cx, 0
; 666 :
; 667 : ExitA:
; 668 : Irp->IoStatus.Status = NTStatus;
000df 0b ca or ecx, edx
000e1 0b 4d 08 or ecx, DWORD PTR _Type$[ebp]
000e4 89 08 mov DWORD PTR [eax], ecx
000e6 b8 03 01 00 00 mov eax, 259 ; 00000103H
000eb eb 05 jmp SHORT $ExitA$8696
$L8710:
; 659 : MemoryBase[HINT] = HINTPattern;
; 660 :
; 661 : // Return with I/O pending.
; 662 : NTStatus = STATUS_PENDING;
; 663 : }
; 664 : else
; 665 : NTStatus = STATUS_NO_MEMORY;
000ed b8 17 00 00 c0 mov eax, -1073741801 ; c0000017H
$ExitA$8696:
; 666 :
; 667 : ExitA:
; 668 : Irp->IoStatus.Status = NTStatus;
000f2 89 47 18 mov DWORD PTR [edi+24], eax
000f5 5f pop edi
000f6 5e pop esi
000f7 5b pop ebx
; 669 : }
000f8 c9 leave
000f9 c2 14 00 ret 20 ; 00000014H
_PCIDPRegisterInterrupt@20 ENDP
_TEXT ENDS
PUBLIC _PCIDPUnregisterInterrupt@16
; COMDAT _PCIDPUnregisterInterrupt@16
_TEXT SEGMENT
_DeviceObject$ = 8
_Irp$ = 12
_IoBuffer$ = 16
_InputBufferLength$ = 20
_NTStatus$ = -16
_CancelSpin$ = 20
_MemoryBase$ = -20
_Interrupt$ = 8
_CurrentLink$ = 16
_FirstLink$ = -8
_Count$ = -4
_Type$ = -12
_PCIDPUnregisterInterrupt@16 PROC NEAR ; COMDAT
; 681 : ){
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 83 ec 14 sub esp, 20 ; 00000014H
; 682 :
; 683 : // Define variables.
; 684 : NTSTATUS NTStatus;
; 685 : PPCIDP00_UNREGISTER_INTERRUPT_SEND IoInput;
; 686 : PPCIDP_EXTENSION ObjExt;
; 687 : KIRQL CancelSpin;
; 688 : PULONG MemoryBase;
; 689 : PREGISTERED_INTERRUPT Interrupt;
; 690 : PIO_STACK_LOCATION ThisIrpStack;
; 691 : PIO_STACK_LOCATION LLIrpStack;
; 692 : PLINKED_LIST CurrentLink;
; 693 : PLINKED_LIST FirstLink;
; 694 : ULONG Count;
; 695 : ULONG Type;
; 696 :
; 697 : // Initialize variables.
; 698 : IoInput = (PPCIDP00_UNREGISTER_INTERRUPT_SEND)IoBuffer;
; 699 : ObjExt = (PPCIDP_EXTENSION)DeviceObject->DeviceExtension;
00006 8b 45 08 mov eax, DWORD PTR _DeviceObject$[ebp]
00009 53 push ebx
0000a 56 push esi
; 700 : MemoryBase = ObjExt->MemoryBase;
; 701 : Count = 0;
; 702 :
; 703 : // Check that call was made via the PCIDP API.
; 704 : if((IoInput->InterruptType & 0xF0C00000) != 0xF0C00000){
0000b b9 00 00 c0 f0 mov ecx, -255852544 ; f0c00000H
00010 8b 70 28 mov esi, DWORD PTR [eax+40]
00013 33 db xor ebx, ebx
00015 57 push edi
00016 89 5d fc mov DWORD PTR _Count$[ebp], ebx
00019 8b 46 18 mov eax, DWORD PTR [esi+24]
0001c 89 45 ec mov DWORD PTR _MemoryBase$[ebp], eax
0001f 8b 45 10 mov eax, DWORD PTR _IoBuffer$[ebp]
00022 8b 00 mov eax, DWORD PTR [eax]
00024 8b d0 mov edx, eax
00026 23 d1 and edx, ecx
00028 3b d1 cmp edx, ecx
0002a 74 0a je SHORT $L8743
; 705 : NTStatus = STATUS_ACCESS_DENIED;
0002c b8 22 00 00 c0 mov eax, -1073741790 ; c0000022H
; 706 : goto ExitA;
00031 e9 39 01 00 00 jmp $ExitA$8745
$L8743:
; 707 : }
; 708 : Type = IoInput->InterruptType & 0x000003FF;
00036 25 ff 03 00 00 and eax, 1023 ; 000003ffH
; 709 :
; 710 : // Check to make sure the board has the interrupt pin enabled.
; 711 : if(ObjExt->InterruptObject == 0){
0003b 39 5e 20 cmp DWORD PTR [esi+32], ebx
0003e 89 45 f4 mov DWORD PTR _Type$[ebp], eax
00041 75 0a jne SHORT $L8746
; 712 : NTStatus = STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT;
00043 b8 6e 01 00 c0 mov eax, -1073741458 ; c000016eH
; 713 : goto ExitA;
00048 e9 22 01 00 00 jmp $ExitA$8745
$L8746:
; 714 : }
; 715 :
; 716 : // Make sure the buffer lengths are of sufficient size to handle
; 717 : // the transactions.
; 718 : if(InputBufferLength < sizeof(PCIDP00_REGISTER_INTERRUPT_SEND)){
0004d 83 7d 14 04 cmp DWORD PTR _InputBufferLength$[ebp], 4
00051 73 0a jae SHORT $L8749
; 719 : NTStatus = STATUS_INVALID_BUFFER_SIZE;
00053 b8 06 02 00 c0 mov eax, -1073741306 ; c0000206H
; 720 : goto ExitA;
00058 e9 12 01 00 00 jmp $ExitA$8745
$L8749:
; 721 : }
; 722 :
; 723 : // Check for a valid interrupt type.
; 724 : switch(Type){
0005d 48 dec eax
0005e 48 dec eax
0005f 74 2c je SHORT $L8755
00061 83 e8 06 sub eax, 6
00064 74 27 je SHORT $L8755
00066 83 e8 08 sub eax, 8
00069 74 22 je SHORT $L8755
0006b 83 e8 10 sub eax, 16 ; 00000010H
0006e 74 1d je SHORT $L8755
00070 83 e8 60 sub eax, 96 ; 00000060H
00073 74 18 je SHORT $L8755
00075 2d 80 00 00 00 sub eax, 128 ; 00000080H
0007a 74 11 je SHORT $L8755
0007c 2d 00 01 00 00 sub eax, 256 ; 00000100H
00081 74 0a je SHORT $L8755
; 725 : case PCIMasterAbort:
; 726 : case PCITargetAbort:
; 727 : case I2OOutboundPostFIFONotEmpty:
; 728 : case DMAComplete:
; 729 : case LocalToHostExternalSignal:
; 730 : case LocalToHostMailbox:
; 731 : case I2OPCIFIFOOverflow:
; 732 : break;
; 733 :
; 734 : default:
; 735 : NTStatus = STATUS_INVALID_PARAMETER;
00083 b8 0d 00 00 c0 mov eax, -1073741811 ; c000000dH
; 736 : goto ExitA;
00088 e9 e2 00 00 00 jmp $ExitA$8745
$L8755:
; 737 : }
; 738 :
; 739 :
; 740 : // Search the driver's events linked list for an an entry containing the
; 741 : // user provided interrupt type.
; 742 : NTStatus = STATUS_SUCCESS;
; 743 : ThisIrpStack = IoGetCurrentIrpStackLocation(Irp);
0008d 8b 45 0c mov eax, DWORD PTR _Irp$[ebp]
00090 89 5d f0 mov DWORD PTR _NTStatus$[ebp], ebx
; 744 :
; 745 : CurrentLink = NULL;
00093 89 5d 10 mov DWORD PTR _CurrentLink$[ebp], ebx
; 746 : FirstLink = NULL;
00096 89 5d f8 mov DWORD PTR _FirstLink$[ebp], ebx
00099 8b 78 60 mov edi, DWORD PTR [eax+96]
; 747 : while(GetNextEntry(ObjExt, &FirstLink, &CurrentLink, &Interrupt) == TRUE){
0009c 8d 45 08 lea eax, DWORD PTR _Interrupt$[ebp]
0009f 50 push eax
000a0 8d 45 10 lea eax, DWORD PTR _CurrentLink$[ebp]
000a3 50 push eax
000a4 8d 45 f8 lea eax, DWORD PTR _FirstLink$[ebp]
000a7 50 push eax
000a8 56 push esi
000a9 e8 00 00 00 00 call _GetNextEntry@16
000ae 3c 01 cmp al, 1
000b0 0f 85 b6 00 00
00 jne $L8835
$L8762:
; 748 : if(Type == Interrupt->Type){
000b6 8b 45 08 mov eax, DWORD PTR _Interrupt$[ebp]
000b9 8b 4d f4 mov ecx, DWORD PTR _Type$[ebp]
000bc 3b 08 cmp ecx, DWORD PTR [eax]
000be 75 72 jne SHORT $L8765
; 749 : Count++;
; 750 : LLIrpStack = IoGetCurrentIrpStackLocation(Interrupt->Irp);
; 751 :
; 752 : // Cancel the IRP, then delete its linked list entry.
; 753 : if (LLIrpStack->FileObject == ThisIrpStack->FileObject) {
000c0 8b 40 04 mov eax, DWORD PTR [eax+4]
000c3 ff 45 fc inc DWORD PTR _Count$[ebp]
000c6 8b 40 60 mov eax, DWORD PTR [eax+96]
000c9 8b 40 18 mov eax, DWORD PTR [eax+24]
000cc 3b 47 18 cmp eax, DWORD PTR [edi+24]
000cf 75 61 jne SHORT $L8765
; 754 : IoAcquireCancelSpinLock (&CancelSpin);
000d1 8d 45 14 lea eax, DWORD PTR _CancelSpin$[ebp]
000d4 50 push eax
000d5 ff 15 00 00 00
00 call DWORD PTR __imp__IoAcquireCancelSpinLock@4
; 755 : Interrupt->Irp->Cancel = TRUE;
000db 8b 45 08 mov eax, DWORD PTR _Interrupt$[ebp]
000de 8b 40 04 mov eax, DWORD PTR [eax+4]
000e1 c6 40 24 01 mov BYTE PTR [eax+36], 1
; 756 : Interrupt->Irp->CancelIrql = CancelSpin;
000e5 8b 45 08 mov eax, DWORD PTR _Interrupt$[ebp]
000e8 8a 4d 14 mov cl, BYTE PTR _CancelSpin$[ebp]
000eb 8b 40 04 mov eax, DWORD PTR [eax+4]
000ee 88 48 25 mov BYTE PTR [eax+37], cl
; 757 : Interrupt->Irp->CancelRoutine = NULL;
000f1 8b 45 08 mov eax, DWORD PTR _Interrupt$[ebp]
000f4 8b 40 04 mov eax, DWORD PTR [eax+4]
000f7 89 58 38 mov DWORD PTR [eax+56], ebx
; 758 : Interrupt->Irp->IoStatus.Status = STATUS_CANCELLED;
000fa 8b 45 08 mov eax, DWORD PTR _Interrupt$[ebp]
000fd 8b 40 04 mov eax, DWORD PTR [eax+4]
00100 c7 40 18 20 01
00 c0 mov DWORD PTR [eax+24], -1073741536 ; c0000120H
; 759 : Interrupt->Irp->IoStatus.Information = 0;
00107 8b 45 08 mov eax, DWORD PTR _Interrupt$[ebp]
0010a 8b 40 04 mov eax, DWORD PTR [eax+4]
0010d 89 58 1c mov DWORD PTR [eax+28], ebx
; 760 : IoReleaseCancelSpinLock (CancelSpin);
00110 ff 75 14 push DWORD PTR _CancelSpin$[ebp]
00113 ff 15 00 00 00
00 call DWORD PTR __imp__IoReleaseCancelSpinLock@4
; 761 :
; 762 : IoCompleteRequest(Interrupt->Irp, IO_NO_INCREMENT);
00119 8b 45 08 mov eax, DWORD PTR _Interrupt$[ebp]
0011c 32 d2 xor dl, dl
0011e 8b 48 04 mov ecx, DWORD PTR [eax+4]
00121 ff 15 00 00 00
00 call DWORD PTR __imp_@IofCompleteRequest@8
; 763 :
; 764 : FreeEntry(ObjExt, CurrentLink);
00127 ff 75 10 push DWORD PTR _CurrentLink$[ebp]
0012a 56 push esi
0012b e8 00 00 00 00 call _FreeEntry@8
; 765 : }
; 766 : else
00130 eb 09 jmp SHORT $L8769
$L8765:
; 767 : PutBackEntry(ObjExt, CurrentLink);
; 768 : }
; 769 : else
; 770 : PutBackEntry(ObjExt, CurrentLink);
00132 ff 75 10 push DWORD PTR _CurrentLink$[ebp]
00135 56 push esi
00136 e8 00 00 00 00 call _PutBackEntry@8
$L8769:
0013b 8d 45 08 lea eax, DWORD PTR _Interrupt$[ebp]
0013e 50 push eax
0013f 8d 45 10 lea eax, DWORD PTR _CurrentLink$[ebp]
00142 50 push eax
00143 8d 45 f8 lea eax, DWORD PTR _FirstLink$[ebp]
00146 50 push eax
00147 56 push esi
00148 e8 00 00 00 00 call _GetNextEntry@16
0014d 3c 01 cmp al, 1
0014f 0f 84 61 ff ff
ff je $L8762
; 771 : }
; 772 :
; 773 : // Disable the interrupt type if no other thread is currently
; 774 : // registered.
; 775 : if(Count == 1)
00155 83 7d fc 01 cmp DWORD PTR _Count$[ebp], 1
00159 75 11 jne SHORT $L8835
; 776 : MemoryBase[HINT] &= (~Type) << 16;
0015b 8b 45 f4 mov eax, DWORD PTR _Type$[ebp]
0015e 8b 4d ec mov ecx, DWORD PTR _MemoryBase$[ebp]
00161 f7 d0 not eax
00163 c1 e0 10 shl eax, 16 ; 00000010H
00166 21 81 e4 04 00
00 and DWORD PTR [ecx+1252], eax
$L8835:
0016c 8b 45 f0 mov eax, DWORD PTR _NTStatus$[ebp]
$ExitA$8745:
; 777 :
; 778 :
; 779 : ExitA:
; 780 : Irp->IoStatus.Status = NTStatus;
0016f 8b 4d 0c mov ecx, DWORD PTR _Irp$[ebp]
00172 5f pop edi
00173 5e pop esi
00174 5b pop ebx
00175 89 41 18 mov DWORD PTR [ecx+24], eax
; 781 : }
00178 c9 leave
00179 c2 10 00 ret 16 ; 00000010H
_PCIDPUnregisterInterrupt@16 ENDP
_TEXT ENDS
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -