tstInstrEmul.cpp revision 52f16f53a955f5b24bc2132c418a5fffb700f089
/* $Id$ */
/** @file
* Micro Testcase, checking emulation of certain instructions
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <stdio.h>
#include <iprt/initterm.h>
#include <iprt/semaphore.h>
{
int rcRet = 0; /* error count. */
RTR3Init();
RTPrintf("tstInstrEmul: TESTING...\n");
eax = 0xffffffff;
edx = 0xffff;
ebx = 0x1;
ecx = 0x2;
if ( !(eflags & X86_EFL_ZF)
{
return 1;
}
if ( (eflags & X86_EFL_ZF)
|| eax != 0x23456789
|| edx != 0x1)
{
return 1;
}
RTPrintf("tstInstrEmul: Testing lock cmpxchg instruction emulation - SUCCESS\n");
eax = 0xffffffff;
edx = 0xffff;
ebx = 0x1;
ecx = 0x2;
if ( !(eflags & X86_EFL_ZF)
{
return 1;
}
if ( (eflags & X86_EFL_ZF)
|| eax != 0x23456789
|| edx != 0x1)
{
return 1;
}
RTPrintf("tstInstrEmul: Testing cmpxchg instruction emulation - SUCCESS\n");
/*
* Summary.
*/
if (!rcRet)
RTPrintf("tstInstrEmul: SUCCESS\n");
else
return rcRet ? 1 : 0;
}