for (DWORD dwIndex=0; dwIndex
{
// Get the virtual address based on the input Physical Address
PBYTE pVirt = (PBYTE)MmMapIoSpace((pDmaBufferBlock+dwIndex)->physicalAddress,(pDmaBufferBlock+dwIndex)->dwLength,FALSE);
if (pVirt)
{
if (readFromDeviceOp)
{
// If it is read from device, assume all value from device is zero.
memset(pVirt, 0, (pDmaBufferBlock+dwIndex)->dwLength);
}
else
{
// compare this virtual address to the client address
PBYTE pCmp = (dwCurIndex
// if it is write to device - do memory compare
if (memcmp(pVirt, pCmp, (pDmaBufferBlock+dwIndex)->dwLength)!=0 )
{
NKDbgPrintfW(_T("DMAOpenBufferAndIssueBlockTransfer - Memory compare failed with virtual addr %x, client addr %x, length %d"),
pVirt, pCmp, (pDmaBufferBlock+dwIndex)->dwLength);
resultData.dwTestResult = FALSE;
}
}
// If read from device, ensure the whole buffer fills with zeros.
if (readFromDeviceOp && !DMAFlushBlockBuffer(hBuffer) && memcmp(buffer1,buffer2,pDMABufferSize) != 0)
resultData.dwTestResult = FALSE;