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

📄 pcidppublic.asm

📁 一个amccs5933芯片的驱动程序开发源程序和部分文档
💻 ASM
📖 第 1 页 / 共 4 页
字号:
; 622  : 	}
; 623  : 
; 624  : 	// Check for a valid interrupt type.
; 625  : 	switch(Type){

	dec	eax
	dec	eax
	je	SHORT $L8719
	sub	eax, 6
	je	SHORT $L8719
	sub	eax, 8
	je	SHORT $L8719
	sub	eax, 16					; 00000010H
	je	SHORT $L8719
	sub	eax, 96					; 00000060H
	je	SHORT $L8719
	sub	eax, 128				; 00000080H
	je	SHORT $L8719
	sub	eax, 256				; 00000100H
	je	SHORT $L8719

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

	mov	eax, -1073741811			; c000000dH

; 637  : 		goto ExitA;

	jmp	SHORT $ExitA$8709
$L8719:

; 638  : 	}
; 639  : 
; 640  : 	// Get an empty linked list entry.
; 641  : 	LLEntry = GetFreeEntry(ObjExt);

	push	ebx
	call	_GetFreeEntry@4
	mov	esi, eax

; 642  : 	if(LLEntry != NULL){

	test	esi, esi
	je	SHORT $L8723

; 643  : 
; 644  : 		// Set up a cancel routine and mark the IRP pending.
; 645  : 		IoMarkIrpPending (Irp);

	mov	eax, DWORD PTR [edi+96]
	or	BYTE PTR [eax+3], 1

; 646  : 		IoAcquireCancelSpinLock (&CancelSpin);

	lea	eax, DWORD PTR _CancelSpin$[ebp]
	push	eax
	call	DWORD PTR __imp__IoAcquireCancelSpinLock@4

; 647  : 		IoSetCancelRoutine (Irp, PCIDPCancelInterrupt);

	mov	edx, OFFSET FLAT:_PCIDPCancelInterrupt@8
	lea	ecx, DWORD PTR [edi+56]
	call	DWORD PTR __imp_@InterlockedExchange@8

; 648  : 		IoReleaseCancelSpinLock (CancelSpin);

	push	DWORD PTR _CancelSpin$[ebp]
	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;

	mov	eax, DWORD PTR _Type$[ebp]

; 653  : 		InsertEntry(ObjExt, LLEntry);

	push	esi
	push	ebx
	mov	DWORD PTR [esi+16], edi
	mov	DWORD PTR [esi+12], eax
	call	_InsertEntry@8

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

	mov	eax, DWORD PTR _MemoryBase$[ebp]

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

	mov	edx, DWORD PTR _Type$[ebp]
	add	eax, 1252				; 000004e4H
	shl	edx, 16					; 00000010H
	mov	ecx, DWORD PTR [eax]
	and	cx, 0

; 666  : 
; 667  : 	ExitA:
; 668  : 	Irp->IoStatus.Status = NTStatus;

	or	ecx, edx
	or	ecx, DWORD PTR _Type$[ebp]
	mov	DWORD PTR [eax], ecx
	mov	eax, 259				; 00000103H
	jmp	SHORT $ExitA$8709
$L8723:

; 659  : 		MemoryBase[HINT] = HINTPattern;
; 660  : 
; 661  : 		// Return with I/O pending.
; 662  : 		NTStatus = STATUS_PENDING;
; 663  : 	}
; 664  : 	else
; 665  : 		NTStatus = STATUS_NO_MEMORY;

	mov	eax, -1073741801			; c0000017H
$ExitA$8709:

; 666  : 
; 667  : 	ExitA:
; 668  : 	Irp->IoStatus.Status = NTStatus;

	mov	DWORD PTR [edi+24], eax
	pop	edi
	pop	esi
	pop	ebx

