⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcidp.cod

📁 一个amccs5933芯片的驱动程序开发源程序和部分文档
💻 COD
📖 第 1 页 / 共 5 页
字号:
  000c2	8d 45 fc	 lea	 eax, DWORD PTR _CurrentLink$[ebp]
  000c5	50		 push	 eax
  000c6	8d 45 f8	 lea	 eax, DWORD PTR _FirstLink$[ebp]
  000c9	50		 push	 eax
  000ca	57		 push	 edi
  000cb	e8 00 00 00 00	 call	 _GetNextEntry@16
  000d0	3c 01		 cmp	 al, 1
  000d2	0f 84 6e ff ff
	ff		 je	 $L6055

; 615  : 	FirstLink = NULL;
; 616  : 	while(GetNextEntry(ObjExt, &FirstLink, &CurrentLink, &Interrupt) == TRUE){

  000d8	8b 75 0c	 mov	 esi, DWORD PTR _Irp$[ebp]
$L6056:

; 635  : 	}
; 636  : 
; 637  : 	Irp->IoStatus.Information = 0;

  000db	83 66 1c 00	 and	 DWORD PTR [esi+28], 0

; 638  : 	Irp->IoStatus.Status = STATUS_SUCCESS;

  000df	83 66 18 00	 and	 DWORD PTR [esi+24], 0

; 639  : 	IoCompleteRequest (Irp, IO_NO_INCREMENT);

  000e3	32 d2		 xor	 dl, dl
  000e5	8b ce		 mov	 ecx, esi
  000e7	ff d3		 call	 ebx
  000e9	5f		 pop	 edi
  000ea	5e		 pop	 esi

; 640  : 
; 641  : 	return STATUS_SUCCESS;

  000eb	33 c0		 xor	 eax, eax
  000ed	5b		 pop	 ebx

; 642  : }

  000ee	c9		 leave
  000ef	c2 08 00	 ret	 8
_PCIDPCleanup@8 ENDP
_TEXT	ENDS
EXTRN	__imp__MmUnlockPages@4:NEAR
EXTRN	__imp__MmFreeContiguousMemory@4:NEAR
EXTRN	__imp__IoDisconnectInterrupt@4:NEAR
EXTRN	__imp__IoFreeMdl@4:NEAR
EXTRN	_DeleteAllEntries@4:NEAR
;	COMDAT _PCIDPUnload@4
; File I:\PCI-DP\KERNEL\KERNELNT\pcidp.c
_TEXT	SEGMENT
$SG6071	DB	'\', 00H, 'D', 00H, 'o', 00H, 's', 00H, 'D', 00H, 'e', 00H
	DB	'v', 00H, 'i', 00H, 'c', 00H, 'e', 00H, 's', 00H, '\', 00H, 'P'
	DB	00H, 'C', 00H, 'I', 00H, 'D', 00H, 'P', 00H, '0', 00H, '0', 00H
	DB	00H, 00H
_DriverObject$ = 8
_DeviceLinkUnicode$ = -48
_DeviceLink$ = -40
_PCIDPUnload@4 PROC NEAR				; COMDAT

