Hello,
The following code runs in the routine: PLxEvtDeviceAdd in the the file
Pci9656.c right after calling to: WdfDeviceCreate
The goal of this code is to allocate 4096 bytes (one page) of continuous
physical memory.
As explained to me in a previous question there is chance that the kernel
will not find even one continuous page.
Buy why (on earth) the line: p=deviceContext->AllocateCommonBuffer
is causing a crash and reset to the PC ?
it should only set the variable ‘p’ to 0x0.
After the crash windows boots with the device disabled.
I analyzed the dmp file created. It shows that this line caused the crash.
Can you tell what is wrong with my code ?
I also printed the values of ‘DmaAdapterObject’ and
‘deviceContext->AllocateCommonBuffer’.
Those variables are not NULL.
RtlZeroMemory(&deviceDescription, sizeof(DEVICE_DESCRIPTION));
#if defined(DMA_VER2)
deviceDescription.Version = DEVICE_DESCRIPTION_VERSION2;
#else
deviceDescription.Version = DEVICE_DESCRIPTION_VERSION;
#endif
deviceDescription.Master = TRUE;
deviceDescription.ScatterGather = FALSE;
deviceDescription.Dma32BitAddresses = FALSE;
deviceDescription.Dma64BitAddresses = TRUE;
deviceDescription.InterfaceType = PCIBus;
deviceDescription.MaximumLength = 4*4096;
DmaAdapterObject = IoGetDmaAdapter(DeviceObject,
&deviceDescription,
&NumberOfMapRegisters);
deviceContext->AllocateCommonBuffer =
*DmaAdapterObject->DmaOperations->AllocateCommonBuffer;
p=deviceContext->AllocateCommonBuffer
(DmaAdapterObject,4096,&LogicalAddress,FALSE);
Thanks,
Zvika.