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

📄 pcidppublic.cod

📁 一个amccs5933芯片的驱动程序开发源程序和部分文档
💻 COD
📖 第 1 页 / 共 4 页
字号:
; 592  : 	if(InputBufferLength < sizeof(PCIDP00_REGISTER_INTERRUPT_SEND)){

  0004a	83 7d 14 04	 cmp	 DWORD PTR _InputBufferLength$[ebp], 4
  0004e	73 0a		 jae	 SHORT $L6187

; 593  : 		NTStatus = STATUS_INVALID_BUFFER_SIZE;

  00050	b8 06 02 00 c0	 mov	 eax, -1073741306	; c0000206H

; 594  : 		goto ExitA;

  00055	e9 97 00 00 00	 jmp	 $ExitA$6183
$L6187:

; 595  : 	}
; 596  : 
; 597  : 	// Check for a valid interrupt type.
; 598  : 	switch(Type){

  0005a	48		 dec	 eax
  0005b	48		 dec	 eax
  0005c	74 29		 je	 SHORT $L6193
  0005e	83 e8 06	 sub	 eax, 6
  00061	74 24		 je	 SHORT $L6193
  00063	83 e8 08	 sub	 eax, 8
  00066	74 1f		 je	 SHORT $L6193
  00068	83 e8 10	 sub	 eax, 16			; 00000010H
  0006b	74 1a		 je	 SHORT $L6193
  0006d	83 e8 60	 sub	 eax, 96			; 00000060H
  00070	74 15		 je	 SHORT $L6193
  00072	2d 80 00 00 00	 sub	 eax, 128		; 00000080H
  00077	74 0e		 je	 SHORT $L6193
  00079	2d 00 01 00 00	 sub	 eax, 256		; 00000100H
  0007e	74 07		 je	 SHORT $L6193

; 599  : 	case PCIMasterAbort:
; 600  : 	case PCITargetAbort:
; 601  : 	case I2OOutboundPostFIFONotEmpty:
; 602  : 	case DMAComplete:
; 603  : 	case LocalToHostExternalSignal:
; 604  : 	case LocalToHostMailbox:
; 605  : 	case I2OPCIFIFOOverflow:
; 606  : 		break;
; 607  : 
; 608  : 	default:
; 609  : 		NTStatus = STATUS_INVALID_PARAMETER;

  00080	b8 0d 00 00 c0	 mov	 eax, -1073741811	; c000000dH

; 610  : 		goto ExitA;

  00085	eb 6a		 jmp	 SHORT $ExitA$6183
$L6193:

; 611  : 	}
; 612  : 
; 613  : 	// Get an empty linked list entry.
; 614  : 	LLEntry = GetFreeEntry(ObjExt);

  00087	53		 push	 ebx
  00088	e8 00 00 00 00	 call	 _GetFreeEntry@4
  0008d	8b f0		 mov	 esi, eax

; 615  : 	if(LLEntry != NULL){

  0008f	85 f6		 test	 esi, esi
  00091	74 59		 je	 SHORT $L6197

; 616  : 
; 617  : 		// Set up a cancel routine and mark the IRP pending.
; 618  : 		IoMarkIrpPending (Irp);

  00093	8b 47 60	 mov	 eax, DWORD PTR [edi+96]
  00096	80 48 03 01	 or	 BYTE PTR [eax+3], 1

; 619  : 		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

; 620  : 		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	e8 00 00 00 00	 call	 @InterlockedExchange@8

; 621  : 		IoReleaseCancelSpinLock (CancelSpin);

  000b1	ff 75 10	 push	 DWORD PTR _CancelSpin$[ebp]
  000b4	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4

; 622  : 
; 623  : 		// Add this IRP to the linked list
; 624  : 		LLEntry->RegisteredInterrupt.Irp = Irp;
; 625  : 		LLEntry->RegisteredInterrupt.Type = Type;

  000ba	8b 45 08	 mov	 eax, DWORD PTR _Type$[ebp]

; 626  : 		InsertEntry(ObjExt, LLEntry);

  000bd	56		 push	 esi
  000be	53		 push	 ebx
  000bf	89 7e 10	 mov	 DWORD PTR [esi+16], edi
  000c2	89 46 0c	 mov	 DWORD PTR [esi+12], eax
  000c5	e8 00 00 00 00	 call	 _InsertEntry@8

; 627  : 
; 628  : 		// Enable the interrupt on the board and clear the status bit.
; 629  : 		HINTPattern = MemoryBase[HINT] & 0xFFFF0000;	//get enabled ints

  000ca	8b 45 fc	 mov	 eax, DWORD PTR _MemoryBase$[ebp]

; 630  : 		HINTPattern |= Type;					//bit to clear status
; 631  : 		HINTPattern |= (Type << 16);	//bit to enable the interrupt

  000cd	8b 55 08	 mov	 edx, DWORD PTR _Type$[ebp]
  000d0	05 e4 04 00 00	 add	 eax, 1252		; 000004e4H
  000d5	c1 e2 10	 shl	 edx, 16			; 00000010H
  000d8	8b 08		 mov	 ecx, DWORD PTR [eax]
  000da	66 83 e1 00	 and	 cx, 0

; 639  : 
; 640  : 	ExitA:
; 641  : 	Irp->IoStatus.Status = NTStatus;

  000de	0b ca		 or	 ecx, edx
  000e0	0b 4d 08	 or	 ecx, DWORD PTR _Type$[ebp]
  000e3	89 08		 mov	 DWORD PTR [eax], ecx
  000e5	b8 03 01 00 00	 mov	 eax, 259		; 00000103H
  000ea	eb 05		 jmp	 SHORT $ExitA$6183
$L6197:

; 632  : 		MemoryBase[HINT] = HINTPattern;
; 633  : 
; 634  : 		// Return with I/O pending.
; 635  : 		NTStatus = STATUS_PENDING;
; 636  : 	}
; 637  : 	else
; 638  : 		NTStatus = STATUS_NO_MEMORY;

  000ec	b8 17 00 00 c0	 mov	 eax, -1073741801	; c0000017H
