memobj-r0drv-nt.cpp revision d534750e38f9bab40fd4ab06d176fea25ec91c44
279N/A * available from http://www.virtualbox.org. This file is free software;
279N/A#include "the-nt-kernel.h"
279N/A#ifdef RT_ARCH_X86
279N/A#ifdef RT_ARCH_AMD64
447N/Atypedef struct RTR0MEMOBJNT
279N/A#ifndef IPRT_TARGET_NT4
447N/A bool fAllocatedPagesForMdl;
case RTR0MEMOBJTYPE_LOW:
#ifndef IPRT_TARGET_NT4
AssertFailed();
case RTR0MEMOBJTYPE_PAGE:
case RTR0MEMOBJTYPE_CONT:
case RTR0MEMOBJTYPE_PHYS:
case RTR0MEMOBJTYPE_PHYS_NC:
#ifndef IPRT_TARGET_NT4
AssertFailed();
case RTR0MEMOBJTYPE_LOCK:
case RTR0MEMOBJTYPE_RES_VIRT:
return VERR_INTERNAL_ERROR;
case RTR0MEMOBJTYPE_MAPPING:
return VERR_INTERNAL_ERROR;
return VINF_SUCCESS;
if (pv)
if (pMdl)
#ifdef RT_ARCH_AMD64
if (pMemNt)
return VINF_SUCCESS;
return rc;
while (iPage-- > 0)
return rc;
#ifndef IPRT_TARGET_NT4
if (pMdl)
if (pv)
if (pMemNt)
return VINF_SUCCESS;
static int rtR0MemObjNativeAllocContEx(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, RTHCPHYS PhysHighest)
if (!pv)
return VERR_NO_MEMORY;
if (pMdl)
#ifdef RT_ARCH_AMD64
if (pMemNt)
return VINF_SUCCESS;
return VERR_NO_MEMORY;
#ifndef IPRT_TARGET_NT4
if (pMdl)
PRTR0MEMOBJNT pMemNt = (PRTR0MEMOBJNT)rtR0MemObjNew(sizeof(*pMemNt), RTR0MEMOBJTYPE_PHYS, NULL, cb);
if (pMemNt)
return VINF_SUCCESS;
#ifndef IPRT_TARGET_NT4
if (pMdl)
PRTR0MEMOBJNT pMemNt = (PRTR0MEMOBJNT)rtR0MemObjNew(sizeof(*pMemNt), RTR0MEMOBJTYPE_PHYS_NC, NULL, cb);
if (pMemNt)
return VINF_SUCCESS;
return VERR_NO_MEMORY;
return VERR_NOT_SUPPORTED;
return VERR_ADDRESS_TOO_BIG;
PRTR0MEMOBJNT pMemNt = (PRTR0MEMOBJNT)rtR0MemObjNew(sizeof(*pMemNt), RTR0MEMOBJTYPE_PHYS, NULL, cb);
if (pMemNt)
return VINF_SUCCESS;
return VERR_NO_MEMORY;
cMdls++;
return VERR_OUT_OF_RANGE;
if (!pMemNt)
return VERR_NO_MEMORY;
if (!pMdl)
return rc;
while (iMdl-- > 0)
return VERR_LOCK_FAILED;
int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, RTR0PROCESS R0Process)
AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED);
int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)
return VERR_NOT_IMPLEMENTED;
int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process)
return VERR_NOT_IMPLEMENTED;
static int rtR0MemObjNtMap(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment,
return VERR_NOT_SUPPORTED;
if (pvFixed == 0)
return VERR_NOT_SUPPORTED;
return VERR_NOT_SUPPORTED;
if (pv)
if (pMemNt)
return VINF_SUCCESS;
return VERR_NOT_SUPPORTED;
void *pv = MmMapIoSpace(Phys, pMemNtToMap->Core.cb, MmCached); /** @todo add cache type to fProt. */
if (pv)
if (pMemNt)
return VINF_SUCCESS;
return rc;
int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, unsigned fProt)
int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process)
case RTR0MEMOBJTYPE_MAPPING:
case RTR0MEMOBJTYPE_PHYS:
case RTR0MEMOBJTYPE_PAGE:
case RTR0MEMOBJTYPE_PHYS_NC:
case RTR0MEMOBJTYPE_LOW:
case RTR0MEMOBJTYPE_CONT:
case RTR0MEMOBJTYPE_LOCK:
case RTR0MEMOBJTYPE_RES_VIRT:
return NIL_RTHCPHYS;