; 669  : }

	leave
	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  : ){

	push	ebp
	mov	ebp, esp
	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;

	mov	eax, DWORD PTR _DeviceObject$[ebp]
	push	ebx
	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){

	mov	ecx, -255852544				; f0c00000H
	mov	esi, DWORD PTR [eax+40]
	xor	ebx, ebx
	push	edi
	mov	DWORD PTR _Count$[ebp], ebx
	mov	eax, DWORD PTR [esi+24]
	mov	DWORD PTR _MemoryBase$[ebp], eax
	mov	eax, DWORD PTR _IoBuffer$[ebp]
	mov	eax, DWORD PTR [eax]
	mov	edx, eax
	and	edx, ecx
	cmp	edx, ecx
	je	SHORT $L8756

; 705  : 		NTStatus = STATUS_ACCESS_DENIED;

	mov	eax, -1073741790			; c0000022H

; 706  : 		goto ExitA;

	jmp	$ExitA$8758
$L8756:

; 707  : 	}
; 708  : 	Type = IoInput->InterruptType & 0x000003FF;

	and	eax, 1023				; 000003ffH

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

	cmp	DWORD PTR [esi+32], ebx
	mov	DWORD PTR _Type$[ebp], eax
	jne	SHORT $L8759

; 712  : 		NTStatus = STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT;

	mov	eax, -1073741458			; c000016eH

; 713  : 		goto ExitA;

	jmp	$ExitA$8758
$L8759:

; 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)){

	cmp	DWORD PTR _InputBufferLength$[ebp], 4
	jae	SHORT $L8762

; 719  : 		NTStatus = STATUS_INVALID_BUFFER_SIZE;

	mov	eax, -1073741306			; c0000206H

; 720  : 		goto ExitA;

	jmp	$ExitA$8758
$L8762:

; 721  : 	}
; 722  : 
; 723  : 	// Check for a valid interrupt type.
; 724  : 	switch(Type){

	dec	eax
	dec	eax
	je	SHORT $L8768
	sub	eax, 6
	je	SHORT $L8768
	sub	eax, 8
	je	SHORT $L8768
	sub	eax, 16					; 00000010H
	je	SHORT $L8768
	sub	eax, 96					; 00000060H
	je	SHORT $L8768
	sub	eax, 128				; 00000080H
	je	SHORT $L8768
	sub	eax, 256				; 00000100H
	je	SHORT $L8768

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

	mov	eax, -1073741811			; c000000dH

; 736  : 		goto ExitA;

	jmp	$ExitA$8758
$L8768:

; 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);

	mov	eax, DWORD PTR _Irp$[ebp]
	mov	DWORD PTR _NTStatus$[ebp], ebx

; 744  : 
; 745  : 	CurrentLink = NULL;

	mov	DWORD PTR _CurrentLink$[ebp], ebx

; 746  : 	FirstLink = NULL;

	mov	DWORD PTR _FirstLink$[ebp], ebx
	mov	edi, DWORD PTR [eax+96]

