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

📄 pcidp.cod

📁 一个amccs5933芯片的驱动程序开发源程序和部分文档
💻 COD
📖 第 1 页 / 共 5 页
字号:
  000ee	53		 push	 ebx
  000ef	50		 push	 eax
  000f0	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__MmProbeAndLockPages@12

; 199  : 
; 200  : 			//DbgPrint("[PCIDP]->AddDevice, MDLFlags=0x%x...\n", ObjExt->MDL->MdlFlags);	//debug
; 201  :    
; 202  : 		}
; 203  : 	}
; 204  : 
; 205  : 	// Could not allocate memory for DMA but that is not
; 206  : 	// a show-stopper.
; 207  : 	else

  000f6	eb 03		 jmp	 SHORT $L8454
$L8451:

; 208  : 		ObjExt->PhysicalDMAAddress = 0;

  000f8	89 5e 7c	 mov	 DWORD PTR [esi+124], ebx
$L8454:

; 209  : 
; 210  : 	// To get here means we were successful.
; 211  : 	DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;

  000fb	8b 45 08	 mov	 eax, DWORD PTR _DeviceObject$[ebp]
  000fe	80 60 1c 7f	 and	 BYTE PTR [eax+28], 127	; 0000007fH
$Exit$8436:

; 216  : 
; 217  : 	Exit:
; 218  : 
; 219  : 		// Debug exit point
; 220  : 		//DbgPrint("[PCIDP]->Leaving AddDevice, status=0x%x...\n", NTStatus);	//debug
; 221  : 		//DbgBreakPoint();	//debug
; 222  : 
; 223  : 		return NTStatus;

  00102	8b 45 fc	 mov	 eax, DWORD PTR _NTStatus$[ebp]
  00105	5f		 pop	 edi
  00106	5e		 pop	 esi
  00107	5b		 pop	 ebx

; 224  : }

  00108	c9		 leave
  00109	c2 08 00	 ret	 8
_PCIDPAddDevice@8 ENDP
_TEXT	ENDS
EXTRN	__imp__PoCallDriver@8:NEAR
EXTRN	__imp__PoStartNextPowerIrp@4:NEAR
;	COMDAT _PCIDPDispatchPower@8
_TEXT	SEGMENT
_DeviceObject$ = 8
_Irp$ = 12
_PCIDPDispatchPower@8 PROC NEAR				; COMDAT

; 236  : 	PPCIDP_EXTENSION ObjExt;
; 237  : 	NTSTATUS NTStatus;
; 238  : 
; 239  : 	// Debug entry point
; 240  : 	//DbgPrint("[PCIDP]->Entering DispatchPower...\n");	//debug
; 241  : 	//DbgBreakPoint();	//debug
; 242  : 
; 243  : 	ObjExt = (PPCIDP_EXTENSION)DeviceObject->DeviceExtension;

  00000	8b 44 24 04	 mov	 eax, DWORD PTR _DeviceObject$[esp-4]
  00004	56		 push	 esi

; 244  : 
; 245  : 	PoStartNextPowerIrp(Irp);

  00005	8b 74 24 0c	 mov	 esi, DWORD PTR _Irp$[esp]
  00009	57		 push	 edi
  0000a	8b 78 28	 mov	 edi, DWORD PTR [eax+40]
  0000d	56		 push	 esi
  0000e	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__PoStartNextPowerIrp@4

; 246  : 	IoSkipCurrentIrpStackLocation(Irp);

  00014	fe 46 23	 inc	 BYTE PTR [esi+35]
  00017	83 46 60 24	 add	 DWORD PTR [esi+96], 36	; 00000024H

; 247  : 	NTStatus = PoCallDriver(ObjExt->NextLowerDeviceObject, Irp);

  0001b	56		 push	 esi
  0001c	ff b7 8c 00 00
	00		 push	 DWORD PTR [edi+140]
  00022	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__PoCallDriver@8
  00028	5f		 pop	 edi

; 248  : 
; 249  : 	// Debug exit point
; 250  : 	//DbgPrint("[PCIDP]->Leaving DispatchPower, status=0x%x...\n", NTStatus);	//debug
; 251  : 	//DbgBreakPoint();	//debug
; 252  : 
; 253  : 	return STATUS_SUCCESS;

  00029	33 c0		 xor	 eax, eax
  0002b	5e		 pop	 esi

; 254  : }

  0002c	c2 08 00	 ret	 8
_PCIDPDispatchPower@8 ENDP
_TEXT	ENDS
EXTRN	_StartDevice@8:NEAR
EXTRN	_StopDevice@4:NEAR
EXTRN	_CancelStopDevice@8:NEAR
EXTRN	_RemoveDevice@4:NEAR
EXTRN	__imp_@IofCallDriver@8:NEAR
EXTRN	__imp_@IofCompleteRequest@8:NEAR
;	COMDAT _PCIDPDispatchPnp@8
_TEXT	SEGMENT
_DeviceObject$ = 8
_Irp$ = 12
_PCIDPDispatchPnp@8 PROC NEAR				; COMDAT

