tstInstrEmul.cpp revision 43747b1f0bc8302a238fb35e55857a5e9aa1933d
/* $Id$ */
/** @file
* Micro Testcase, checking emulation of certain instructions
*/
/*
* 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 <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;
}