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

📄 pcidp.cod

📁 一个amccs5933芯片的驱动程序开发源程序和部分文档
💻 COD
📖 第 1 页 / 共 5 页
字号:
  00079	e9 84 00 00 00	 jmp	 $L6014
$L6018:

; 469  : 
; 470  : 	case IOCTL_PCIDP00_UNMAP:
; 471  : 		PCIDPUnMap(
; 472  : 			IN DeviceObject,
; 473  : 			IN OUT Irp,
; 474  : 			IN IoBuffer,
; 475  : 			IN InputBufferLength
; 476  : 		);

  0007e	57		 push	 edi
  0007f	51		 push	 ecx
  00080	56		 push	 esi
  00081	ff 75 08	 push	 DWORD PTR _DeviceObject$[ebp]
  00084	e8 00 00 00 00	 call	 _PCIDPUnMap@16

; 477  : 		break;

  00089	eb 77		 jmp	 SHORT $L6014
$L6017:

; 459  : 
; 460  : 	case IOCTL_PCIDP00_MAP_BASE_REGS:
; 461  : 		PCIDPMapBaseRegs(
; 462  : 			IN DeviceObject,
; 463  : 			IN OUT Irp,
; 464  : 			IN OUT IoBuffer,
; 465  : 			IN InputBufferLength,
; 466  : 			IN OutputBufferLength
; 467  : 		);

  0008b	53		 push	 ebx
  0008c	57		 push	 edi
  0008d	51		 push	 ecx
  0008e	56		 push	 esi
  0008f	ff 75 08	 push	 DWORD PTR _DeviceObject$[ebp]
  00092	e8 00 00 00 00	 call	 _PCIDPMapBaseRegs@20

; 468  : 		break;

  00097	eb 69		 jmp	 SHORT $L6014
$L6023:

; 514  : 
; 515  : 	case IOCTL_PCIDP00_SET_PCI_CONFIG_REGS:
; 516  : 		PCIDPSetPCIRegs(
; 517  : 			IN DeviceObject,
; 518  : 			IN OUT Irp,
; 519  : 			IN IoBuffer,
; 520  : 			IN InputBufferLength
; 521  : 		);

  00099	57		 push	 edi
  0009a	51		 push	 ecx
  0009b	56		 push	 esi
  0009c	ff 75 08	 push	 DWORD PTR _DeviceObject$[ebp]
  0009f	e8 00 00 00 00	 call	 _PCIDPSetPCIRegs@16

; 522  : 		break;

  000a4	eb 5c		 jmp	 SHORT $L6014
$L6246:

; 445  : 	Irp->IoStatus.Information = 0;
; 446  : 
; 447  : 	// Get a pointer to the current location in the Irp. This is where
; 448  : 	// the function codes and parameters are located.
; 449  : 	IrpStack = IoGetCurrentIrpStackLocation(IN Irp);
; 450  : 
; 451  : 	// Get the pointer to the input/output buffer and it's length(s).
; 452  : 	IoBuffer           = Irp->AssociatedIrp.SystemBuffer;
; 453  : 	InputBufferLength  = IrpStack->Parameters.DeviceIoControl.InputBufferLength;
; 454  : 	OutputBufferLength = IrpStack->Parameters.DeviceIoControl.OutputBufferLength;
; 455  : 
; 456  : 
; 457  : 	// Determine which I/O control code was specified.
; 458  : 	switch (IrpStack->Parameters.DeviceIoControl.IoControlCode){

  000a6	3d 98 20 00 c3	 cmp	 eax, -1023401832	; c3002098H
  000ab	74 49		 je	 SHORT $L6024
  000ad	3d 9c 20 00 c3	 cmp	 eax, -1023401828	; c300209cH
  000b2	74 35		 je	 SHORT $L6025
  000b4	3d a0 20 00 c3	 cmp	 eax, -1023401824	; c30020a0H
  000b9	74 47		 je	 SHORT $L6014
  000bb	3d a4 20 00 c3	 cmp	 eax, -1023401820	; c30020a4H
  000c0	74 1d		 je	 SHORT $L6027
  000c2	3d a8 20 00 c3	 cmp	 eax, -1023401816	; c30020a8H
  000c7	74 09		 je	 SHORT $L6020
$L6028:

; 553  : 
; 554  : 	default:
; 555  : 		Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;

  000c9	c7 46 18 10 00
	00 c0		 mov	 DWORD PTR [esi+24], -1073741808 ; c0000010H

; 556  : 		break;

  000d0	eb 30		 jmp	 SHORT $L6014
$L6020:

; 487  : 
; 488  : 	case IOCTL_PCIDP00_CANCEL_MAP_DMA:
; 489  : 		PCIDPCancelMapDMA(
; 490  : 			IN DeviceObject,
; 491  : 			IN OUT Irp,
; 492  : 			IN IoBuffer,
; 493  : 			IN InputBufferLength
; 494  : 		);

  000d2	57		 push	 edi
  000d3	51		 push	 ecx
  000d4	56		 push	 esi
  000d5	ff 75 08	 push	 DWORD PTR _DeviceObject$[ebp]
  000d8	e8 00 00 00 00	 call	 _PCIDPCancelMapDMA@16

; 495  : 		break;

  000dd	eb 23		 jmp	 SHORT $L6014
$L6027:

; 542  : 
; 543  : 	case IOCTL_PCIDP00_HELLO:
; 544  : 		break;
; 545  : 
; 546  : 	case IOCTL_PCIDP00_GET_VERSION:
; 547  : 		PCIDPGetDriverVersion(
; 548  : 			IN OUT Irp,
; 549  : 			OUT IoBuffer,
; 550  : 			IN OutputBufferLength
; 551  : 		);

  000df	53		 push	 ebx
  000e0	51		 push	 ecx
  000e1	56		 push	 esi
  000e2	e8 00 00 00 00	 call	 _PCIDPGetDriverVersion@12

; 552  : 		break;

  000e7	eb 19		 jmp	 SHORT $L6014
$L6025:

; 532  : 		break;
; 533  : 
; 534  : 	case IOCTL_PCIDP00_UNREGISTER_INTERRUPT:
; 535  : 		PCIDPUnregisterInterrupt(
; 536  : 			IN DeviceObject,
; 537  : 			IN OUT Irp,
; 538  : 			IN IoBuffer,
; 539  : 			IN InputBufferLength
; 540  : 		);

  000e9	57		 push	 edi
  000ea	51		 push	 ecx
  000eb	56		 push	 esi
  000ec	ff 75 08	 push	 DWORD PTR _DeviceObject$[ebp]
  000ef	e8 00 00 00 00	 call	 _PCIDPUnregisterInterrupt@16

; 541  : 		break;

  000f4	eb 0c		 jmp	 SHORT $L6014
$L6024:

; 523  : 
; 524  : 	case IOCTL_PCIDP00_REGISTER_INTERRUPT:
; 525  : 		PCIDPRegisterInterrupt(
; 526  : 			IN DeviceObject,
; 527  : 			IN OUT Irp,
; 528  : 			IN IoBuffer,
; 529  : 			IN InputBufferLength,
; 530  : 			IN OutputBufferLength
; 531  : 		);

  000f6	53		 push	 ebx
  000f7	57		 push	 edi
  000f8	51		 push	 ecx
  000f9	56		 push	 esi
  000fa	ff 75 08	 push	 DWORD PTR _DeviceObject$[ebp]
  000fd	e8 00 00 00 00	 call	 _PCIDPRegisterInterrupt@20
$L6014:

; 557  : 	}
; 558  : 
; 559  : 	// Finish the I/O operation by simply completing the packet and returning
; 560  : 	// the same status as in the packet itself.  However, don't complete the I/O
; 561  : 	// if the status is pending.
; 562  : 	NTStatus = Irp->IoStatus.Status;

  00102	8b 7e 18	 mov	 edi, DWORD PTR [esi+24]

; 563  : 	if(NTStatus != STATUS_PENDING)

  00105	81 ff 03 01 00
	00		 cmp	 edi, 259		; 00000103H
  0010b	74 0a		 je	 SHORT $L6031

; 564  : 		IoCompleteRequest(Irp, IO_NO_INCREMENT);

  0010d	32 d2		 xor	 dl, dl
  0010f	8b ce		 mov	 ecx, esi
  00111	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8
$L6031:

; 565  : 
; 566  : 	return NTStatus;

  00117	8b c7		 mov	 eax, edi
  00119	5f		 pop	 edi
  0011a	5e		 pop	 esi
  0011b	5b		 pop	 ebx

; 567  : }

  0011c	5d		 pop	 ebp
  0011d	c2 08 00	 ret	 8
_PCIDPDeviceControl@8 ENDP
_TEXT	ENDS
;	COMDAT _PCIDPCreateClose@8
_TEXT	SEGMENT
_Irp$ = 12
_PCIDPCreateClose@8 PROC NEAR				; COMDAT

; 580  : 
; 581  : 	Irp->IoStatus.Status = STATUS_SUCCESS;

  00000	8b 4c 24 08	 mov	 ecx, DWORD PTR _Irp$[esp-4]

; 582  : 	Irp->IoStatus.Information = 0;
; 583  : 
; 584  : 	IoCompleteRequest( Irp, IO_NO_INCREMENT );

  00004	32 d2		 xor	 dl, dl
  00006	83 61 18 00	 and	 DWORD PTR [ecx+24], 0
  0000a	83 61 1c 00	 and	 DWORD PTR [ecx+28], 0
  0000e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8

; 585  : 
; 586  : 	return STATUS_SUCCESS;

  00014	33 c0		 xor	 eax, eax

; 587  : }

  00016	c2 08 00	 ret	 8
_PCIDPCreateClose@8 ENDP
_TEXT	ENDS
EXTRN	__imp__IoAcquireCancelSpinLock@4:NEAR
EXTRN	__imp__IoReleaseCancelSpinLock@4:NEAR
EXTRN	_GetNextEntry@16:NEAR
EXTRN	_PutBackEntry@8:NEAR
EXTRN	_FreeEntry@8:NEAR
;	COMDAT _PCIDPCleanup@8
_TEXT	SEGMENT
_DeviceObject$ = 8
_Irp$ = 12
_Interrupt$ = 8
_CleanUpStack$ = -12
_CancelSpin$ = -16
_CurrentLink$ = -4
_FirstLink$ = -8
_PCIDPCleanup@8 PROC NEAR				; COMDAT

