IEMAllAImplC.cpp revision dcfb8148093a4e60977ae7e101c5e5a539ab71f4
/* $Id$ */
/** @file
* IEM - Instruction Implementation in Assembly, portable C variant.
*/
/*
* Copyright (C) 2011-2013 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 "IEMInternal.h"
#ifdef RT_ARCH_X86
/*
* There are a few 64-bit on 32-bit things we'd rather do in C. Actually, doing
* it all in C is probably safer atm., optimize what's necessary later, maybe.
*/
/* Binary ops */
{
AssertFailed();
}
{
AssertFailed();
}
{
AssertFailed();
}
{
AssertFailed();
}
{
AssertFailed();
}
{
AssertFailed();
}
{
AssertFailed();
}
{
AssertFailed();
}
{
AssertFailed();
}
/** 64-bit locked binary operand operation. */
# define DO_LOCKED_BIN_OP_U64(a_Mnemonic) \
do { \
do \
{ \
} while (0)
IEM_DECL_IMPL_DEF(void, iemAImpl_add_u64_locked,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags))
{
}
IEM_DECL_IMPL_DEF(void, iemAImpl_adc_u64_locked,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags))
{
}
IEM_DECL_IMPL_DEF(void, iemAImpl_sub_u64_locked,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags))
{
}
IEM_DECL_IMPL_DEF(void, iemAImpl_sbb_u64_locked,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags))
{
}
IEM_DECL_IMPL_DEF(void, iemAImpl_or_u64_locked,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags))
{
}
IEM_DECL_IMPL_DEF(void, iemAImpl_xor_u64_locked,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags))
{
}
IEM_DECL_IMPL_DEF(void, iemAImpl_and_u64_locked,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags))
{
}
/* Bit operations (same signature as above). */
{
/* Note! "undefined" flags: OF, SF, ZF, AF, PF. */
*pfEFlags |= X86_EFL_CF;
else
*pfEFlags &= ~X86_EFL_CF;
}
{
/* Note! "undefined" flags: OF, SF, ZF, AF, PF. */
{
*pfEFlags |= X86_EFL_CF;
}
else
{
*pfEFlags &= ~X86_EFL_CF;
}
}
{
/* Note! "undefined" flags: OF, SF, ZF, AF, PF. */
*pfEFlags |= X86_EFL_CF;
else
*pfEFlags &= ~X86_EFL_CF;
}
{
/* Note! "undefined" flags: OF, SF, ZF, AF, PF. */
*pfEFlags |= X86_EFL_CF;
else
*pfEFlags &= ~X86_EFL_CF;
}
IEM_DECL_IMPL_DEF(void, iemAImpl_btc_u64_locked,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags))
{
}
IEM_DECL_IMPL_DEF(void, iemAImpl_btr_u64_locked,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags))
{
}
IEM_DECL_IMPL_DEF(void, iemAImpl_bts_u64_locked,(uint64_t *puDst, uint64_t uSrc, uint32_t *pfEFlags))
{
}
/* bit scan */
{
/* Note! "undefined" flags: OF, SF, AF, PF, CF. */
if (uSrc)
{
if (uSrc & UINT32_MAX)
{
iBit = 0;
}
else
{
iBit = 32;
}
if (!(u32Src & UINT16_MAX))
{
iBit += 16;
u32Src >>= 16;
}
{
iBit += 8;
u32Src >>= 8;
}
if (!(u32Src & 0xf))
{
iBit += 4;
u32Src >>= 4;
}
if (!(u32Src & 0x3))
{
iBit += 2;
u32Src >>= 2;
}
if (!(u32Src & 1))
{
iBit += 1;
}
*pfEFlags &= ~X86_EFL_ZF;
}
else
*pfEFlags |= X86_EFL_ZF;
}
{
/* Note! "undefined" flags: OF, SF, AF, PF, CF. */
if (uSrc)
{
{
iBit = 64;
}
else
{
iBit = 32;
}
{
iBit -= 16;
u32Src <<= 16;
}
{
iBit -= 8;
u32Src <<= 8;
}
{
iBit -= 4;
u32Src <<= 4;
}
{
iBit -= 2;
u32Src <<= 2;
}
{
iBit -= 1;
u32Src <<= 1;
}
*pfEFlags &= ~X86_EFL_ZF;
}
else
*pfEFlags |= X86_EFL_ZF;
}
/* Unary operands. */
{
AssertFailed();
}
{
AssertFailed();
}
{
AssertFailed();
}
{
AssertFailed();
}
/** 64-bit locked unary operand operation. */
# define DO_LOCKED_UNARY_OP_U64(a_Mnemonic) \
do { \
do \
{ \
} while (0)
{
}
{
}
{
}
{
}
/* Shift and rotate. */
{
AssertFailed();
}
{
AssertFailed();
}
{
AssertFailed();
}
{
AssertFailed();
}
{
AssertFailed();
}
{
AssertFailed();
}
{
AssertFailed();
}
IEM_DECL_IMPL_DEF(void, iemAImpl_shld_u64,(uint64_t *puDst, uint64_t uSrc, uint8_t cShift, uint32_t *pfEFlags))
{
AssertFailed();
}
IEM_DECL_IMPL_DEF(void, iemAImpl_shrd_u64,(uint64_t *puDst, uint64_t uSrc, uint8_t cShift, uint32_t *pfEFlags))
{
AssertFailed();
}
/* multiplication and division */
IEM_DECL_IMPL_DEF(int, iemAImpl_mul_u64,(uint64_t *pu64RAX, uint64_t *pu64RDX, uint64_t u64Factor, uint32_t *pfEFlags))
{
AssertFailed();
return -1;
}
IEM_DECL_IMPL_DEF(int, iemAImpl_imul_u64,(uint64_t *pu64RAX, uint64_t *pu64RDX, uint64_t u64Factor, uint32_t *pfEFlags))
{
AssertFailed();
return -1;
}
{
AssertFailed();
}
IEM_DECL_IMPL_DEF(int, iemAImpl_div_u64,(uint64_t *pu64RAX, uint64_t *pu64RDX, uint64_t u64Divisor, uint32_t *pfEFlags))
{
AssertFailed();
return -1;
}
IEM_DECL_IMPL_DEF(int, iemAImpl_idiv_u64,(uint64_t *pu64RAX, uint64_t *pu64RDX, uint64_t u64Divisor, uint32_t *pfEFlags))
{
AssertFailed();
return -1;
}
{
/* XCHG implies LOCK. */
ASMNopPause();
}
{
AssertFailed();
}
IEM_DECL_IMPL_DEF(void, iemAImpl_xadd_u64_locked,(uint64_t *puDst, uint64_t *puReg, uint32_t *pfEFlags))
{
do
{
}
#endif /* RT_ARCH_X86 */
{
{
*pEFlags |= X86_EFL_ZF;
}
else
*pEFlags &= ~X86_EFL_ZF;
}