; 653  : ){

  00028	83 ec 30	 sub	 esp, 48			; 00000030H

; 654  : 	//Define variables.
; 655  : 	PDEVICE_OBJECT CurrentDeviceObject;
; 656  : 	PDEVICE_OBJECT NextDeviceObject;
; 657  : 	pPCIDP_EXTENSION ObjExt;
; 658  : 	UNICODE_STRING DeviceLinkUnicode;
; 659  : 
; 660  : 	// Initialize variables.
; 661  : 	WCHAR DeviceLink[] = L"\\DosDevices\\PCIDP00";
; 662  : 	NextDeviceObject = DriverObject->DeviceObject;

  0002b	8b 44 24 34	 mov	 eax, DWORD PTR _DriverObject$[esp+44]
  0002f	56		 push	 esi
  00030	57		 push	 edi
  00031	6a 0a		 push	 10			; 0000000aH
  00033	be 00 00 00 00	 mov	 esi, OFFSET FLAT:$SG6071
  00038	59		 pop	 ecx
  00039	8d 7c 24 10	 lea	 edi, DWORD PTR _DeviceLink$[esp+56]
  0003d	f3 a5		 rep movsd
  0003f	8b 78 04	 mov	 edi, DWORD PTR [eax+4]

; 663  : 
; 664  : 	while(NextDeviceObject){

  00042	85 ff		 test	 edi, edi
  00044	0f 84 8b 00 00
	00		 je	 $L6074
  0004a	53		 push	 ebx
  0004b	55		 push	 ebp
$L6073:

; 665  : 		CurrentDeviceObject = NextDeviceObject;
; 666  : 
; 667  : 		ObjExt = (pPCIDP_EXTENSION)CurrentDeviceObject->DeviceExtension;

  0004c	8b 77 28	 mov	 esi, DWORD PTR [edi+40]
  0004f	8b ef		 mov	 ebp, edi

; 668  : 
; 669  : 		// Disconnect the driver from the interrupt if enabled.
; 670  : 		if(ObjExt->InterruptObject)

  00051	8b 46 2c	 mov	 eax, DWORD PTR [esi+44]
  00054	85 c0		 test	 eax, eax
  00056	74 07		 je	 SHORT $L6076

; 671  : 			IoDisconnectInterrupt(ObjExt->InterruptObject);

  00058	50		 push	 eax
  00059	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoDisconnectInterrupt@4
$L6076:

; 672  : 
; 673  : 		// Free up DMA contiguous memory.
; 674  : 		MmUnlockPages(ObjExt->MDL);

  0005f	ff b6 8c 00 00
	00		 push	 DWORD PTR [esi+140]
  00065	8d 9e 8c 00 00
	00		 lea	 ebx, DWORD PTR [esi+140]
  0006b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__MmUnlockPages@4

; 675  : 		IoFreeMdl(ObjExt->MDL);

  00071	ff 33		 push	 DWORD PTR [ebx]
  00073	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoFreeMdl@4

; 676  : 		MmFreeContiguousMemory(ObjExt->VirtualDMAAddress);

  00079	ff b6 84 00 00
	00		 push	 DWORD PTR [esi+132]
  0007f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__MmFreeContiguousMemory@4

; 677  : 
; 678  : 		// Delete all allocated entries in the linked list.
; 679  : 		DeleteAllEntries(ObjExt);

  00085	56		 push	 esi
  00086	e8 00 00 00 00	 call	 _DeleteAllEntries@4

; 680  : 
; 681  : 		// Delete the symbolic link.
; 682  : 		DeviceLink[18] = (USHORT) (0x30 + ObjExt->BoardNumber);

  0008b	66 8b 46 08	 mov	 ax, WORD PTR [esi+8]
  0008f	66 05 30 00	 add	 ax, 48			; 00000030H
  00093	66 89 44 24 3c	 mov	 WORD PTR _DeviceLink$[esp+100], ax

; 683  : 		RtlInitUnicodeString(&DeviceLinkUnicode, DeviceLink);

  00098	8d 44 24 18	 lea	 eax, DWORD PTR _DeviceLink$[esp+64]
  0009c	50		 push	 eax
  0009d	8d 44 24 14	 lea	 eax, DWORD PTR _DeviceLinkUnicode$[esp+68]
  000a1	50		 push	 eax
  000a2	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlInitUnicodeString@8

; 684  : 		IoDeleteSymbolicLink(&DeviceLinkUnicode);

  000a8	8d 44 24 10	 lea	 eax, DWORD PTR _DeviceLinkUnicode$[esp+64]
  000ac	50		 push	 eax
  000ad	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoDeleteSymbolicLink@4

; 685  : 		
; 686  : 		// Unmap physical memory.
; 687  : 		MmUnmapIoSpace(ObjExt->MemoryBase, MemoryBaseSize);

  000b3	68 00 80 00 00	 push	 32768			; 00008000H
  000b8	ff 76 24	 push	 DWORD PTR [esi+36]
  000bb	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__MmUnmapIoSpace@8

; 688  : 
; 689  : 		// Delete the device object.
; 690  : 		NextDeviceObject = CurrentDeviceObject->NextDevice;

  000c1	8b 7f 0c	 mov	 edi, DWORD PTR [edi+12]

; 691  : 		IoDeleteDevice(CurrentDeviceObject);

  000c4	55		 push	 ebp
  000c5	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoDeleteDevice@4
  000cb	85 ff		 test	 edi, edi
  000cd	0f 85 79 ff ff
	ff		 jne	 $L6073
  000d3	5d		 pop	 ebp
  000d4	5b		 pop	 ebx
$L6074:
  000d5	5f		 pop	 edi

; 692  : 	}
; 693  : 
; 694  : 	// Free up the allocated resources.
; 695  : 	//UnReportResources(DriverObject);
; 696  : 
; 697  : 	return STATUS_SUCCESS;

  000d6	33 c0		 xor	 eax, eax
  000d8	5e		 pop	 esi

; 698  : }

  000d9	83 c4 30	 add	 esp, 48			; 00000030H
  000dc	c2 04 00	 ret	 4