; 265  : ){

  00000	53		 push	 ebx
  00001	56		 push	 esi

; 266  : 
; 267  : 	PIO_STACK_LOCATION IrpStack;
; 268  : 	NTSTATUS NTStatus;
; 269  : 	PPCIDP_EXTENSION ObjExt;
; 270  : 
; 271  : 	ObjExt = (PPCIDP_EXTENSION)DeviceObject->DeviceExtension;
; 272  : 
; 273  : 	// Get a pointer to the current location in the Irp. This is where
; 274  : 	// the function codes and parameters are located.
; 275  : 	IrpStack = IoGetCurrentIrpStackLocation(IN Irp);

  00002	8b 74 24 10	 mov	 esi, DWORD PTR _Irp$[esp+4]
  00006	8b 54 24 0c	 mov	 edx, DWORD PTR _DeviceObject$[esp+4]
  0000a	57		 push	 edi
  0000b	8b 4e 60	 mov	 ecx, DWORD PTR [esi+96]
  0000e	8b 7a 28	 mov	 edi, DWORD PTR [edx+40]

; 348  : 		break;
; 349  : 
; 350  : 	default:
; 351  : 		NTStatus = STATUS_UNSUCCESSFUL;
; 352  : 		Irp->IoStatus.Status = NTStatus;
; 353  : 	  IoSkipCurrentIrpStackLocation(Irp);	//send it on down the stack
; 354  : 		IoCallDriver(ObjExt->NextLowerDeviceObject, Irp);
; 355  : 		break;
; 356  : 	}
; 357  : 
; 358  : 	// Debug exit point
; 359  : 	//DbgPrint("[PCIDP]->Leaving DispatchPnp, status=0x%x...\n", NTStatus);	//debug
; 360  : 	//DbgBreakPoint();	//debug
; 361  : 
; 362  : 	return NTStatus;

  00011	0f b6 41 01	 movzx	 eax, BYTE PTR [ecx+1]
  00015	83 f8 06	 cmp	 eax, 6
  00018	7f 56		 jg	 SHORT $L8712

