2007-12-07 13:59:18 +03:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2011-02-25 00:54:04 +03:00
|
|
|
// $Id$
|
2007-12-07 13:59:18 +03:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2009-12-04 19:53:12 +03:00
|
|
|
// Copyright (C) 2001-2009 The Bochs Project
|
2007-12-07 13:59:18 +03:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
2009-01-16 21:18:59 +03:00
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA B 02110-1301 USA
|
2007-12-07 13:59:18 +03:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#define NEED_CPU_REG_SHORTCUTS 1
|
|
|
|
#include "bochs.h"
|
|
|
|
#include "cpu.h"
|
|
|
|
#define LOG_THIS BX_CPU_THIS_PTR
|
|
|
|
|
|
|
|
#if BX_CPU_LEVEL >= 3
|
|
|
|
|
2008-08-10 23:34:28 +04:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BSF_GdEdR(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
2008-08-10 23:34:28 +04:00
|
|
|
Bit32u op2_32 = BX_READ_32BIT_REG(i->rm());
|
2007-12-07 13:59:18 +03:00
|
|
|
|
|
|
|
if (op2_32 == 0) {
|
2011-06-27 23:48:13 +04:00
|
|
|
SET_FLAGS_OSZAPC_LOGIC_32(0); /* op1_32 undefined */
|
2007-12-07 13:59:18 +03:00
|
|
|
}
|
2008-07-13 14:44:34 +04:00
|
|
|
else {
|
2008-08-10 23:34:28 +04:00
|
|
|
Bit32u op1_32 = 0;
|
2008-07-13 14:44:34 +04:00
|
|
|
while ((op2_32 & 0x01) == 0) {
|
|
|
|
op1_32++;
|
|
|
|
op2_32 >>= 1;
|
|
|
|
}
|
2007-12-07 13:59:18 +03:00
|
|
|
|
2011-06-27 23:48:13 +04:00
|
|
|
// will clear ZF because op1_32 can't be zero
|
2008-07-13 14:44:34 +04:00
|
|
|
SET_FLAGS_OSZAPC_LOGIC_32(op1_32);
|
2007-12-07 13:59:18 +03:00
|
|
|
|
2008-07-13 14:44:34 +04:00
|
|
|
/* now write result back to destination */
|
|
|
|
BX_WRITE_32BIT_REGZ(i->nnn(), op1_32);
|
|
|
|
}
|
2007-12-07 13:59:18 +03:00
|
|
|
}
|
|
|
|
|
2008-08-10 23:34:28 +04:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BSR_GdEdR(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
2008-08-10 23:34:28 +04:00
|
|
|
Bit32u op2_32 = BX_READ_32BIT_REG(i->rm());
|
2007-12-07 13:59:18 +03:00
|
|
|
|
|
|
|
if (op2_32 == 0) {
|
2011-06-27 23:48:13 +04:00
|
|
|
SET_FLAGS_OSZAPC_LOGIC_32(0); /* op1_32 undefined */
|
2007-12-07 13:59:18 +03:00
|
|
|
}
|
2008-07-13 14:44:34 +04:00
|
|
|
else {
|
2008-08-10 23:34:28 +04:00
|
|
|
Bit32u op1_32 = 31;
|
2008-07-13 14:44:34 +04:00
|
|
|
while ((op2_32 & 0x80000000) == 0) {
|
|
|
|
op1_32--;
|
|
|
|
op2_32 <<= 1;
|
|
|
|
}
|
2007-12-07 13:59:18 +03:00
|
|
|
|
2011-06-27 23:48:13 +04:00
|
|
|
// will clear ZF because op1_32 can't be zero
|
2008-07-13 14:44:34 +04:00
|
|
|
SET_FLAGS_OSZAPC_LOGIC_32(op1_32);
|
2007-12-07 13:59:18 +03:00
|
|
|
|
2008-07-13 14:44:34 +04:00
|
|
|
/* now write result back to destination */
|
|
|
|
BX_WRITE_32BIT_REGZ(i->nnn(), op1_32);
|
|
|
|
}
|
2007-12-07 13:59:18 +03:00
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BT_EdGdM(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
|
|
|
bx_address op1_addr;
|
|
|
|
Bit32u op1_32, op2_32, index;
|
|
|
|
Bit32s displacement32;
|
|
|
|
|
2008-08-08 13:22:49 +04:00
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2007-12-07 13:59:18 +03:00
|
|
|
|
2008-01-10 22:37:56 +03:00
|
|
|
op2_32 = BX_READ_32BIT_REG(i->nnn());
|
2007-12-07 13:59:18 +03:00
|
|
|
index = op2_32 & 0x1f;
|
|
|
|
displacement32 = ((Bit32s) (op2_32&0xffffffe0)) / 32;
|
2008-08-08 13:22:49 +04:00
|
|
|
op1_addr = eaddr + 4 * displacement32;
|
2007-12-07 13:59:18 +03:00
|
|
|
|
|
|
|
/* pointer, segment address pair */
|
2010-10-19 02:19:45 +04:00
|
|
|
op1_32 = read_virtual_dword(i->seg(), op1_addr & i->asize_mask());
|
2007-12-07 13:59:18 +03:00
|
|
|
|
|
|
|
set_CF((op1_32 >> index) & 0x01);
|
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BT_EdGdR(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
|
|
|
Bit32u op1_32, op2_32;
|
|
|
|
|
|
|
|
op1_32 = BX_READ_32BIT_REG(i->rm());
|
|
|
|
op2_32 = BX_READ_32BIT_REG(i->nnn());
|
|
|
|
op2_32 &= 0x1f;
|
|
|
|
|
|
|
|
set_CF((op1_32 >> op2_32) & 0x01);
|
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTS_EdGdM(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
|
|
|
bx_address op1_addr;
|
2007-12-23 20:21:28 +03:00
|
|
|
Bit32u op1_32, op2_32, index;
|
2007-12-07 13:59:18 +03:00
|
|
|
Bit32s displacement32;
|
2007-12-23 20:21:28 +03:00
|
|
|
bx_bool bit_i;
|
2007-12-07 13:59:18 +03:00
|
|
|
|
2008-08-08 13:22:49 +04:00
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2007-12-07 13:59:18 +03:00
|
|
|
|
2008-01-10 22:37:56 +03:00
|
|
|
op2_32 = BX_READ_32BIT_REG(i->nnn());
|
2007-12-07 13:59:18 +03:00
|
|
|
index = op2_32 & 0x1f;
|
|
|
|
displacement32 = ((Bit32s) (op2_32&0xffffffe0)) / 32;
|
2008-08-08 13:22:49 +04:00
|
|
|
op1_addr = eaddr + 4 * displacement32;
|
2007-12-07 13:59:18 +03:00
|
|
|
|
|
|
|
/* pointer, segment address pair */
|
2010-10-19 02:19:45 +04:00
|
|
|
op1_32 = read_RMW_virtual_dword(i->seg(), op1_addr & i->asize_mask());
|
2007-12-07 13:59:18 +03:00
|
|
|
|
|
|
|
bit_i = (op1_32 >> index) & 0x01;
|
2011-06-27 23:48:13 +04:00
|
|
|
op1_32 |= (1 << index);
|
2007-12-07 13:59:18 +03:00
|
|
|
|
|
|
|
write_RMW_virtual_dword(op1_32);
|
|
|
|
|
|
|
|
set_CF(bit_i);
|
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTS_EdGdR(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
|
|
|
Bit32u op1_32, op2_32;
|
|
|
|
|
|
|
|
op1_32 = BX_READ_32BIT_REG(i->rm());
|
|
|
|
op2_32 = BX_READ_32BIT_REG(i->nnn());
|
|
|
|
op2_32 &= 0x1f;
|
|
|
|
set_CF((op1_32 >> op2_32) & 0x01);
|
2011-06-27 23:48:13 +04:00
|
|
|
op1_32 |= (1 << op2_32);
|
2007-12-07 13:59:18 +03:00
|
|
|
|
|
|
|
/* now write result back to the destination */
|
|
|
|
BX_WRITE_32BIT_REGZ(i->rm(), op1_32);
|
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTR_EdGdM(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
|
|
|
bx_address op1_addr;
|
|
|
|
Bit32u op1_32, op2_32, index;
|
|
|
|
Bit32s displacement32;
|
|
|
|
|
2008-08-08 13:22:49 +04:00
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2007-12-07 13:59:18 +03:00
|
|
|
|
2008-01-10 22:37:56 +03:00
|
|
|
op2_32 = BX_READ_32BIT_REG(i->nnn());
|
2007-12-07 13:59:18 +03:00
|
|
|
index = op2_32 & 0x1f;
|
|
|
|
displacement32 = ((Bit32s) (op2_32&0xffffffe0)) / 32;
|
2008-08-08 13:22:49 +04:00
|
|
|
op1_addr = eaddr + 4 * displacement32;
|
2007-12-07 13:59:18 +03:00
|
|
|
|
|
|
|
/* pointer, segment address pair */
|
2010-10-19 02:19:45 +04:00
|
|
|
op1_32 = read_RMW_virtual_dword(i->seg(), op1_addr & i->asize_mask());
|
2007-12-07 13:59:18 +03:00
|
|
|
|
|
|
|
bx_bool temp_cf = (op1_32 >> index) & 0x01;
|
2011-06-27 23:48:13 +04:00
|
|
|
op1_32 &= ~(1 << index);
|
2007-12-07 13:59:18 +03:00
|
|
|
|
|
|
|
/* now write back to destination */
|
|
|
|
write_RMW_virtual_dword(op1_32);
|
|
|
|
|
|
|
|
set_CF(temp_cf);
|
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTR_EdGdR(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
|
|
|
Bit32u op1_32, op2_32;
|
|
|
|
|
|
|
|
op1_32 = BX_READ_32BIT_REG(i->rm());
|
|
|
|
op2_32 = BX_READ_32BIT_REG(i->nnn());
|
|
|
|
op2_32 &= 0x1f;
|
|
|
|
set_CF((op1_32 >> op2_32) & 0x01);
|
2011-06-27 23:48:13 +04:00
|
|
|
op1_32 &= ~(1 << op2_32);
|
2007-12-07 13:59:18 +03:00
|
|
|
|
|
|
|
/* now write result back to the destination */
|
|
|
|
BX_WRITE_32BIT_REGZ(i->rm(), op1_32);
|
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTC_EdGdM(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
|
|
|
bx_address op1_addr;
|
|
|
|
Bit32u op1_32, op2_32, index_32;
|
|
|
|
Bit32s displacement32;
|
|
|
|
|
2008-08-08 13:22:49 +04:00
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-01-10 22:37:56 +03:00
|
|
|
|
2007-12-07 13:59:18 +03:00
|
|
|
op2_32 = BX_READ_32BIT_REG(i->nnn());
|
|
|
|
index_32 = op2_32 & 0x1f;
|
|
|
|
|
|
|
|
displacement32 = ((Bit32s) (op2_32 & 0xffffffe0)) / 32;
|
2008-08-08 13:22:49 +04:00
|
|
|
op1_addr = eaddr + 4 * displacement32;
|
2010-10-19 02:19:45 +04:00
|
|
|
|
|
|
|
op1_32 = read_RMW_virtual_dword(i->seg(), op1_addr & i->asize_mask());
|
2007-12-07 13:59:18 +03:00
|
|
|
bx_bool temp_CF = (op1_32 >> index_32) & 0x01;
|
2011-06-27 23:48:13 +04:00
|
|
|
op1_32 ^= (1 << index_32); /* toggle bit */
|
2007-12-07 13:59:18 +03:00
|
|
|
set_CF(temp_CF);
|
|
|
|
|
|
|
|
write_RMW_virtual_dword(op1_32);
|
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTC_EdGdR(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
|
|
|
Bit32u op1_32, op2_32;
|
|
|
|
|
|
|
|
op1_32 = BX_READ_32BIT_REG(i->rm());
|
|
|
|
op2_32 = BX_READ_32BIT_REG(i->nnn());
|
|
|
|
op2_32 &= 0x1f;
|
|
|
|
|
|
|
|
bx_bool temp_CF = (op1_32 >> op2_32) & 0x01;
|
2011-06-27 23:48:13 +04:00
|
|
|
op1_32 ^= (1 << op2_32); /* toggle bit */
|
2007-12-07 13:59:18 +03:00
|
|
|
set_CF(temp_CF);
|
|
|
|
|
|
|
|
BX_WRITE_32BIT_REGZ(i->rm(), op1_32);
|
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BT_EdIbM(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
2008-08-08 13:22:49 +04:00
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-01-10 22:37:56 +03:00
|
|
|
|
2008-08-08 13:22:49 +04:00
|
|
|
Bit32u op1_32 = read_virtual_dword(i->seg(), eaddr);
|
2007-12-20 23:58:38 +03:00
|
|
|
Bit8u op2_8 = i->Ib() & 0x1f;
|
2007-12-07 13:59:18 +03:00
|
|
|
|
|
|
|
set_CF((op1_32 >> op2_8) & 0x01);
|
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BT_EdIbR(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
|
|
|
Bit32u op1_32 = BX_READ_32BIT_REG(i->rm());
|
|
|
|
Bit8u op2_8 = i->Ib() & 0x1f;
|
|
|
|
|
|
|
|
set_CF((op1_32 >> op2_8) & 0x01);
|
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTS_EdIbM(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
|
|
|
Bit8u op2_8 = i->Ib() & 0x1f;
|
|
|
|
|
2008-08-08 13:22:49 +04:00
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-01-10 22:37:56 +03:00
|
|
|
|
2008-08-08 13:22:49 +04:00
|
|
|
Bit32u op1_32 = read_RMW_virtual_dword(i->seg(), eaddr);
|
2007-12-07 13:59:18 +03:00
|
|
|
bx_bool temp_CF = (op1_32 >> op2_8) & 0x01;
|
2011-06-27 23:48:13 +04:00
|
|
|
op1_32 |= (1 << op2_8);
|
2007-12-07 13:59:18 +03:00
|
|
|
write_RMW_virtual_dword(op1_32);
|
|
|
|
|
|
|
|
set_CF(temp_CF);
|
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTS_EdIbR(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
|
|
|
Bit8u op2_8 = i->Ib() & 0x1f;
|
|
|
|
|
2007-12-20 23:58:38 +03:00
|
|
|
Bit32u op1_32 = BX_READ_32BIT_REG(i->rm());
|
2007-12-07 13:59:18 +03:00
|
|
|
bx_bool temp_CF = (op1_32 >> op2_8) & 0x01;
|
2011-06-27 23:48:13 +04:00
|
|
|
op1_32 |= (1 << op2_8);
|
2007-12-07 13:59:18 +03:00
|
|
|
BX_WRITE_32BIT_REGZ(i->rm(), op1_32);
|
|
|
|
|
|
|
|
set_CF(temp_CF);
|
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTC_EdIbM(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
|
|
|
Bit8u op2_8 = i->Ib() & 0x1f;
|
|
|
|
|
2008-08-08 13:22:49 +04:00
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-01-10 22:37:56 +03:00
|
|
|
|
2008-08-08 13:22:49 +04:00
|
|
|
Bit32u op1_32 = read_RMW_virtual_dword(i->seg(), eaddr);
|
2007-12-07 13:59:18 +03:00
|
|
|
bx_bool temp_CF = (op1_32 >> op2_8) & 0x01;
|
2011-06-27 23:48:13 +04:00
|
|
|
op1_32 ^= (1 << op2_8); /* toggle bit */
|
2007-12-07 13:59:18 +03:00
|
|
|
write_RMW_virtual_dword(op1_32);
|
|
|
|
|
|
|
|
set_CF(temp_CF);
|
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTC_EdIbR(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
|
|
|
Bit8u op2_8 = i->Ib() & 0x1f;
|
|
|
|
|
2007-12-20 23:58:38 +03:00
|
|
|
Bit32u op1_32 = BX_READ_32BIT_REG(i->rm());
|
2007-12-07 13:59:18 +03:00
|
|
|
bx_bool temp_CF = (op1_32 >> op2_8) & 0x01;
|
2011-06-27 23:48:13 +04:00
|
|
|
op1_32 ^= (1 << op2_8); /* toggle bit */
|
2007-12-07 13:59:18 +03:00
|
|
|
BX_WRITE_32BIT_REGZ(i->rm(), op1_32);
|
|
|
|
|
|
|
|
set_CF(temp_CF);
|
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTR_EdIbM(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
|
|
|
Bit8u op2_8 = i->Ib() & 0x1f;
|
|
|
|
|
2008-08-08 13:22:49 +04:00
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-01-10 22:37:56 +03:00
|
|
|
|
2008-08-08 13:22:49 +04:00
|
|
|
Bit32u op1_32 = read_RMW_virtual_dword(i->seg(), eaddr);
|
2007-12-07 13:59:18 +03:00
|
|
|
bx_bool temp_CF = (op1_32 >> op2_8) & 0x01;
|
2011-06-27 23:48:13 +04:00
|
|
|
op1_32 &= ~(1 << op2_8);
|
2007-12-07 13:59:18 +03:00
|
|
|
write_RMW_virtual_dword(op1_32);
|
|
|
|
|
|
|
|
set_CF(temp_CF);
|
|
|
|
}
|
|
|
|
|
2008-03-23 00:29:41 +03:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::BTR_EdIbR(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
|
|
|
Bit8u op2_8 = i->Ib() & 0x1f;
|
|
|
|
|
2007-12-20 23:58:38 +03:00
|
|
|
Bit32u op1_32 = BX_READ_32BIT_REG(i->rm());
|
2007-12-07 13:59:18 +03:00
|
|
|
bx_bool temp_CF = (op1_32 >> op2_8) & 0x01;
|
2011-06-27 23:48:13 +04:00
|
|
|
op1_32 &= ~(1 << op2_8);
|
2007-12-07 13:59:18 +03:00
|
|
|
BX_WRITE_32BIT_REGZ(i->rm(), op1_32);
|
|
|
|
|
|
|
|
set_CF(temp_CF);
|
|
|
|
}
|
|
|
|
|
2010-02-09 22:44:25 +03:00
|
|
|
/* F3 0F B8 */
|
2008-08-11 01:16:12 +04:00
|
|
|
void BX_CPP_AttrRegparmN(1) BX_CPU_C::POPCNT_GdEdR(bxInstruction_c *i)
|
2007-12-07 13:59:18 +03:00
|
|
|
{
|
2008-08-11 01:16:12 +04:00
|
|
|
Bit32u op2_32 = BX_READ_32BIT_REG(i->rm());
|
2007-12-07 13:59:18 +03:00
|
|
|
|
2008-08-11 01:16:12 +04:00
|
|
|
Bit32u op1_32 = 0;
|
2007-12-07 13:59:18 +03:00
|
|
|
while (op2_32 != 0) {
|
|
|
|
if (op2_32 & 1) op1_32++;
|
|
|
|
op2_32 >>= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
Bit32u flags = op1_32 ? 0 : EFlagsZFMask;
|
|
|
|
setEFlagsOSZAPC(flags);
|
|
|
|
|
|
|
|
/* now write result back to destination */
|
|
|
|
BX_WRITE_32BIT_REGZ(i->nnn(), op1_32);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // (BX_CPU_LEVEL >= 3)
|