_PCIDPUnload@4 ENDP
_TEXT	ENDS
PUBLIC	_PCIDPCancelInterrupt@8
;	COMDAT _PCIDPCancelInterrupt@8
_TEXT	SEGMENT
_DeviceObject$ = 8
_Irp$ = 12
_Interrupt$ = -4
_CurrentLink$ = 8
_FirstLink$ = -8
_PCIDPCancelInterrupt@8 PROC NEAR			; COMDAT

; 708  : ){

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	51		 push	 ecx
  00004	51		 push	 ecx

; 709  : 	// Define variables.
; 710  : 	pPCIDP_EXTENSION ObjExt;
; 711  : 	pREGISTERED_INTERRUPT Interrupt;
; 712  : 	pLINKED_LIST CurrentLink;
; 713  : 	pLINKED_LIST FirstLink;
; 714  : 
; 715  : 	// Initialize variables.
; 716  : 	ObjExt = (pPCIDP_EXTENSION)DeviceObject->DeviceExtension;

  00005	8b 45 08	 mov	 eax, DWORD PTR _DeviceObject$[ebp]
  00008	56		 push	 esi
  00009	57		 push	 edi

; 717  : 
; 718  : 	// Search the driver's events linked list for an entry containing the 
; 719  : 	// user provided Irp.
; 720  : 	CurrentLink = NULL;

  0000a	83 65 08 00	 and	 DWORD PTR _CurrentLink$[ebp], 0
  0000e	8b 70 28	 mov	 esi, DWORD PTR [eax+40]

; 721  : 	FirstLink = NULL;
; 722  : 	while(GetNextEntry(ObjExt, &FirstLink, &CurrentLink, &Interrupt) == TRUE){

  00011	8d 45 fc	 lea	 eax, DWORD PTR _Interrupt$[ebp]
  00014	83 65 f8 00	 and	 DWORD PTR _FirstLink$[ebp], 0
  00018	50		 push	 eax
  00019	8d 45 08	 lea	 eax, DWORD PTR _CurrentLink$[ebp]
  0001c	50		 push	 eax
  0001d	8d 45 f8	 lea	 eax, DWORD PTR _FirstLink$[ebp]
  00020	50		 push	 eax
  00021	56		 push	 esi
  00022	e8 00 00 00 00	 call	 _GetNextEntry@16
  00027	8b 7d 0c	 mov	 edi, DWORD PTR _Irp$[ebp]
  0002a	3c 01		 cmp	 al, 1
  0002c	75 2e		 jne	 SHORT $L6093
$L6092:

; 723  : 
; 724  : 		// Delete its linked list entry.
; 725  : 		if(Irp == Interrupt->Irp){

  0002e	8b 45 fc	 mov	 eax, DWORD PTR _Interrupt$[ebp]

; 727  : 			break;
; 728  : 		}
; 729  : 		else
; 730  : 			PutBackEntry(ObjExt, CurrentLink);

  00031	ff 75 08	 push	 DWORD PTR _CurrentLink$[ebp]
  00034	3b 78 04	 cmp	 edi, DWORD PTR [eax+4]
  00037	56		 push	 esi
  00038	74 1d		 je	 SHORT $L6260
  0003a	e8 00 00 00 00	 call	 _PutBackEntry@8
  0003f	8d 45 fc	 lea	 eax, DWORD PTR _Interrupt$[ebp]
  00042	50		 push	 eax
  00043	8d 45 08	 lea	 eax, DWORD PTR _CurrentLink$[ebp]
  00046	50		 push	 eax
  00047	8d 45 f8	 lea	 eax, DWORD PTR _FirstLink$[ebp]
  0004a	50		 push	 eax
  0004b	56		 push	 esi
  0004c	e8 00 00 00 00	 call	 _GetNextEntry@16
  00051	3c 01		 cmp	 al, 1
  00053	74 d9		 je	 SHORT $L6092

; 723  : 
; 724  : 		// Delete its linked list entry.
; 725  : 		if(Irp == Interrupt->Irp){

  00055	eb 05		 jmp	 SHORT $L6093
$L6260:

; 726  : 			FreeEntry(ObjExt, CurrentLink);

  00057	e8 00 00 00 00	 call	 _FreeEntry@8
$L6093:

; 731  : 	}
; 732  : 
; 733  : 	//IoReleaseCancelSpinLock (Irp->CancelIrql);
; 734  : 	Irp->IoStatus.Information = 0;

  0005c	83 67 1c 00	 and	 DWORD PTR [edi+28], 0

; 735  : 	Irp->IoStatus.Status = STATUS_CANCELLED;
; 736  : 	IoCompleteRequest(Irp, IO_NO_INCREMENT) ;

  00060	32 d2		 xor	 dl, dl
  00062	8b cf		 mov	 ecx, edi
  00064	c7 47 18 20 01
	00 c0		 mov	 DWORD PTR [edi+24], -1073741536 ; c0000120H
  0006b	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8
  00071	5f		 pop	 edi
  00072	5e		 pop	 esi

; 737  : }

  00073	c9		 leave
  00074	c2 08 00	 ret	 8
_PCIDPCancelInterrupt@8 ENDP
_TEXT	ENDS
EXTRN	@InterlockedExchange@8:NEAR
;	COMDAT _PCIDPForDpcIsr@16
_TEXT	SEGMENT
_DeviceObject$ = 12
_RegisteredInt$ = 12
_CancelSpin$ = -12
_CurrentLink$ = -4
_FirstLink$ = -8
_PCIDPForDpcIsr@16 PROC NEAR				; COMDAT

; 749  : ){

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 0c	 sub	 esp, 12			; 0000000cH

; 750  : 	// Define variables.
; 751  : 	pPCIDP_EXTENSION ObjExt;
; 752  : 	pINTERRUPT_DATA IntData;
; 753  : 	pREGISTERED_INTERRUPT RegisteredInt;
; 754  : 	KIRQL CancelSpin;
; 755  : 	pLINKED_LIST CurrentLink;
; 756  : 	pLINKED_LIST FirstLink;
; 757  : 
; 758  : 	// Debug
; 759  : 	//PULONG MemoryBase;
; 760  : 
; 761  : 	// Initialize variables.
; 762  : 	ObjExt = (pPCIDP_EXTENSION)DeviceObject->DeviceExtension;

  00006	8b 45 0c	 mov	 eax, DWORD PTR _DeviceObject$[ebp]
  00009	56		 push	 esi
  0000a	8b 70 28	 mov	 esi, DWORD PTR [eax+40]

; 763  : 	IntData = &ObjExt->InterruptData;
; 764  : 
; 765  : 
; 766  : 	// Debug
; 767  : 	//MemoryBase = ObjExt->MemoryBase;
; 768  : 	//MemoryBase[0x1C53]++;
; 769  : 
; 770  : 	//Service all of the recorded interrupts by checking to see if the interrupt 
; 771  : 	//type has been registered by the user.
; 772  : 	while(IntData->QueNew != IntData->QueNext){

  0000d	8a 46 31	 mov	 al, BYTE PTR [esi+49]
  00010	3a 46 30	 cmp	 al, BYTE PTR [esi+48]
  00013	0f 84 a0 00 00
	00		 je	 $L6115
  00019	53		 push	 ebx
  0001a	33 db		 xor	 ebx, ebx
$L6114:

; 773  : 
; 774  : 		// Debug
; 775  : 		//MemoryBase[0x1C54]++;
; 776  : 
; 777  : 		CurrentLink = NULL;

  0001c	89 5d fc	 mov	 DWORD PTR _CurrentLink$[ebp], ebx

; 778  : 		FirstLink = NULL;

  0001f	89 5d f8	 mov	 DWORD PTR _FirstLink$[ebp], ebx
$L6265:

; 779  : 		while(GetNextEntry(ObjExt, &FirstLink, &CurrentLink, &RegisteredInt) == TRUE){

  00022	8d 45 0c	 lea	 eax, DWORD PTR _RegisteredInt$[ebp]
  00025	50		 push	 eax
  00026	8d 45 fc	 lea	 eax, DWORD PTR _CurrentLink$[ebp]
  00029	50		 push	 eax
  0002a	8d 45 f8	 lea	 eax, DWORD PTR _FirstLink$[ebp]
  0002d	50		 push	 eax
  00

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -