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

📄 pcidp.cod

📁 一个amccs5933芯片的驱动程序开发源程序和部分文档
💻 COD
📖 第 1 页 / 共 5 页
字号:
  0000e	8b 46 60	 mov	 eax, DWORD PTR [esi+96]
  00011	83 66 18 00	 and	 DWORD PTR [esi+24], 0
  00015	83 66 1c 00	 and	 DWORD PTR [esi+28], 0
  00019	8b 4e 0c	 mov	 ecx, DWORD PTR [esi+12]
  0001c	8b 50 04	 mov	 edx, DWORD PTR [eax+4]
  0001f	8b 58 08	 mov	 ebx, DWORD PTR [eax+8]
  00022	89 55 0c	 mov	 DWORD PTR _OutputBufferLength$[ebp], edx
  00025	8b 50 0c	 mov	 edx, DWORD PTR [eax+12]
  00028	3b d7		 cmp	 edx, edi
  0002a	0f 87 99 00 00
	00		 ja	 $L8721
  00030	0f 84 83 00 00
	00		 je	 $L8514
  00036	81 fa 80 20 00
	c3		 cmp	 edx, -1023401856	; c3002080H
  0003c	74 6b		 je	 SHORT $L8508
  0003e	81 fa 84 20 00
	c3		 cmp	 edx, -1023401852	; c3002084H
  00044	74 53		 je	 SHORT $L8509
  00046	81 fa 88 20 00
	c3		 cmp	 edx, -1023401848	; c3002088H
  0004c	74 39		 je	 SHORT $L8510
  0004e	81 fa 8c 20 00
	c3		 cmp	 edx, -1023401844	; c300208cH
  00054	74 21		 je	 SHORT $L8512
  00056	81 fa 90 20 00
	c3		 cmp	 edx, -1023401840	; c3002090H
  0005c	0f 85 8f 00 00
	00		 jne	 $L8519

; 448  : 
; 449  : 	case IOCTL_PCIDP00_GET_PCI_CONFIG_REGS:
; 450  : 		PCIDPGetPCIRegs(
; 451  : 			IN DeviceObject,
; 452  : 			IN IrpStack->FileObject,
; 453  : 			IN OUT Irp,
; 454  : 			OUT IoBuffer,
; 455  : 			IN OutputBufferLength
; 456  : 		);

  00062	ff 75 0c	 push	 DWORD PTR _OutputBufferLength$[ebp]
  00065	51		 push	 ecx
  00066	56		 push	 esi
  00067	ff 70 18	 push	 DWORD PTR [eax+24]
  0006a	ff 75 08	 push	 DWORD PTR _DeviceObject$[ebp]
  0006d	e8 00 00 00 00	 call	 _PCIDPGetPCIRegs@20

; 457  : 		break;

  00072	e9 b7 00 00 00	 jmp	 $L8505
$L8512:

; 439  : 
; 440  : 	case IOCTL_PCIDP00_UNMAP_DMA:
; 441  : 		PCIDPUnMapDMA(
; 442  : 			IN DeviceObject,
; 443  : 			IN OUT Irp,
; 444  : 			IN IoBuffer,
; 445  : 			IN InputBufferLength
; 446  : 		);

  00077	53		 push	 ebx
  00078	51		 push	 ecx
  00079	56		 push	 esi
  0007a	ff 75 08	 push	 DWORD PTR _DeviceObject$[ebp]
  0007d	e8 00 00 00 00	 call	 _PCIDPUnMapDMA@16

; 447  : 		break;

  00082	e9 a7 00 00 00	 jmp	 $L8505
$L8510:

; 421  : 
; 422  : 	case IOCTL_PCIDP00_MAP_DMA_MEM:
; 423  : 		PCIDPMapDMAMem(
; 424  : 			IN DeviceObject,
; 425  : 			IN OUT Irp,
; 426  : 			OUT IoBuffer,
; 427  : 			IN OutputBufferLength
; 428  : 		);

  00087	ff 75 0c	 push	 DWORD PTR _OutputBufferLength$[ebp]
  0008a	51		 push	 ecx
  0008b	56		 push	 esi
  0008c	ff 75 08	 push	 DWORD PTR _DeviceObject$[ebp]
  0008f	e8 00 00 00 00	 call	 _PCIDPMapDMAMem@16

; 429  : 		break;

  00094	e9 95 00 00 00	 jmp	 $L8505
$L8509:

; 412  : 
; 413  : 	case IOCTL_PCIDP00_UNMAP:
; 414  : 		PCIDPUnMap(
; 415  : 			IN DeviceObject,
; 416  : 			IN OUT Irp,
; 417  : 			IN IoBuffer,
; 418  : 			IN InputBufferLength
; 419  : 		);

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

; 420  : 		break;

  000a4	e9 85 00 00 00	 jmp	 $L8505
$L8508:

; 402  : 
; 403  : 	case IOCTL_PCIDP00_MAP_BASE_REGS:
; 404  : 		PCIDPMapBaseRegs(
; 405  : 			IN DeviceObject,
; 406  : 			IN OUT Irp,
; 407  : 			IN OUT IoBuffer,
; 408  : 			IN InputBufferLength,
; 409  : 			IN OutputBufferLength
; 410  : 		);

  000a9	ff 75 0c	 push	 DWORD PTR _OutputBufferLength$[ebp]
  000ac	53		 push	 ebx
  000ad	51		 push	 ecx
  000ae	56		 push	 esi
  000af	ff 75 08	 push	 DWORD PTR _DeviceObject$[ebp]
  000b2	e8 00 00 00 00	 call	 _PCIDPMapBaseRegs@20

; 411  : 		break;

  000b7	eb 75		 jmp	 SHORT $L8505
$L8514:

; 458  : 
; 459  : 	case IOCTL_PCIDP00_SET_PCI_CONFIG_REGS:
; 460  : 		PCIDPSetPCIRegs(
; 461  : 			IN DeviceObject,
; 462  : 			IN IrpStack->FileObject,
; 463  : 			IN OUT Irp,
; 464  : 			IN IoBuffer,
; 465  : 			IN InputBufferLength
; 466  : 		);

  000b9	53		 push	 ebx
  000ba	51		 push	 ecx
  000bb	56		 push	 esi
  000bc	ff 70 18	 push	 DWORD PTR [eax+24]
  000bf	ff 75 08	 push	 DWORD PTR _DeviceObject$[ebp]
  000c2	e8 00 00 00 00	 call	 _PCIDPSetPCIRegs@20

; 467  : 		break;

  000c7	eb 65		 jmp	 SHORT $L8505
$L8721:

; 388  : 	Irp->IoStatus.Information = 0;
; 389  : 
; 390  : 	// Get a pointer to the current location in the Irp. This is where
; 391  : 	// the function codes and parameters are located.
; 392  : 	IrpStack = IoGetCurrentIrpStackLocation(IN Irp);
; 393  : 
; 394  : 	// Get the pointer to the input/output buffer and it's length(s).
; 395  : 	IoBuffer           = Irp->AssociatedIrp.SystemBuffer;
; 396  : 	InputBufferLength  = IrpStack->Parameters.DeviceIoControl.InputBufferLength;
; 397  : 	OutputBufferLength = IrpStack->Parameters.DeviceIoControl.OutputBufferLength;
; 398  : 
; 399  : 
; 400  : 	// Determine which I/O control code was specified.
; 401  : 	switch (IrpStack->Parameters.DeviceIoControl.IoControlCode){

  000c9	81 fa 98 20 00
	c3		 cmp	 edx, -1023401832	; c3002098H
  000cf	74 4f		 je	 SHORT $L8515
  000d1	81 fa 9c 20 00
	c3		 cmp	 edx, -1023401828	; c300209cH
  000d7	74 3a		 je	 SHORT $L8516
  000d9	81 fa a0 20 00
	c3		 cmp	 edx, -1023401824	; c30020a0H
  000df	74 4d		 je	 SHORT $L8505
  000e1	81 fa a4 20 00
	c3		 cmp	 edx, -1023401820	; c30020a4H
  000e7	74 1e		 je	 SHORT $L8518
  000e9	81 fa a8 20 00
	c3		 cmp	 edx, -1023401816	; c30020a8H
  000ef	74 09		 je	 SHORT $L8511
$L8519:

; 498  : 
; 499  : 	default:
; 500  : 		Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;

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

; 501  : 		break;

  000f8	eb 34		 jmp	 SHORT $L8505
$L8511:

; 430  : 
; 431  : 	case IOCTL_PCIDP00_CANCEL_MAP_DMA:
; 432  : 		PCIDPCancelMapDMA(
; 433  : 			IN DeviceObject,
; 434  : 			IN OUT Irp,
; 435  : 			IN IoBuffer,
; 436  : 			IN InputBufferLength
; 437  : 		);

  000fa	53		 push	 ebx
  000fb	51		 push	 ecx
  000fc	56		 push	 esi
  000fd	ff 75 08	 push	 DWORD PTR _DeviceObject$[ebp]
  00100	e8 00 00 00 00	 call	 _PCIDPCancelMapDMA@16

; 438  : 		break;

  00105	eb 27		 jmp	 SHORT $L8505
$L8518:

; 487  : 
; 488  : 	case IOCTL_PCIDP00_HELLO:
; 489  : 		break;
; 490  : 
; 491  : 	case IOCTL_PCIDP00_GET_VERSION:
; 492  : 		PCIDPGetDriverVersion(
; 493  : 			IN OUT Irp,
; 494  : 			OUT IoBuffer,
; 495  : 			IN OutputBufferLength
; 496  : 		);

  00107	ff 75 0c	 push	 DWORD PTR _OutputBufferLength$[ebp]
  0010a	51		 push	 ecx
  0010b	56		 push	 esi
  0010c	e8 00 00 00 00	 call	 _PCIDPGetDriverVersion@12

; 497  : 		break;

  00111	eb 1b		 jmp	 SHORT $L8505
$L8516:

; 477  : 		break;
; 478  : 
; 479  : 	case IOCTL_PCIDP00_UNREGISTER_INTERRUPT:
; 480  : 		PCIDPUnregisterInterrupt(
; 481  : 			IN DeviceObject,
; 482  : 			IN OUT Irp,
; 483  : 			IN IoBuffer,
; 484  : 			IN InputBufferLength
; 485  : 		);

  00113	53		 push	 ebx
  00114	51		 push	 ecx
  00115	56		 push	 esi
  00116	ff 75 08	 push	 DWORD PTR _DeviceObject$[ebp]
  00119	e8 00 00 00 00	 call	 _PCIDPUnregisterInterrupt@16

; 486  : 		break;

  0011e	eb 0e		 jmp	 SHORT $L8505
$L8515:

; 468  : 
; 469  : 	case IOCTL_PCIDP00_REGISTER_INTERRUPT:
; 470  : 		PCIDPRegisterInterrupt(
; 471  : 			IN DeviceObject,
; 472  : 			IN OUT Irp,
; 473  : 			IN IoBuffer,
; 474  : 			IN InputBufferLength,
; 475  : 			IN OutputBufferLength
; 476  : 		);

  00120	ff 75 0c	 push	 DWORD PTR _OutputBufferLength$[ebp]
  00123	53		 push	 ebx
  00124	51		 push	 ecx
  00125	56		 push	 esi
  00126	ff 75 08	 push	 DWORD PTR _DeviceObject$[ebp]
  00129	e8 00 00 00 00	 call	 _PCIDPRegisterInterrupt@20
$L8505:

; 502  : 	}
; 503  : 
; 504  : 	// Finish the I/O operation by simply completing the packet and returning
; 505  : 	// the same status as in the packet itself.  However, don't complete the I/O
; 506  : 	// if the status is pending (register interrupt only).
; 507  : 	NTStatus = Irp->IoStatus.Status;

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