; 276  : 
; 277  : 	// Debug entry point
; 278  : 	//DbgPrint("[PCIDP]->Entering DispatchPnp, function=0x%x...\n",IrpStack->MinorFunction);	//debug
; 279  : 	//DbgBreakPoint();	//debug
; 280  : 
; 281  : 	// Determine the PnP I/O request packet.
; 282  : 	switch (IrpStack->MinorFunction){

  0001a	74 3c		 je	 SHORT $L8481
  0001c	33 db		 xor	 ebx, ebx
  0001e	2b c3		 sub	 eax, ebx
  00020	74 2d		 je	 SHORT $L8477
  00022	48		 dec	 eax
  00023	74 60		 je	 SHORT $L8482
  00025	48		 dec	 eax
  00026	74 13		 je	 SHORT $L8484
  00028	48		 dec	 eax
  00029	48		 dec	 eax
  0002a	74 05		 je	 SHORT $L8480
  0002c	48		 dec	 eax
  0002d	75 56		 jne	 SHORT $L8482

; 290  : 
; 291  : 	case IRP_MN_QUERY_STOP_DEVICE:
; 292  : 		//NTStatus = STATUS_UNSUCCESSFUL;
; 293  : 		//Irp->IoStatus.Status = NTStatus;
; 294  : 		//IoCompleteRequest(Irp, IO_NO_INCREMENT);
; 295  : 		NTStatus = STATUS_SUCCESS;
; 296  : 		Irp->IoStatus.Status = NTStatus;
; 297  : 	  IoSkipCurrentIrpStackLocation(Irp);	//send it on down the stack
; 298  : 		IoCallDriver(ObjExt->NextLowerDeviceObject, Irp);
; 299  : 		break;

  0002f	eb 7f		 jmp	 SHORT $L8715
$L8480:

; 300  : 
; 301  : 	case IRP_MN_STOP_DEVICE:
; 302  : 		NTStatus = StopDevice(DeviceObject);

  00031	52		 push	 edx
  00032	e8 00 00 00 00	 call	 _StopDevice@4
  00037	8b d8		 mov	 ebx, eax

; 303  : 	  IoSkipCurrentIrpStackLocation(Irp);	//send it on down the stack
; 304  : 		IoCallDriver(ObjExt->NextLowerDeviceObject, Irp);
; 305  : 		break;

  00039	eb 0b		 jmp	 SHORT $L8716
$L8484:

; 312  : 
; 313  : 	case IRP_MN_QUERY_REMOVE_DEVICE:
; 314  : 		NTStatus = STATUS_UNSUCCESSFUL;
; 315  : 		Irp->IoStatus.Status = NTStatus;
; 316  : 	  IoSkipCurrentIrpStackLocation(Irp);	//send it on down the stack
; 317  : 		IoCallDriver(ObjExt->NextLowerDeviceObject, Irp);
; 318  : 		break;
; 319  : 
; 320  : 	case IRP_MN_REMOVE_DEVICE:
; 321  : 		NTStatus = RemoveDevice(DeviceObject);

  0003b	52		 push	 edx
  0003c	e8 00 00 00 00	 call	 _RemoveDevice@4
  00041	8b d8		 mov	 ebx, eax

; 322  : 		Irp->IoStatus.Status = NTStatus;

  00043	89 5e 18	 mov	 DWORD PTR [esi+24], ebx
$L8716:

; 323  : 	  IoSkipCurrentIrpStackLocation(Irp);	//send it on down the stack

  00046	fe 46 23	 inc	 BYTE PTR [esi+35]
  00049	83 46 60 24	 add	 DWORD PTR [esi+96], 36	; 00000024H

; 324  : 		IoCallDriver(ObjExt->NextLowerDeviceObject, Irp);
; 325  : 		break;

  0004d	eb 49		 jmp	 SHORT $L8714
$L8477:

; 283  : 
; 284  : 	case IRP_MN_START_DEVICE:
; 285  : 		NTStatus = StartDevice(DeviceObject, Irp);

  0004f	56		 push	 esi
  00050	52		 push	 edx
  00051	e8 00 00 00 00	 call	 _StartDevice@8

; 286  : 		Irp->IoStatus.Status = NTStatus;
; 287  : 		//PoSetPowerState(DeviceObject, DevicePowerState, PowerDeviceD0);
; 288  : 		IoCompleteRequest(Irp, IO_NO_INCREMENT);	//back up the stack so complete it.
; 289  : 		break;

  00056	eb 07		 jmp	 SHORT $L8717
$L8481:

; 306  : 
; 307  : 	case IRP_MN_CANCEL_STOP_DEVICE:
; 308  : 		NTStatus = CancelStopDevice(DeviceObject, Irp);

  00058	56		 push	 esi
  00059	52		 push	 edx
  0005a	e8 00 00 00 00	 call	 _CancelStopDevice@8
$L8717:
  0005f	8b d8		 mov	 ebx, eax

; 309  : 		Irp->IoStatus.Status = NTStatus;
; 310  : 		IoCompleteRequest(Irp, IO_NO_INCREMENT);	//back up the stack so complete it.

  00061	32 d2		 xor	 dl, dl
  00063	8b ce		 mov	 ecx, esi
  00065	89 5e 18	 mov	 DWORD PTR [esi+24], ebx
  00068	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCompleteRequest@8

; 311  : 		break;

  0006e	eb 36		 jmp	 SHORT $L8474
$L8712:

; 276  : 
; 277  : 	// Debug entry point
; 278  : 	//DbgPrint("[PCIDP]->Entering DispatchPnp, function=0x%x...\n",IrpStack->MinorFunction);	//debug
; 279  : 	//DbgBreakPoint();	//debug
; 280  : 
; 281  : 	// Determine the PnP I/O request packet.
; 282  : 	switch (IrpStack->MinorFunction){

  00070	83 e8 08	 sub	 eax, 8
  00073	74 10		 je	 SHORT $L8482
  00075	83 e8 0e	 sub	 eax, 14			; 0000000eH
  00078	74 0b		 je	 SHORT $L8482
  0007a	48		 dec	 eax
  0007b	74 31		 je	 SHORT $L8485
  0007d	48		 dec	 eax
  0007e	74 05		 je	 SHORT $L8482
  00080	2d e7 00 00 00	 sub	 eax, 231		; 000000e7H
$L8482:

; 333  : 
; 334  : 	case IRP_MN_DEVICE_USAGE_NOTIFICATION:
; 335  : 		NTStatus = STATUS_UNSUCCESSFUL;
; 336  : 		Irp->IoStatus.Status = NTStatus;
; 337  : 	  IoSkipCurrentIrpStackLocation(Irp);	//send it on down the stack
; 338  : 		IoCallDriver(ObjExt->NextLowerDeviceObject, Irp);
; 339  : 		break;
; 340  : 
; 341  : 	case 8:
; 342  : 	case 0xFF:
; 343  : 	case IRP_MN_QUERY_LEGACY_BUS_INFORMATION:
; 344  : 		NTStatus = STATUS_UNSUCCESSFUL;

  00085	b8 01 00 00 c0	 mov	 eax, -1073741823	; c0000001H
  0008a	8b d8		 mov	 ebx, eax

; 345  : 		Irp->IoStatus.Status = NTStatus;

  0008c	89 46 18	 mov	 DWORD PTR [esi+24], eax
$L8713:

; 346  : 	  IoSkipCurrentIrpStackLocation(Irp);	//send it on down the stack

  0008f	fe 46 23	 inc	 BYTE PTR [esi+35]
  00092	83 c1 24	 add	 ecx, 36			; 00000024H
  00095	89 4e 60	 mov	 DWORD PTR [esi+96], ecx
$L8714:

; 347  : 		IoCallDriver(ObjExt->NextLowerDeviceObject, Irp);

  00098	8b 8f 8c 00 00
	00		 mov	 ecx, DWORD PTR [edi+140]
  0009e	8b d6		 mov	 edx, esi
  000a0	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@IofCallDriver@8
$L8474:
  000a6	5f		 pop	 edi

; 348  : 		break;
; 349  : 
; 350  : 	default:
; 351  : 		NTStatus = STATUS_UNSUCCESSFUL;
; 352  : 		Irp->IoStatus.Status = NTStatus;
; 353  : 	  IoSkipCurrentIrpStackLocation(Irp);	//send it on down the stack
; 354  : 		IoCallDriver(ObjExt->NextLowerDeviceObject, Irp);
; 355  : 		break;
; 356  : 	}
; 357  : 
; 358  : 	// Debug exit point
; 359  : 	//DbgPrint("[PCIDP]->Leaving DispatchPnp, status=0x%x...\n", NTStatus);	//debug
; 360  : 	//DbgBreakPoint();	//debug
; 361  : 
; 362  : 	return NTStatus;

  000a7	8b c3		 mov	 eax, ebx
  000a9	5e		 pop	 esi
  000aa	5b		 pop	 ebx

; 363  : }

  000ab	c2 08 00	 ret	 8