$ExitA$6183:

; 639  : 
; 640  : 	ExitA:
; 641  : 	Irp->IoStatus.Status = NTStatus;

  000f1	89 47 18	 mov	 DWORD PTR [edi+24], eax
  000f4	5f		 pop	 edi
  000f5	5e		 pop	 esi
  000f6	5b		 pop	 ebx

; 642  : }

  000f7	c9		 leave
  000f8	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

; 654  : ){

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 14	 sub	 esp, 20			; 00000014H

; 655  : 
; 656  : 	// Define variables.
; 657  : 	NTSTATUS NTStatus;
; 658  : 	pPCIDP00_UNREGISTER_INTERRUPT_SEND IoInput;
; 659  : 	pPCIDP_EXTENSION ObjExt;
; 660  : 	KIRQL CancelSpin;
; 661  : 	PULONG MemoryBase;
; 662  : 	pREGISTERED_INTERRUPT Interrupt;
; 663  : 	PIO_STACK_LOCATION ThisIrpStack;
; 664  : 	PIO_STACK_LOCATION LLIrpStack;
; 665  : 	pLINKED_LIST CurrentLink;
; 666  : 	pLINKED_LIST FirstLink;
; 667  : 	ULONG Count;
; 668  : 	ULONG Type;
; 669  : 
; 670  : 	// Initialize variables.
; 671  : 	IoInput = (pPCIDP00_UNREGISTER_INTERRUPT_SEND)IoBuffer;
; 672  : 	ObjExt = (pPCIDP_EXTENSION)DeviceObject->DeviceExtension;

  00006	8b 45 08	 mov	 eax, DWORD PTR _DeviceObject$[ebp]
  00009	53		 push	 ebx
  0000a	56		 push	 esi

; 673  : 	MemoryBase = ObjExt->MemoryBase;
; 674  : 	Count = 0;
; 675  : 
; 676  : 	// Check that call was made via the PCIDP API.
; 677  : 	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 24	 mov	 eax, DWORD PTR [esi+36]
  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 $L6227

; 678  : 		NTStatus = STATUS_ACCESS_DENIED;

  0002c	b8 22 00 00 c0	 mov	 eax, -1073741790	; c0000022H

; 679  : 		goto ExitA;

  00031	e9 39 01 00 00	 jmp	 $ExitA$6229
$L6227:

; 680  : 	}
; 681  : 	Type = IoInput->InterruptType & 0x000003FF;

  00036	25 ff 03 00 00	 and	 eax, 1023		; 000003ffH

