tstPin.cpp revision 21db613fc981f8fb8ee82e35d7681fb534300174
/** @file
*
* VBox host drivers - Ring-0 support drivers - Testcases:
* Test the memory locking interface
*/
/*
* Copyright (C) 2006 InnoTek Systemberatung GmbH
*
* 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 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.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <stdlib.h>
#include <string.h>
{
int rc;
int rcRet = 0;
void *pv;
RTR3Init(true, ~0);
if (!rc)
{
static struct
{
void *pv;
void *pvAligned;
} aPinnings[500];
{
if (!rc)
{
unsigned c4GPluss = 0;
for (unsigned j = 0; j < (0xf000 >> PAGE_SHIFT); j++)
{
RTPrintf("%2d: vrt=%p phys=%VHp\n", j, (char *)aPinnings[i].pvAligned + (j << PAGE_SHIFT), aPinnings[i].aPages[j].Phys);
c4GPluss++;
}
}
else
{
rcRet++;
break;
}
}
{
{
if (rc)
{
rcRet++;
}
}
}
{
{
}
}
/*
* Allocate a bit of contiguous memory.
*/
{
{
if (rc)
}
else
RTPrintf("SUPContAlloc (2nd) failed!\n");
/* pv0 is intentionally not freed! */
}
else
RTPrintf("SUPContAlloc failed!\n");
/*
* Allocate a big chunk of virtual memory and then lock it.
*/
if (pv)
{
if (!rc)
{
/* dump */
#if 0
for (unsigned j = 0; j < (BIG_SIZE >> PAGE_SHIFT); j++)
RTPrintf("%2d: vrt=%p phys=%08x\n", j, (char *)pvAligned + (j << PAGE_SHIFT), (uintptr_t)aPages[j].pvPhys);
#endif
/* unlock */
if (rc)
{
rcRet++;
}
}
else
{
rcRet++;
}
}
}
return rcRet;
}