tstCompiler.cpp revision e4a93d2f3ca0b165b618c27d37d984b05d24bed8
/* $Id$ */
/** @file
* Testing how the compiler deals with various things.
*
* This is testcase requires manual inspection and might not be very useful
* in non-optimized compiler modes.
*/
/*
* Copyright (C) 2006-2007 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.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <VBox/disopcode.h>
#include <iprt/initterm.h>
#if 1
/**
* PAE page table entry.
*/
#ifdef __GNUC__
__extension__ /* Makes it shut up about the 40 bit uint64_t field. */
#endif
typedef struct X86PTEPAEBITS64
{
/** Flags whether(=1) or not the page is present. */
/** Read(=0) / Write(=1) flag. */
/** User(=1) / Supervisor(=0) flag. */
/** Write Thru flag. If PAT enabled, bit 0 of the index. */
/** Cache disabled flag. If PAT enabled, bit 1 of the index. */
/** Accessed flag.
* Indicates that the page have been read or written to. */
/** Dirty flag.
* Indicates that the page have been written to. */
/** Reserved / If PAT enabled, bit 2 of the index. */
/** Global flag. (Ignored in all but final level.) */
/** Available for use to system software. */
/** Physical Page number of the next level. */
/** MBZ bits */
/** No Execute flag. */
/** Pointer to a page table entry. */
typedef X86PTEPAEBITS64 *PX86PTEPAEBITS64;
/**
* PAE Page table entry.
*/
typedef union X86PTEPAE64
{
/** Bit field view. */
/** Unsigned integer view */
X86PGPAEUINT u;
/** 32-bit view. */
/** 16-bit view. */
/** 8-bit view. */
} X86PTEPAE64;
/** Pointer to a PAE page table entry. */
typedef X86PTEPAE64 *PX86PTEPAE64;
/** @} */
#else /* use current (uint32_t based) PAE structures */
#define X86PTEPAE64 X86PTEPAE
#define PX86PTEPAE64 PX86PTEPAE
#endif
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
pPteDst->u = pPteSrc->u & ~(X86_PTE_PAE_PG_MASK_FULL | X86_PTE_AVL_MASK | X86_PTE_PAT | X86_PTE_PCD | X86_PTE_PWT);
}
{
pPteDst->u = (pPteDst->u & (fMask | X86_PTE_PAE_PG_MASK_FULL)) | (fFlags & ~X86_PTE_PAE_PG_MASK_FULL);
}
{
return paPT[10];
}
{
return paPT[10];
}
{
do
{
char sz[256];
{
}
else
{
uCur += 1;
}
}
int main()
{
if (RT_FAILURE(rc))
return RTMsgInitFailure(rc);
RTPrintf("tstBitFields: This testcase requires manual inspection of the output!\n"
"\n"
"tstBitFields: The compiler must be able to combine operations when\n"
"tstBitFields: optimizing, if not we're screwed.\n"
"\n");
RTPrintf("\n");
RTPrintf("\n");
RTPrintf("\n");
RTPrintf("\n");
RTPrintf("\n");
RTPrintf("\n");
RTPrintf("\n");
RTPrintf("\n");
RTPrintf("\n");
RTPrintf("\n");
return 0;
}