; 682  : 
; 683  : 	// Check to make sure the board has the interrupt pin enabled.
; 684  : 	if(ObjExt->InterruptObject == 0){

  0003b	39 5e 2c	 cmp	 DWORD PTR [esi+44], ebx
  0003e	89 45 f4	 mov	 DWORD PTR _Type$[ebp], eax
  00041	75 0a		 jne	 SHORT $L6230

; 685  : 		NTStatus = STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT;

  00043	b8 6e 01 00 c0	 mov	 eax, -1073741458	; c000016eH

; 686  : 		goto ExitA;

  00048	e9 22 01 00 00	 jmp	 $ExitA$6229
$L6230:

; 687  : 	}
; 688  : 
; 689  : 	// Make sure the buffer lengths are of sufficient size to handle
; 690  : 	// the transactions.
; 691  : 	if(InputBufferLength < sizeof(PCIDP00_REGISTER_INTERRUPT_SEND)){

  0004d	83 7d 14 04	 cmp	 DWORD PTR _InputBufferLength$[ebp], 4
  00051	73 0a		 jae	 SHORT $L6233

; 692  : 		NTStatus = STATUS_INVALID_BUFFER_SIZE;

  00053	b8 06 02 00 c0	 mov	 eax, -1073741306	; c0000206H

; 693  : 		goto ExitA;

  00058	e9 12 01 00 00	 jmp	 $ExitA$6229
$L6233:

; 694  : 	}
; 695  : 
; 696  : 	// Check for a valid interrupt type.
; 697  : 	switch(Type){

  0005d	48		 dec	 eax
  0005e	48		 dec	 eax
  0005f	74 2c		 je	 SHORT $L6239
  00061	83 e8 06	 sub	 eax, 6
  00064	74 27		 je	 SHORT $L6239
  00066	83 e8 08	 sub	 eax, 8
  00069	74 22		 je	 SHORT $L6239
  0006b	83 e8 10	 sub	 eax, 16			; 00000010H
  0006e	74 1d		 je	 SHORT $L6239
  00070	83 e8 60	 sub	 eax, 96			; 00000060H
  00073	74 18		 je	 SHORT $L6239
  00075	2d 80 00 00 00	 sub	 eax, 128		; 00000080H
  0007a	74 11		 je	 SHORT $L6239
  0007c	2d 00 01 00 00	 sub	 eax, 256		; 00000100H
  00081	74 0a		 je	 SHORT $L6239

; 698  : 	case PCIMasterAbort:
; 699  : 	case PCITargetAbort:
; 700  : 	case I2OOutboundPostFIFONotEmpty:
; 701  : 	case DMAComplete:
; 702  : 	case LocalToHostExternalSignal:
; 703  : 	case LocalToHostMailbox:
; 704  : 	case I2OPCIFIFOOverflow:
; 705  : 		break;
; 706  : 
; 707  : 	default:
; 708  : 		NTStatus = STATUS_INVALID_PARAMETER;

  00083	b8 0d 00 00 c0	 mov	 eax, -1073741811	; c000000dH

; 709  : 		goto ExitA;

  00088	e9 e2 00 00 00	 jmp	 $ExitA$6229
$L6239:

; 710  : 	}
; 711  : 
; 712  : 
; 713  : 	// Search the driver's events linked list for an an entry containing the 
; 714  : 	// user provided interrupt type.
; 715  : 	NTStatus = STATUS_SUCCESS;
; 716  : 	ThisIrpStack = IoGetCurrentIrpStackLocation(Irp);

  0008d	8b 45 0c	 mov	 eax, DWORD PTR _Irp$[ebp]
  00090	89 5d f0	 mov	 DWORD PTR _NTStatus$[ebp], ebx

; 717  : 
; 718  : 	CurrentLink = NULL;

  00093	89 5d 10	 mov	 DWORD PTR _CurrentLink$[ebp], ebx

; 719  : 	FirstLink = NULL;

  00096	89 5d f8	 mov	 DWORD PTR _FirstLink$[ebp], ebx
  00099	8b 78 60	 mov	 edi, DWORD PTR [eax+96]

; 720  : 	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	 $L6326
$L6246:

; 721  : 		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 $L6249

; 722  : 			Count++;
; 723  : 			LLIrpStack = IoGetCurrentIrpStackLocation(Interrupt->Irp);
; 724  : 
; 725  : 			// Cancel the IRP, then delete its linked list entry.
; 726  : 			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 $L6249

; 727  : 				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

; 728  : 				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

; 729  : 				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

; 730  : 				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

; 731  : 				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

; 732  : 				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

; 733  : 				IoReleaseCancelSpinLock (CancelSpin);

  00110	ff 75 14	 push	 DWORD PTR _CancelSpin$[ebp]
  00113	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoReleaseCancelSpinLock@4

; 734  : 
; 735  : 				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

; 736  : 
; 737  : 				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

; 738  : 			}
; 739  : 			else

  00130	eb 09		 jmp	 SHORT $L6253
$L6249:

; 740  : 				PutBackEntry(ObjExt, CurrentLink);
; 741  : 		}
; 742  : 		else
; 743  : 			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
$L6253:
  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	 $L6246

; 744  : 	}
; 745  : 
; 746  : 	// Disable the interrupt type if no other thread is currently
; 747  : 	// registered.
; 748  : 	if(Count == 1)

  00155	83 7d fc 01	 cmp	 DWORD PTR _Count$[ebp], 1
  00159	75 11		 jne	 SHORT $L6326

; 749  : 		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
$L6326:
  0016c	8b 45 f0	 mov	 eax, DWORD PTR _NTStatus$[ebp]
$ExitA$6229:

; 750  : 		
; 751  : 
; 752  : 	ExitA:
; 753  : 	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

; 754  : }

  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 + -