tstInstrEmul.cpp revision 5a84a1fb0145210f7147fefe6b573544f3d3f4f9
/* $Id: tstMicro.cpp 37408 2008-10-03 22:22:37Z bird $ */
/** @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/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;
}