$L8485:

; 326  : 
; 327  : 	case IRP_MN_SURPRISE_REMOVAL:
; 328  : 		NTStatus = STATUS_SUCCESS;

  000ae	33 db		 xor	 ebx, ebx
$L8715:

; 329  : 		Irp->IoStatus.Status = NTStatus;

  000b0	89 5e 18	 mov	 DWORD PTR [esi+24], ebx

; 330  : 	  IoSkipCurrentIrpStackLocation(Irp);	//send it on down the stack
; 331  : 		IoCallDriver(ObjExt->NextLowerDeviceObject, Irp);
; 332  : 		break;

  000b3	eb da		 jmp	 SHORT $L8713
_PCIDPDispatchPnp@8 ENDP
_TEXT	ENDS
EXTRN	_PCIDPGetDriverVersion@12:NEAR
EXTRN	_PCIDPMapBaseRegs@20:NEAR
EXTRN	_PCIDPUnMap@16:NEAR
EXTRN	_PCIDPMapDMAMem@16:NEAR
EXTRN	_PCIDPCancelMapDMA@16:NEAR
EXTRN	_PCIDPUnMapDMA@16:NEAR
EXTRN	_PCIDPGetPCIRegs@20:NEAR
EXTRN	_PCIDPSetPCIRegs@20:NEAR
EXTRN	_PCIDPRegisterInterrupt@20:NEAR
EXTRN	_PCIDPUnregisterInterrupt@16:NEAR
;	COMDAT _PCIDPDeviceControl@8
_TEXT	SEGMENT
_DeviceObject$ = 8
_Irp$ = 12
_OutputBufferLength$ = 12
_PCIDPDeviceControl@8 PROC NEAR				; COMDAT

; 374  : ){

  00000	55		 push	 ebp
  00001	8b ec		 mov	 ebp, esp
  00003	53		 push	 ebx
  00004	56		 push	 esi

; 375  : 
; 376  : 	PIO_STACK_LOCATION IrpStack;
; 377  : 	PVOID IoBuffer;
; 378  : 	ULONG InputBufferLength;
; 379  : 	ULONG OutputBufferLength;
; 380  : 	NTSTATUS NTStatus;
; 381  : 
; 382  : 	// Debug entry point
; 383  : 	//DbgPrint("[PCIDP]->Entering DeviceControl...\n");	//debug
; 384  : 	//DbgBreakPoint();	//debug
; 385  : 
; 386  : 	// Initialize the return values with some defaults.
; 387  : 	Irp->IoStatus.Status = STATUS_SUCCESS;

  00005	8b 75 0c	 mov	 esi, DWORD PTR _Irp$[ebp]
  00008	57		 push	 edi

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

  00009	bf 94 20 00 c3	 mov	 edi, -1023401836	; c3002094H

⌨️ 快捷键说明

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