; 597  : ){

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	83 ec 10	 sub	 esp, 16			; 00000010H

; 598  : 
; 599  : 	// Define variables.
; 600  : 	pPCIDP_EXTENSION ObjExt;
; 601  : 	pREGISTERED_INTERRUPT Interrupt;
; 602  : 	PIO_STACK_LOCATION CleanUpStack ;
; 603  : 	PIO_STACK_LOCATION IrpStack ;
; 604  : 	KIRQL CancelSpin;
; 605  : 	pLINKED_LIST CurrentLink;
; 606  : 	pLINKED_LIST FirstLink;
; 607  : 
; 608  : 	// Initialize variables.
; 609  : 	ObjExt = (pPCIDP_EXTENSION)DeviceObject->DeviceExtension;

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

; 610  : 
; 611  : 	// Search the driver's events linked list for an entry containing the 
; 612  : 	// user provided Irp.
; 613  : 	CleanUpStack = IoGetCurrentIrpStackLocation(Irp);

  0000b	8b 75 0c	 mov	 esi, DWORD PTR _Irp$[ebp]
  0000e	57		 push	 edi
  0000f	8b 78 28	 mov	 edi, DWORD PTR [eax+40]
  00012	8b 46 60	 mov	 eax, DWORD PTR [esi+96]

; 614  : 	CurrentLink = NULL;

  00015	83 65 fc 00	 and	 DWORD PTR _CurrentLink$[ebp], 0
  00019	89 45 f4	 mov	 DWORD PTR _CleanUpStack$[ebp], eax

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

  0001c	8d 45 08	 lea	 eax, DWORD PTR _Interrupt$[ebp]
  0001f	83 65 f8 00	 and	 DWORD PTR _FirstLink$[ebp], 0
  00023	50		 push	 eax
  00024	8d 45 fc	 lea	 eax, DWORD PTR _CurrentLink$[ebp]
  00027	50		 push	 eax
  00028	8d 45 f8	 lea	 eax, DWORD PTR _FirstLink$[ebp]
  0002b	50		 push	 eax
  0002c	57		 push	 edi
  0002d	e8 00 00 00 00	 call	 _GetNextEntry@16
  00032	8b 1d 00 00 00
	00		 mov	 ebx, DWORD PTR __imp_@IofCompleteRequest@8
  00038	3c 01		 cmp	 al, 1
  0003a	0f 85 9b 00 00
	00		 jne	 $L6056

; 617  : 		IrpStack = IoGetCurrentIrpStackLocation(Interrupt->Irp);
; 618  : 
; 619  : 		// Cancel the IRP, then delete its linked list entry.
; 620  : 		if (IrpStack->FileObject == CleanUpStack->FileObject) {

  00040	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__IoReleaseCancelSpinLock@4
$L6055:
  00046	8b 45 08	 mov	 eax, DWORD PTR _Interrupt$[ebp]
  00049	8b 4d f4	 mov	 ecx, DWORD PTR _CleanUpStack$[ebp]
  0004c	8b 40 04	 mov	 eax, DWORD PTR [eax+4]
  0004f	8b 40 60	 mov	 eax, DWORD PTR [eax+96]
  00052	8b 40 18	 mov	 eax, DWORD PTR [eax+24]
  00055	3b 41 18	 cmp	 eax, DWORD PTR [ecx+24]
  00058	75 5b		 jne	 SHORT $L6057

; 621  : 			IoAcquireCancelSpinLock (&CancelSpin);

  0005a	8d 45 f0	 lea	 eax, DWORD PTR _CancelSpin$[ebp]
  0005d	50		 push	 eax
  0005e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__IoAcquireCancelSpinLock@4

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

  00064	8b 45 08	 mov	 eax, DWORD PTR _Interrupt$[ebp]
  00067	8b 40 04	 mov	 eax, DWORD PTR [eax+4]
  0006a	c6 40 24 01	 mov	 BYTE PTR [eax+36], 1

; 623  : 			//Interrupt->Irp->CancelIrql = CancelSpin;
; 624  : 			Interrupt->Irp->CancelRoutine = NULL;

  0006e	8b 45 08	 mov	 eax, DWORD PTR _Interrupt$[ebp]
  00071	8b 40 04	 mov	 eax, DWORD PTR [eax+4]
  00074	83 60 38 00	 and	 DWORD PTR [eax+56], 0

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

  00078	8b 45 08	 mov	 eax, DWORD PTR _Interrupt$[ebp]
  0007b	8b 40 04	 mov	 eax, DWORD PTR [eax+4]
  0007e	c7 40 18 20 01
	00 c0		 mov	 DWORD PTR [eax+24], -1073741536 ; c0000120H

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

  00085	8b 45 08	 mov	 eax, DWORD PTR _Interrupt$[ebp]
  00088	8b 40 04	 mov	 eax, DWORD PTR [eax+4]
  0008b	83 60 1c 00	 and	 DWORD PTR [eax+28], 0

; 627  : 			IoReleaseCancelSpinLock (CancelSpin);

  0008f	ff 75 f0	 push	 DWORD PTR _CancelSpin$[ebp]
  00092	ff d6		 call	 esi

; 628  : 			IoReleaseCancelSpinLock (Interrupt->Irp->CancelIrql);

  00094	8b 45 08	 mov	 eax, DWORD PTR _Interrupt$[ebp]
  00097	8b 40 04	 mov	 eax, DWORD PTR [eax+4]
  0009a	8a 40 25	 mov	 al, BYTE PTR [eax+37]
  0009d	50		 push	 eax
  0009e	ff d6		 call	 esi

; 629  : 
; 630  : 			IoCompleteRequest(Interrupt->Irp, IO_NO_INCREMENT);

  000a0	8b 45 08	 mov	 eax, DWORD PTR _Interrupt$[ebp]
  000a3	32 d2		 xor	 dl, dl
  000a5	8b 48 04	 mov	 ecx, DWORD PTR [eax+4]
  000a8	ff d3		 call	 ebx

; 631  : 			FreeEntry(ObjExt, CurrentLink);

  000aa	ff 75 fc	 push	 DWORD PTR _CurrentLink$[ebp]
  000ad	57		 push	 edi
  000ae	e8 00 00 00 00	 call	 _FreeEntry@8

; 632  : 		}
; 633  : 		else

  000b3	eb 09		 jmp	 SHORT $L6060
$L6057:

; 634  : 			PutBackEntry(ObjExt, CurrentLink);

  000b5	ff 75 fc	 push	 DWORD PTR _CurrentLink$[ebp]
  000b8	57		 push	 edi
  000b9	e8 00 00 00 00	 call	 _PutBackEntry@8
$L6060:
  000be	8d 45 08	 lea	 eax, DWORD PTR _Interrupt$[ebp]
  000c1	50		 push	 eax

⌨️ 快捷键说明

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