VBoxMPCommon.cpp revision aeca85ede34cef955099c717030fb0e7b1d1c65f
/* $Id$ */
/** @file
* VBox Miniport common utils
*/
/*
* Copyright (C) 2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "VBoxMPCommon.h"
int VBoxMPCmnMapAdapterMemory(PVBOXMP_COMMON pCommon, void **ppv, uint32_t ulOffset, uint32_t ulSize)
{
if (!ulSize)
{
WARN(("Illegal length 0!"));
return ERROR_INVALID_PARAMETER;
}
#ifndef VBOX_WITH_WDDM
#else
NTSTATUS ntStatus = pPEXT->u.primary.DxgkInterface.DxgkCbMapMemory(pPEXT->u.primary.DxgkInterface.DeviceHandle,
FALSE, /* IN BOOLEAN InIoSpace */
FALSE, /* IN BOOLEAN MapToUserMode */
MmNonCached, /* IN MEMORY_CACHING_TYPE CacheType */
&VideoRamBase /*OUT PVOID *VirtualAddress*/
);
/* this is what VideoPortMapMemory returns according to the docs */
#endif
{
*ppv = VideoRamBase;
}
}
{
LOGF_ENTER();
if (*ppv)
{
#ifndef VBOX_WITH_WDDM
#else
ntStatus = pPEXT->u.primary.DxgkInterface.DxgkCbUnmapMemory(pPEXT->u.primary.DxgkInterface.DeviceHandle, *ppv);
#endif
}
LOGF_LEAVE();
}
{
#ifndef VBOX_WITH_WDDM
#else
DXGKCB_SYNCHRONIZE_EXECUTION pfnDxgkCbSync = pPEXT->u.primary.DxgkInterface.DxgkCbSynchronizeExecution;
return !!fRet;
#endif
}