tstLow.cpp revision c58f1213e628a545081c70e26c6b67a841cff880
/* $Id$ */
/** @file
* SUP Testcase - Low (<4GB) Memory Allocate interface (ring 3).
*/
/*
* Copyright (C) 2006-2012 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.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <iprt/initterm.h>
{
int rc;
int rcRet = 0;
RTPrintf("tstLow: TESTING...\n");
if (RT_SUCCESS(rc))
{
/*
* Allocate a bit of contiguous memory.
*/
void *pvPages0 = (void *)0x77777777;
if (RT_SUCCESS(rc))
{
/* check that the pages are below 4GB and valid. */
{
{
rcRet++;
RTPrintf("tstLow: error: aPages0[%d].uReserved=%#x expected 0!\n", iPage, aPages0[iPage].uReserved);
}
{
rcRet++;
}
}
if (!rcRet)
{
for (uint8_t *pu8 = (uint8_t *)pvPages0 + iPage * PAGE_SIZE, *pu8End = pu8 + PAGE_SIZE; pu8 < pu8End; pu8++)
{
RTPrintf("tstLow: error: invalid page content %02x != %02x. iPage=%u off=%#x\n",
rcRet++;
}
}
}
else
{
rcRet++;
}
/*
* Allocate odd amounts in from 1 to 127.
*/
{
void *pvPages1 = (void *)0x77777777;
if (RT_SUCCESS(rc))
{
/* check that the pages are below 4GB and valid. */
{
RTPrintf("%-4d::%-4d: Phys=%RHp Reserved=%p\n", cPages, iPage, aPages1[iPage].Phys, aPages1[iPage].uReserved);
{
rcRet++;
RTPrintf("tstLow: error: aPages1[%d].uReserved=%#x expected 0!\n", iPage, aPages1[iPage].uReserved);
}
{
rcRet++;
}
}
if (!rcRet)
{
for (uint8_t *pu8 = (uint8_t *)pvPages1 + iPage * PAGE_SIZE, *pu8End = pu8 + PAGE_SIZE; pu8 < pu8End; pu8++)
{
RTPrintf("tstLow: error: invalid page content %02x != %02x. iPage=%p off=%#x\n",
rcRet++;
}
}
}
else
{
rcRet++;
}
}
}
else
{
rcRet++;
}
return rcRet;
}