; 508  : 	if(NTStatus != STATUS_PENDING)

  00131	81 ff 03 01 00
	00		 cmp	 edi, 259		; 00000103H
  00137	74 0c		 je	 SHORT $L8524

; 509  : 		IoCompleteRequest(Irp, IO_NO_INCREMENT);

  00139	32 d2		 xor	 dl, dl
  0013b	8b ce		 mov	 ecx, esi
  0013d	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8

; 510  : 
; 511  : 	// Debug exit point
; 512  : 	if(NTStatus != STATUS_PENDING)
; 513  : 		//DbgPrint("[PCIDP]->Leaving DeviceControl, status=0x%x...\n", NTStatus);	//debug
; 514  : 		//DbgBreakPoint();	//debug
; 515  : 
; 516  : 	return NTStatus;

  00143	8b c7		 mov	 eax, edi
$L8524:
  00145	5f		 pop	 edi
  00146	5e		 pop	 esi
  00147	5b		 pop	 ebx

; 517  : }

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

; 530  : 
; 531  : 	// Debug entry point
; 532  : 	//DbgPrint("[PCIDP]->Entering CreateClose...\n");	//debug
; 533  : 	//DbgBreakPoint();	//debug
; 534  : 
; 535  : 	Irp->IoStatus.Status = STATUS_SUCCESS;

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

; 536  : 	Irp->IoStatus.Information = 0;
; 537  : 
; 538  : 	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

; 539  : 
; 540  : 	return STATUS_SUCCESS;

  00014	33 c0		 xor	 eax, eax

; 541  : }

  00016	c2 08 00	 ret	 8
_PCIDPCreateClose@8 ENDP
_TEXT	ENDS
EXTRN	_GetNextEntry@16:NEAR
EXTRN	_PutBackEntry@8:NEAR
EXTRN	_FreeEntry@8:NEAR
EXTRN	__imp__IoAcquireCancelSpinLock@4:NEAR
EXTRN	__imp__IoReleaseCancelSpinLock@4: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

; 553  : ){

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

; 554  : 
; 555  : 	// Define variables.
; 556  : 	PPCIDP_EXTENSION ObjExt;
; 557  : 	PREGISTERED_INTERRUPT Interrupt;
; 558  : 	PIO_STACK_LOCATION CleanUpStack ;
; 559  : 	PIO_STACK_LOCATION IrpStack ;
; 560  : 	KIRQL CancelSpin;
; 561  : 	PLINKED_LIST CurrentLink;
; 562  : 	PLINKED_LIST FirstLink;
; 563  : 
; 564  : 	// Debug entry point
; 565  : 	//DbgPrint("[PCIDP]->Entering Cleanup...\n");	//debug
; 566  : 	//DbgBreakPoint();	//debug
; 567  : 
; 568  : 	// Initialize variables.
; 569  : 	ObjExt = (PPCIDP_EXTENSION)DeviceObject->DeviceExtension;

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

; 570  : 
; 571  : 	// Search the driver's events linked list for an entry containing the 
; 572  : 	// user provided Irp.
; 573  : 	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]

; 574  : 	CurrentLink = NULL;

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

; 575  : 	FirstLink = NULL;
; 576  : 	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	 $L8549

; 577  : 		IrpStack = IoGetCurrentIrpStackLocation(Interrupt->Irp);
; 578  : 
; 579  : 		// Cancel the IRP, then delete its linked list entry.
; 580  : 		if (IrpStack->FileObject == CleanUpStack->FileObject) {

  00040	8b 35 00 00 00
	00		 mov	 esi, DWORD PTR __imp__IoReleaseCancelSpinLock@4
$L8548:
  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]

⌨️ 快捷键说明

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