; 747  : 	while(GetNextEntry(ObjExt, &FirstLink, &CurrentLink, &Interrupt) == TRUE){

	lea	eax, DWORD PTR _Interrupt$[ebp]
	push	eax
	lea	eax, DWORD PTR _CurrentLink$[ebp]
	push	eax
	lea	eax, DWORD PTR _FirstLink$[ebp]
	push	eax
	push	esi
	call	_GetNextEntry@16
	cmp	al, 1
	jne	$L8846
$L8775:

; 748  : 		if(Type == Interrupt->Type){

	mov	eax, DWORD PTR _Interrupt$[ebp]
	mov	ecx, DWORD PTR _Type$[ebp]
	cmp	ecx, DWORD PTR [eax]
	jne	SHORT $L8778

; 749  : 			Count++;
; 750  : 			LLIrpStack = IoGetCurrentIrpStackLocation(Interrupt->Irp);
; 751  : 
; 752  : 			// Cancel the IRP, then delete its linked list entry.
; 753  : 			if (LLIrpStack->FileObject == ThisIrpStack->FileObject) {

	mov	eax, DWORD PTR [eax+4]
	inc	DWORD PTR _Count$[ebp]
	mov	eax, DWORD PTR [eax+96]
	mov	eax, DWORD PTR [eax+24]
	cmp	eax, DWORD PTR [edi+24]
	jne	SHORT $L8778

; 754  : 				IoAcquireCancelSpinLock (&CancelSpin);

	lea	eax, DWORD PTR _CancelSpin$[ebp]
	push	eax
	call	DWORD PTR __imp__IoAcquireCancelSpinLock@4

; 755  : 				Interrupt->Irp->Cancel = TRUE;

	mov	eax, DWORD PTR _Interrupt$[ebp]
	mov	eax, DWORD PTR [eax+4]
	mov	BYTE PTR [eax+36], 1

; 756  : 				Interrupt->Irp->CancelIrql = CancelSpin;

	mov	eax, DWORD PTR _Interrupt$[ebp]
	mov	cl, BYTE PTR _CancelSpin$[ebp]
	mov	eax, DWORD PTR [eax+4]
	mov	BYTE PTR [eax+37], cl

; 757  : 				Interrupt->Irp->CancelRoutine = NULL;

	mov	eax, DWORD PTR _Interrupt$[ebp]
	mov	eax, DWORD PTR [eax+4]
	mov	DWORD PTR [eax+56], ebx

; 758  : 				Interrupt->Irp->IoStatus.Status = STATUS_CANCELLED;

	mov	eax, DWORD PTR _Interrupt$[ebp]
	mov	eax, DWORD PTR [eax+4]
	mov	DWORD PTR [eax+24], -1073741536		; c0000120H

; 759  : 				Interrupt->Irp->IoStatus.Information = 0;

	mov	eax, DWORD PTR _Interrupt$[ebp]
	mov	eax, DWORD PTR [eax+4]
	mov	DWORD PTR [eax+28], ebx

; 760  : 				IoReleaseCancelSpinLock (CancelSpin);

	push	DWORD PTR _CancelSpin$[ebp]
	call	DWORD PTR __imp__IoReleaseCancelSpinLock@4

; 761  : 
; 762  : 				IoCompleteRequest(Interrupt->Irp, IO_NO_INCREMENT);

	mov	eax, DWORD PTR _Interrupt$[ebp]
	xor	dl, dl
	mov	ecx, DWORD PTR [eax+4]
	call	DWORD PTR __imp_@IofCompleteRequest@8

; 763  : 
; 764  : 				FreeEntry(ObjExt, CurrentLink);

	push	DWORD PTR _CurrentLink$[ebp]
	push	esi
	call	_FreeEntry@8

; 765  : 			}
; 766  : 			else

	jmp	SHORT $L8782
$L8778:

; 767  : 				PutBackEntry(ObjExt, CurrentLink);
; 768  : 		}
; 769  : 		else
; 770  : 			PutBackEntry(ObjExt, CurrentLink);

	push	DWORD PTR _CurrentLink$[ebp]
	push	esi
	call	_PutBackEntry@8
$L8782:
	lea	eax, DWORD PTR _Interrupt$[ebp]
	push	eax
	lea	eax, DWORD PTR _CurrentLink$[ebp]
	push	eax
	lea	eax, DWORD PTR _FirstLink$[ebp]
	push	eax
	push	esi
	call	_GetNextEntry@16
	cmp	al, 1
	je	$L8775

; 771  : 	}
; 772  : 
; 773  : 	// Disable the interrupt type if no other thread is currently
; 774  : 	// registered.
; 775  : 	if(Count == 1)

	cmp	DWORD PTR _Count$[ebp], 1
	jne	SHORT $L8846

; 776  : 		MemoryBase[HINT] &= (~Type) << 16;

	mov	eax, DWORD PTR _Type$[ebp]
	mov	ecx, DWORD PTR _MemoryBase$[ebp]
	not	eax
	shl	eax, 16					; 00000010H
	and	DWORD PTR [ecx+1252], eax
$L8846:
	mov	eax, DWORD PTR _NTStatus$[ebp]
$ExitA$8758:

; 777  : 		
; 778  : 
; 779  : 	ExitA:
; 780  : 	Irp->IoStatus.Status = NTStatus;

	mov	ecx, DWORD PTR _Irp$[ebp]
	pop	edi
	pop	esi
	pop	ebx
	mov	DWORD PTR [ecx+24], eax

; 781  : }

	leave
	ret	16					; 00000010H
_PCIDPUnregisterInterrupt@16 ENDP
_TEXT	ENDS
END

⌨️ 快捷键说明

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