Avoid pointer params for every read_virtual_* except 16-byte SSE and 10-byte x87 reads

This commit is contained in:
Stanislav Shwartsman 2007-12-20 20:58:38 +00:00
parent bfd2cb67f4
commit 5d4e32b8da
53 changed files with 866 additions and 1140 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: 3dnow.cc,v 1.18 2007-03-23 21:27:12 sshwarts Exp $
// $Id: 3dnow.cc,v 1.19 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2002 Stanislav Shwartsman
@ -52,7 +52,7 @@ void BX_CPU_C::PI2FW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op);
MMXUQ(op) = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -78,7 +78,7 @@ void BX_CPU_C::PI2FD_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op);
MMXUQ(op) = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -109,7 +109,7 @@ void BX_CPU_C::PF2ID_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op);
MMXUQ(op) = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -217,7 +217,7 @@ void BX_CPU_C::PMULHRW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
Bit32s product1 = Bit32s(MMXSW0(op1)) * Bit32s(MMXSW0(op2)) + 0x8000;
@ -247,7 +247,7 @@ void BX_CPU_C::PSWAPD_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op);
MMXUQ(op) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUD0(result) = MMXUD1(op);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: access.cc,v 1.84 2007-12-20 18:29:38 sshwarts Exp $
// $Id: access.cc,v 1.85 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -745,11 +745,12 @@ accessOK:
goto accessOK;
}
void BX_CPP_AttrRegparmN(3)
BX_CPU_C::read_virtual_byte(unsigned s, bx_address offset, Bit8u *data)
Bit8u BX_CPP_AttrRegparmN(2)
BX_CPU_C::read_virtual_byte(unsigned s, bx_address offset)
{
bx_address laddr;
bx_segment_reg_t *seg = &BX_CPU_THIS_PTR sregs[s];
Bit8u data;
if ((seg->cache.valid & SegAccessROK4G) == SegAccessROK4G) {
accessOK:
@ -767,8 +768,8 @@ accessOK:
Bit32u pageOffset = laddr & 0xfff;
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_READ);
Bit8u *hostAddr = (Bit8u*) (hostPageAddr | pageOffset);
*data = *hostAddr;
return;
data = *hostAddr;
return data;
}
}
#endif
@ -778,8 +779,8 @@ accessOK:
exception(int_number(seg), 0, 0);
}
#endif
access_linear(laddr, 1, CPL, BX_READ, (void *) data);
return;
access_linear(laddr, 1, CPL, BX_READ, (void *) &data);
return data;
}
if (seg->cache.valid & SegAccessROK) {
@ -790,11 +791,12 @@ accessOK:
goto accessOK;
}
void BX_CPP_AttrRegparmN(3)
BX_CPU_C::read_virtual_word(unsigned s, bx_address offset, Bit16u *data)
Bit16u BX_CPP_AttrRegparmN(2)
BX_CPU_C::read_virtual_word(unsigned s, bx_address offset)
{
bx_address laddr;
bx_segment_reg_t *seg = &BX_CPU_THIS_PTR sregs[s];
Bit16u data;
if ((seg->cache.valid & SegAccessROK4G) == SegAccessROK4G) {
accessOK:
@ -821,8 +823,8 @@ accessOK:
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_READ);
Bit16u *hostAddr = (Bit16u*) (hostPageAddr | pageOffset);
ReadHostWordFromLittleEndian(hostAddr, *data);
return;
ReadHostWordFromLittleEndian(hostAddr, data);
return data;
}
}
}
@ -833,8 +835,8 @@ accessOK:
exception(int_number(seg), 0, 0);
}
#endif
access_linear(laddr, 2, CPL, BX_READ, (void *) data);
return;
access_linear(laddr, 2, CPL, BX_READ, (void *) &data);
return data;
}
if (seg->cache.valid & SegAccessROK) {
@ -845,11 +847,12 @@ accessOK:
goto accessOK;
}
void BX_CPP_AttrRegparmN(3)
BX_CPU_C::read_virtual_dword(unsigned s, bx_address offset, Bit32u *data)
Bit32u BX_CPP_AttrRegparmN(2)
BX_CPU_C::read_virtual_dword(unsigned s, bx_address offset)
{
bx_address laddr;
bx_segment_reg_t *seg = &BX_CPU_THIS_PTR sregs[s];
Bit32u data;
if ((seg->cache.valid & SegAccessROK4G) == SegAccessROK4G) {
accessOK:
@ -876,8 +879,8 @@ accessOK:
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_READ);
Bit32u *hostAddr = (Bit32u*) (hostPageAddr | pageOffset);
ReadHostDWordFromLittleEndian(hostAddr, *data);
return;
ReadHostDWordFromLittleEndian(hostAddr, data);
return data;
}
}
}
@ -888,8 +891,8 @@ accessOK:
exception(int_number(seg), 0, 0);
}
#endif
access_linear(laddr, 4, CPL, BX_READ, (void *) data);
return;
access_linear(laddr, 4, CPL, BX_READ, (void *) &data);
return data;
}
if (seg->cache.valid & SegAccessROK) {
@ -900,11 +903,12 @@ accessOK:
goto accessOK;
}
void BX_CPP_AttrRegparmN(3)
BX_CPU_C::read_virtual_qword(unsigned s, bx_address offset, Bit64u *data)
Bit64u BX_CPP_AttrRegparmN(2)
BX_CPU_C::read_virtual_qword(unsigned s, bx_address offset)
{
bx_address laddr;
bx_segment_reg_t *seg = &BX_CPU_THIS_PTR sregs[s];
Bit64u data;
if ((seg->cache.valid & SegAccessROK4G) == SegAccessROK4G) {
accessOK:
@ -931,8 +935,8 @@ accessOK:
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_READ);
Bit64u *hostAddr = (Bit64u*) (hostPageAddr | pageOffset);
ReadHostQWordFromLittleEndian(hostAddr, *data);
return;
ReadHostQWordFromLittleEndian(hostAddr, data);
return data;
}
}
}
@ -943,8 +947,8 @@ accessOK:
exception(int_number(seg), 0, 0);
}
#endif
access_linear(laddr, 8, CPL, BX_READ, (void *) data);
return;
access_linear(laddr, 8, CPL, BX_READ, (void *) &data);
return data;
}
if (seg->cache.valid & SegAccessROK) {
@ -960,11 +964,12 @@ accessOK:
// address translation info is kept across read/write calls //
//////////////////////////////////////////////////////////////
void BX_CPP_AttrRegparmN(3)
BX_CPU_C::read_RMW_virtual_byte(unsigned s, bx_address offset, Bit8u *data)
Bit8u BX_CPP_AttrRegparmN(2)
BX_CPU_C::read_RMW_virtual_byte(unsigned s, bx_address offset)
{
bx_address laddr;
bx_segment_reg_t *seg = &BX_CPU_THIS_PTR sregs[s];
Bit8u data;
if ((seg->cache.valid & SegAccessWOK4G) == SegAccessWOK4G) {
accessOK:
@ -985,9 +990,9 @@ accessOK:
#if BX_SUPPORT_ICACHE
pageWriteStampTable.decWriteStamp(tlbEntry->ppf);
#endif
*data = *hostAddr;
data = *hostAddr;
BX_CPU_THIS_PTR address_xlation.pages = (bx_ptr_equiv_t) hostAddr;
return;
return data;
}
}
#endif
@ -999,8 +1004,8 @@ accessOK:
exception(int_number(seg), 0, 0);
}
#endif
access_linear(laddr, 1, CPL, BX_RW, (void *) data);
return;
access_linear(laddr, 1, CPL, BX_RW, (void *) &data);
return data;
}
if (seg->cache.valid & SegAccessWOK) {
@ -1011,11 +1016,12 @@ accessOK:
goto accessOK;
}
void BX_CPP_AttrRegparmN(3)
BX_CPU_C::read_RMW_virtual_word(unsigned s, bx_address offset, Bit16u *data)
Bit16u BX_CPP_AttrRegparmN(2)
BX_CPU_C::read_RMW_virtual_word(unsigned s, bx_address offset)
{
bx_address laddr;
bx_segment_reg_t *seg = &BX_CPU_THIS_PTR sregs[s];
Bit16u data;
if ((seg->cache.valid & SegAccessWOK4G) == SegAccessWOK4G) {
accessOK:
@ -1045,9 +1051,9 @@ accessOK:
#if BX_SUPPORT_ICACHE
pageWriteStampTable.decWriteStamp(tlbEntry->ppf);
#endif
ReadHostWordFromLittleEndian(hostAddr, *data);
ReadHostWordFromLittleEndian(hostAddr, data);
BX_CPU_THIS_PTR address_xlation.pages = (bx_ptr_equiv_t) hostAddr;
return;
return data;
}
}
}
@ -1058,8 +1064,8 @@ accessOK:
exception(int_number(seg), 0, 0);
}
#endif
access_linear(laddr, 2, CPL, BX_RW, (void *) data);
return;
access_linear(laddr, 2, CPL, BX_RW, (void *) &data);
return data;
}
if (seg->cache.valid & SegAccessWOK) {
@ -1070,11 +1076,12 @@ accessOK:
goto accessOK;
}
void BX_CPP_AttrRegparmN(3)
BX_CPU_C::read_RMW_virtual_dword(unsigned s, bx_address offset, Bit32u *data)
Bit32u BX_CPP_AttrRegparmN(2)
BX_CPU_C::read_RMW_virtual_dword(unsigned s, bx_address offset)
{
bx_address laddr;
bx_segment_reg_t *seg = &BX_CPU_THIS_PTR sregs[s];
Bit32u data;
if ((seg->cache.valid & SegAccessWOK4G) == SegAccessWOK4G) {
accessOK:
@ -1104,9 +1111,9 @@ accessOK:
#if BX_SUPPORT_ICACHE
pageWriteStampTable.decWriteStamp(tlbEntry->ppf);
#endif
ReadHostDWordFromLittleEndian(hostAddr, *data);
ReadHostDWordFromLittleEndian(hostAddr, data);
BX_CPU_THIS_PTR address_xlation.pages = (bx_ptr_equiv_t) hostAddr;
return;
return data;
}
}
}
@ -1117,8 +1124,8 @@ accessOK:
exception(int_number(seg), 0, 0);
}
#endif
access_linear(laddr, 4, CPL, BX_RW, (void *) data);
return;
access_linear(laddr, 4, CPL, BX_RW, (void *) &data);
return data;
}
if (seg->cache.valid & SegAccessWOK) {
@ -1129,11 +1136,12 @@ accessOK:
goto accessOK;
}
void BX_CPP_AttrRegparmN(3)
BX_CPU_C::read_RMW_virtual_qword(unsigned s, bx_address offset, Bit64u *data)
Bit64u BX_CPP_AttrRegparmN(2)
BX_CPU_C::read_RMW_virtual_qword(unsigned s, bx_address offset)
{
bx_address laddr;
bx_segment_reg_t *seg = &BX_CPU_THIS_PTR sregs[s];
Bit64u data;
if ((seg->cache.valid & SegAccessWOK4G) == SegAccessWOK4G) {
accessOK:
@ -1163,9 +1171,9 @@ accessOK:
#if BX_SUPPORT_ICACHE
pageWriteStampTable.decWriteStamp(tlbEntry->ppf);
#endif
ReadHostQWordFromLittleEndian(hostAddr, *data);
ReadHostQWordFromLittleEndian(hostAddr, data);
BX_CPU_THIS_PTR address_xlation.pages = (bx_ptr_equiv_t) hostAddr;
return;
return data;
}
}
}
@ -1176,8 +1184,8 @@ accessOK:
exception(int_number(seg), 0, 0);
}
#endif
access_linear(laddr, 8, CPL, BX_RW, (void *) data);
return;
access_linear(laddr, 8, CPL, BX_RW, (void *) &data);
return data;
}
if (seg->cache.valid & SegAccessWOK) {
@ -1333,8 +1341,8 @@ BX_CPU_C::read_virtual_dqword(unsigned s, bx_address offset, Bit8u *data)
// Read Double Quadword.
Bit64u *qwords = (Bit64u*) data;
read_virtual_qword(s, offset+Host1stDWordOffset, &qwords[0]);
read_virtual_qword(s, offset+Host2ndDWordOffset, &qwords[1]);
qwords[0] = read_virtual_qword(s, offset+Host1stDWordOffset);
qwords[1] = read_virtual_qword(s, offset+Host2ndDWordOffset);
}
void BX_CPP_AttrRegparmN(3)
@ -1379,8 +1387,8 @@ BX_CPU_C::write_virtual_dqword_aligned(unsigned s, bx_address offset, Bit8u *dat
BX_CPU_C::read_virtual_tword(unsigned s, bx_address offset, floatx80 *data)
{
// read floating point register
read_virtual_qword(s, offset+0, &data->fraction);
read_virtual_word (s, offset+8, &data->exp);
data->fraction = read_virtual_qword(s, offset+0);
data->exp = read_virtual_word (s, offset+8);
}
void BX_CPP_AttrRegparmN(3)

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: arith16.cc,v 1.59 2007-12-04 19:27:22 sshwarts Exp $
// $Id: arith16.cc,v 1.60 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -48,7 +48,7 @@ void BX_CPU_C::ADD_EwGwM(bxInstruction_c *i)
{
Bit16u op1_16, op2_16, sum_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op2_16 = BX_READ_16BIT_REG(i->nnn());
sum_16 = op1_16 + op2_16;
write_RMW_virtual_word(sum_16);
@ -73,7 +73,7 @@ void BX_CPU_C::ADD_GwEwM(bxInstruction_c *i)
Bit16u op1_16, op2_16, sum_16;
op1_16 = BX_READ_16BIT_REG(i->nnn());
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
op2_16 = read_virtual_word(i->seg(), RMAddr(i));
sum_16 = op1_16 + op2_16;
BX_WRITE_16BIT_REG(i->nnn(), sum_16);
@ -111,7 +111,7 @@ void BX_CPU_C::ADC_EwGwM(bxInstruction_c *i)
Bit16u op1_16, op2_16, sum_16;
bx_bool temp_CF = getB_CF();
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op2_16 = BX_READ_16BIT_REG(i->nnn());
sum_16 = op1_16 + op2_16 + temp_CF;
write_RMW_virtual_word(sum_16);
@ -138,7 +138,7 @@ void BX_CPU_C::ADC_GwEwM(bxInstruction_c *i)
bx_bool temp_CF = getB_CF();
op1_16 = BX_READ_16BIT_REG(i->nnn());
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
op2_16 = read_virtual_word(i->seg(), RMAddr(i));
sum_16 = op1_16 + op2_16 + temp_CF;
BX_WRITE_16BIT_REG(i->nnn(), sum_16);
@ -176,7 +176,7 @@ void BX_CPU_C::SBB_EwGwM(bxInstruction_c *i)
Bit16u op1_16, op2_16, diff_16;
bx_bool temp_CF = getB_CF();
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op2_16 = BX_READ_16BIT_REG(i->nnn());
diff_16 = op1_16 - (op2_16 + temp_CF);
write_RMW_virtual_word(diff_16);
@ -203,7 +203,7 @@ void BX_CPU_C::SBB_GwEwM(bxInstruction_c *i)
bx_bool temp_CF = getB_CF();
op1_16 = BX_READ_16BIT_REG(i->nnn());
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
op2_16 = read_virtual_word(i->seg(), RMAddr(i));
diff_16 = op1_16 - (op2_16 + temp_CF);
BX_WRITE_16BIT_REG(i->nnn(), diff_16);
@ -241,7 +241,7 @@ void BX_CPU_C::SBB_EwIwM(bxInstruction_c *i)
bx_bool temp_CF = getB_CF();
Bit16u op1_16, op2_16 = i->Iw(), diff_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
diff_16 = op1_16 - (op2_16 + temp_CF);
write_RMW_virtual_word(diff_16);
@ -264,7 +264,7 @@ void BX_CPU_C::SUB_EwGwM(bxInstruction_c *i)
{
Bit16u op1_16, op2_16, diff_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op2_16 = BX_READ_16BIT_REG(i->nnn());
diff_16 = op1_16 - op2_16;
write_RMW_virtual_word(diff_16);
@ -289,7 +289,7 @@ void BX_CPU_C::SUB_GwEwM(bxInstruction_c *i)
Bit16u op1_16, op2_16, diff_16;
op1_16 = BX_READ_16BIT_REG(i->nnn());
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
op2_16 = read_virtual_word(i->seg(), RMAddr(i));
diff_16 = op1_16 - op2_16;
BX_WRITE_16BIT_REG(i->nnn(), diff_16);
@ -324,7 +324,7 @@ void BX_CPU_C::CMP_EwGwM(bxInstruction_c *i)
{
Bit16u op1_16, op2_16, diff_16;
read_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_virtual_word(i->seg(), RMAddr(i));
op2_16 = BX_READ_16BIT_REG(i->nnn());
diff_16 = op1_16 - op2_16;
@ -347,7 +347,7 @@ void BX_CPU_C::CMP_GwEwM(bxInstruction_c *i)
Bit16u op1_16, op2_16, diff_16;
op1_16 = BX_READ_16BIT_REG(i->nnn());
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
op2_16 = read_virtual_word(i->seg(), RMAddr(i));
diff_16 = op1_16 - op2_16;
SET_FLAGS_OSZAPC_SUB_16(op1_16, op2_16, diff_16);
@ -403,7 +403,7 @@ void BX_CPU_C::XADD_EwGwM(bxInstruction_c *i)
* dst <-- tmp | op1 = sum
*/
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op2_16 = BX_READ_16BIT_REG(i->nnn());
sum_16 = op1_16 + op2_16;
write_RMW_virtual_word(sum_16);
@ -451,7 +451,7 @@ void BX_CPU_C::ADD_EwIwM(bxInstruction_c *i)
{
Bit16u op1_16, op2_16 = i->Iw(), sum_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
sum_16 = op1_16 + op2_16;
write_RMW_virtual_word(sum_16);
@ -474,7 +474,7 @@ void BX_CPU_C::ADC_EwIwM(bxInstruction_c *i)
bx_bool temp_CF = getB_CF();
Bit16u op1_16, op2_16 = i->Iw(), sum_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
sum_16 = op1_16 + op2_16 + temp_CF;
write_RMW_virtual_word(sum_16);
@ -497,7 +497,7 @@ void BX_CPU_C::SUB_EwIwM(bxInstruction_c *i)
{
Bit16u op1_16, op2_16 = i->Iw(), diff_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
diff_16 = op1_16 - op2_16;
write_RMW_virtual_word(diff_16);
@ -519,7 +519,7 @@ void BX_CPU_C::CMP_EwIwM(bxInstruction_c *i)
{
Bit16u op1_16, op2_16 = i->Iw(), diff_16;
read_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_virtual_word(i->seg(), RMAddr(i));
diff_16 = op1_16 - op2_16;
SET_FLAGS_OSZAPC_SUB_16(op1_16, op2_16, diff_16);
}
@ -537,7 +537,7 @@ void BX_CPU_C::NEG_EwM(bxInstruction_c *i)
{
Bit16u op1_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op1_16 = -op1_16;
write_RMW_virtual_word(op1_16);
@ -557,7 +557,7 @@ void BX_CPU_C::INC_EwM(bxInstruction_c *i)
{
Bit16u op1_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op1_16++;
write_RMW_virtual_word(op1_16);
@ -577,7 +577,7 @@ void BX_CPU_C::DEC_EwM(bxInstruction_c *i)
{
Bit16u op1_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op1_16--;
write_RMW_virtual_word(op1_16);
@ -598,7 +598,7 @@ void BX_CPU_C::CMPXCHG_EwGwM(bxInstruction_c *i)
#if BX_CPU_LEVEL >= 4
Bit16u op1_16, op2_16, diff_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
diff_16 = AX - op1_16;
SET_FLAGS_OSZAPC_SUB_16(AX, op1_16, diff_16);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: arith32.cc,v 1.68 2007-12-20 18:29:38 sshwarts Exp $
// $Id: arith32.cc,v 1.69 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -57,7 +57,7 @@ void BX_CPU_C::ADD_EdGdM(bxInstruction_c *i)
{
Bit32u op1_32, op2_32, sum_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op2_32 = BX_READ_32BIT_REG(i->nnn());
sum_32 = op1_32 + op2_32;
write_RMW_virtual_dword(sum_32);
@ -82,7 +82,7 @@ void BX_CPU_C::ADD_GdEdM(bxInstruction_c *i)
Bit32u op1_32, op2_32, sum_32;
op1_32 = BX_READ_32BIT_REG(i->nnn());
read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
op2_32 = read_virtual_dword(i->seg(), RMAddr(i));
sum_32 = op1_32 + op2_32;
BX_WRITE_32BIT_REGZ(i->nnn(), sum_32);
@ -120,7 +120,7 @@ void BX_CPU_C::ADC_EdGdM(bxInstruction_c *i)
Bit32u op1_32, op2_32, sum_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op2_32 = BX_READ_32BIT_REG(i->nnn());
sum_32 = op1_32 + op2_32 + temp_CF;
write_RMW_virtual_dword(sum_32);
@ -149,7 +149,7 @@ void BX_CPU_C::ADC_GdEdM(bxInstruction_c *i)
Bit32u op1_32, op2_32, sum_32;
op1_32 = BX_READ_32BIT_REG(i->nnn());
read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
op2_32 = read_virtual_dword(i->seg(), RMAddr(i));
sum_32 = op1_32 + op2_32 + temp_CF;
BX_WRITE_32BIT_REGZ(i->nnn(), sum_32);
@ -189,7 +189,7 @@ void BX_CPU_C::SBB_EdGdM(bxInstruction_c *i)
Bit32u op1_32, op2_32, diff_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op2_32 = BX_READ_32BIT_REG(i->nnn());
diff_32 = op1_32 - (op2_32 + temp_CF);
write_RMW_virtual_dword(diff_32);
@ -218,7 +218,7 @@ void BX_CPU_C::SBB_GdEdM(bxInstruction_c *i)
Bit32u op1_32, op2_32, diff_32;
op1_32 = BX_READ_32BIT_REG(i->nnn());
read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
op2_32 = read_virtual_dword(i->seg(), RMAddr(i));
diff_32 = op1_32 - (op2_32 + temp_CF);
BX_WRITE_32BIT_REGZ(i->nnn(), diff_32);
@ -259,7 +259,7 @@ void BX_CPU_C::SBB_EdIdM(bxInstruction_c *i)
Bit32u op1_32, op2_32 = i->Id(), diff_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
diff_32 = op1_32 - (op2_32 + temp_CF);
write_RMW_virtual_dword(diff_32);
@ -283,7 +283,7 @@ void BX_CPU_C::SUB_EdGdM(bxInstruction_c *i)
{
Bit32u op1_32, op2_32, diff_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op2_32 = BX_READ_32BIT_REG(i->nnn());
diff_32 = op1_32 - op2_32;
write_RMW_virtual_dword(diff_32);
@ -308,7 +308,7 @@ void BX_CPU_C::SUB_GdEdM(bxInstruction_c *i)
Bit32u op1_32, op2_32, diff_32;
op1_32 = BX_READ_32BIT_REG(i->nnn());
read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
op2_32 = read_virtual_dword(i->seg(), RMAddr(i));
diff_32 = op1_32 - op2_32;
BX_WRITE_32BIT_REGZ(i->nnn(), diff_32);
@ -343,7 +343,7 @@ void BX_CPU_C::CMP_EdGdM(bxInstruction_c *i)
{
Bit32u op1_32, op2_32, diff_32;
read_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_virtual_dword(i->seg(), RMAddr(i));
op2_32 = BX_READ_32BIT_REG(i->nnn());
diff_32 = op1_32 - op2_32;
@ -366,7 +366,7 @@ void BX_CPU_C::CMP_GdEdM(bxInstruction_c *i)
Bit32u op1_32, op2_32, diff_32;
op1_32 = BX_READ_32BIT_REG(i->nnn());
read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
op2_32 = read_virtual_dword(i->seg(), RMAddr(i));
diff_32 = op1_32 - op2_32;
SET_FLAGS_OSZAPC_SUB_32(op1_32, op2_32, diff_32);
@ -448,7 +448,7 @@ void BX_CPU_C::XADD_EdGdM(bxInstruction_c *i)
* dst <-- tmp | op1 = sum
*/
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op2_32 = BX_READ_32BIT_REG(i->nnn());
sum_32 = op1_32 + op2_32;
write_RMW_virtual_dword(sum_32);
@ -496,7 +496,7 @@ void BX_CPU_C::ADD_EdIdM(bxInstruction_c *i)
{
Bit32u op1_32, op2_32, sum_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op2_32 = i->Id();
sum_32 = op1_32 + op2_32;
write_RMW_virtual_dword(sum_32);
@ -523,7 +523,7 @@ void BX_CPU_C::ADC_EdIdM(bxInstruction_c *i)
Bit32u op1_32, op2_32 = i->Id(), sum_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
sum_32 = op1_32 + op2_32 + temp_CF;
write_RMW_virtual_dword(sum_32);
@ -547,7 +547,7 @@ void BX_CPU_C::SUB_EdIdM(bxInstruction_c *i)
{
Bit32u op1_32, op2_32 = i->Id(), diff_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
diff_32 = op1_32 - op2_32;
write_RMW_virtual_dword(diff_32);
@ -569,7 +569,7 @@ void BX_CPU_C::CMP_EdIdM(bxInstruction_c *i)
{
Bit32u op1_32, op2_32, diff_32;
read_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_virtual_dword(i->seg(), RMAddr(i));
op2_32 = i->Id();
diff_32 = op1_32 - op2_32;
@ -591,7 +591,7 @@ void BX_CPU_C::NEG_EdM(bxInstruction_c *i)
{
Bit32u op1_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op1_32 = -op1_32;
write_RMW_virtual_dword(op1_32);
@ -611,7 +611,7 @@ void BX_CPU_C::INC_EdM(bxInstruction_c *i)
{
Bit32u op1_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op1_32++;
write_RMW_virtual_dword(op1_32);
@ -631,7 +631,7 @@ void BX_CPU_C::DEC_EdM(bxInstruction_c *i)
{
Bit32u op1_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op1_32--;
write_RMW_virtual_dword(op1_32);
@ -652,7 +652,7 @@ void BX_CPU_C::CMPXCHG_EdGdM(bxInstruction_c *i)
#if BX_CPU_LEVEL >= 4
Bit32u op1_32, op2_32, diff_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
diff_32 = EAX - op1_32;
SET_FLAGS_OSZAPC_SUB_32(EAX, op1_32, diff_32);
@ -700,8 +700,9 @@ void BX_CPU_C::CMPXCHG8B(bxInstruction_c *i)
#if BX_CPU_LEVEL >= 5
Bit32u op1_64_lo, op1_64_hi, diff;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_64_lo);
read_RMW_virtual_dword(i->seg(), RMAddr(i) + 4, &op1_64_hi);
// check write permission for following write
op1_64_lo = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op1_64_hi = read_RMW_virtual_dword(i->seg(), RMAddr(i) + 4);
diff = EAX - op1_64_lo;
diff |= EDX - op1_64_hi;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: arith64.cc,v 1.44 2007-12-20 18:29:38 sshwarts Exp $
// $Id: arith64.cc,v 1.45 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -39,7 +39,7 @@ void BX_CPU_C::ADD_EqGqM(bxInstruction_c *i)
Bit64u op1_64, op2_64, sum_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op2_64 = BX_READ_64BIT_REG(i->nnn());
sum_64 = op1_64 + op2_64;
write_RMW_virtual_qword(sum_64);
@ -64,7 +64,7 @@ void BX_CPU_C::ADD_GqEqM(bxInstruction_c *i)
Bit64u op1_64, op2_64, sum_64;
op1_64 = BX_READ_64BIT_REG(i->nnn());
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
sum_64 = op1_64 + op2_64;
BX_WRITE_64BIT_REG(i->nnn(), sum_64);
@ -104,7 +104,7 @@ void BX_CPU_C::ADC_EqGqM(bxInstruction_c *i)
Bit64u op1_64, op2_64, sum_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op2_64 = BX_READ_64BIT_REG(i->nnn());
sum_64 = op1_64 + op2_64 + temp_CF;
write_RMW_virtual_qword(sum_64);
@ -133,7 +133,7 @@ void BX_CPU_C::ADC_GqEqM(bxInstruction_c *i)
Bit64u op1_64, op2_64, sum_64;
op1_64 = BX_READ_64BIT_REG(i->nnn());
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
sum_64 = op1_64 + op2_64 + temp_CF;
/* now write sum back to destination */
@ -181,7 +181,7 @@ void BX_CPU_C::SBB_EqGqM(bxInstruction_c *i)
Bit64u op1_64, op2_64, diff_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op2_64 = BX_READ_64BIT_REG(i->nnn());
diff_64 = op1_64 - (op2_64 + temp_CF);
write_RMW_virtual_qword(diff_64);
@ -210,7 +210,7 @@ void BX_CPU_C::SBB_GqEqM(bxInstruction_c *i)
Bit64u op1_64, op2_64, diff_64;
op1_64 = BX_READ_64BIT_REG(i->nnn());
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
diff_64 = op1_64 - (op2_64 + temp_CF);
/* now write diff back to destination */
@ -258,7 +258,7 @@ void BX_CPU_C::SBB_EqIdM(bxInstruction_c *i)
Bit64u op1_64, op2_64, diff_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op2_64 = (Bit32s) i->Id();
diff_64 = op1_64 - (op2_64 + temp_CF);
write_RMW_virtual_qword(diff_64);
@ -285,7 +285,7 @@ void BX_CPU_C::SUB_EqGqM(bxInstruction_c *i)
Bit64u op1_64, op2_64, diff_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op2_64 = BX_READ_64BIT_REG(i->nnn());
diff_64 = op1_64 - op2_64;
write_RMW_virtual_qword(diff_64);
@ -310,7 +310,7 @@ void BX_CPU_C::SUB_GqEqM(bxInstruction_c *i)
Bit64u op1_64, op2_64, diff_64;
op1_64 = BX_READ_64BIT_REG(i->nnn());
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
diff_64 = op1_64 - op2_64;
/* now write diff back to destination */
@ -351,8 +351,7 @@ void BX_CPU_C::CMP_EqGqM(bxInstruction_c *i)
{
Bit64u op1_64, op2_64, diff_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_virtual_qword(i->seg(), RMAddr(i));
op2_64 = BX_READ_64BIT_REG(i->nnn());
diff_64 = op1_64 - op2_64;
@ -375,7 +374,7 @@ void BX_CPU_C::CMP_GqEqM(bxInstruction_c *i)
Bit64u op1_64, op2_64, diff_64;
op1_64 = BX_READ_64BIT_REG(i->nnn());
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
diff_64 = op1_64 - op2_64;
SET_FLAGS_OSZAPC_SUB_64(op1_64, op2_64, diff_64);
@ -430,7 +429,7 @@ void BX_CPU_C::XADD_EqGqM(bxInstruction_c *i)
*/
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op2_64 = BX_READ_64BIT_REG(i->nnn());
sum_64 = op1_64 + op2_64;
write_RMW_virtual_qword(sum_64);
@ -470,7 +469,7 @@ void BX_CPU_C::ADD_EqIdM(bxInstruction_c *i)
Bit64u op1_64, op2_64, sum_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op2_64 = (Bit32s) i->Id();
sum_64 = op1_64 + op2_64;
write_RMW_virtual_qword(sum_64);
@ -497,7 +496,7 @@ void BX_CPU_C::ADC_EqIdM(bxInstruction_c *i)
Bit64u op1_64, op2_64, sum_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op2_64 = (Bit32s) i->Id();
sum_64 = op1_64 + op2_64 + temp_CF;
write_RMW_virtual_qword(sum_64);
@ -524,7 +523,7 @@ void BX_CPU_C::SUB_EqIdM(bxInstruction_c *i)
Bit64u op1_64, op2_64, diff_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op2_64 = (Bit32s) i->Id();
diff_64 = op1_64 - op2_64;
write_RMW_virtual_qword(diff_64);
@ -548,8 +547,7 @@ void BX_CPU_C::CMP_EqIdM(bxInstruction_c *i)
{
Bit64u op1_64, op2_64, diff_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_virtual_qword(i->seg(), RMAddr(i));
op2_64 = (Bit32s) i->Id();
diff_64 = op1_64 - op2_64;
@ -572,7 +570,7 @@ void BX_CPU_C::NEG_EqM(bxInstruction_c *i)
Bit64u op1_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op1_64 = -op1_64;
write_RMW_virtual_qword(op1_64);
@ -593,7 +591,7 @@ void BX_CPU_C::INC_EqM(bxInstruction_c *i)
Bit64u op1_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op1_64++;
write_RMW_virtual_qword(op1_64);
@ -614,7 +612,7 @@ void BX_CPU_C::DEC_EqM(bxInstruction_c *i)
Bit64u op1_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op1_64--;
write_RMW_virtual_qword(op1_64);
@ -635,7 +633,7 @@ void BX_CPU_C::CMPXCHG_EqGqM(bxInstruction_c *i)
Bit64u op1_64, op2_64, diff_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
diff_64 = RAX - op1_64;
SET_FLAGS_OSZAPC_SUB_64(RAX, op1_64, diff_64);
@ -678,8 +676,9 @@ void BX_CPU_C::CMPXCHG16B(bxInstruction_c *i)
exception(BX_GP_EXCEPTION, 0, 0);
}
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64_lo);
read_RMW_virtual_qword(i->seg(), RMAddr(i) + 8, &op1_64_hi);
// check write permission for following write
op1_64_lo = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op1_64_hi = read_RMW_virtual_qword(i->seg(), RMAddr(i) + 8);
diff = RAX - op1_64_lo;
diff |= RDX - op1_64_hi;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: arith8.cc,v 1.50 2007-12-04 19:27:22 sshwarts Exp $
// $Id: arith8.cc,v 1.51 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -36,7 +36,7 @@ void BX_CPU_C::ADD_EbGbM(bxInstruction_c *i)
{
Bit8u op1, op2, sum;
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1);
op1 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op2 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
sum = op1 + op2;
write_RMW_virtual_byte(sum);
@ -61,7 +61,7 @@ void BX_CPU_C::ADD_GbEbM(bxInstruction_c *i)
Bit8u op1, op2, sum;
op1 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
read_virtual_byte(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_byte(i->seg(), RMAddr(i));
sum = op1 + op2;
BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), sum);
@ -97,7 +97,7 @@ void BX_CPU_C::ADC_EbGbM(bxInstruction_c *i)
Bit8u op1, op2, sum;
bx_bool temp_CF = getB_CF();
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1);
op1 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op2 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
sum = op1 + op2 + temp_CF;
write_RMW_virtual_byte(sum);
@ -124,7 +124,7 @@ void BX_CPU_C::ADC_GbEbM(bxInstruction_c *i)
bx_bool temp_CF = getB_CF();
op1 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
read_virtual_byte(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_byte(i->seg(), RMAddr(i));
sum = op1 + op2 + temp_CF;
BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), sum);
@ -162,7 +162,7 @@ void BX_CPU_C::SBB_EbGbM(bxInstruction_c *i)
Bit8u op1_8, op2_8, diff_8;
bx_bool temp_CF = getB_CF();
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op2_8 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
diff_8 = op1_8 - (op2_8 + temp_CF);
write_RMW_virtual_byte(diff_8);
@ -189,7 +189,7 @@ void BX_CPU_C::SBB_GbEbM(bxInstruction_c *i)
bx_bool temp_CF = getB_CF();
op1_8 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
read_virtual_byte(i->seg(), RMAddr(i), &op2_8);
op2_8 = read_virtual_byte(i->seg(), RMAddr(i));
diff_8 = op1_8 - (op2_8 + temp_CF);
BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), diff_8);
@ -227,7 +227,7 @@ void BX_CPU_C::SBB_EbIbM(bxInstruction_c *i)
Bit8u op1_8, op2_8 = i->Ib(), diff_8;
bx_bool temp_CF = getB_CF();
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
diff_8 = op1_8 - (op2_8 + temp_CF);
write_RMW_virtual_byte(diff_8);
@ -250,7 +250,7 @@ void BX_CPU_C::SUB_EbGbM(bxInstruction_c *i)
{
Bit8u op1_8, op2_8, diff_8;
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op2_8 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
diff_8 = op1_8 - op2_8;
write_RMW_virtual_byte(diff_8);
@ -275,7 +275,7 @@ void BX_CPU_C::SUB_GbEbM(bxInstruction_c *i)
Bit8u op1_8, op2_8, diff_8;
op1_8 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
read_virtual_byte(i->seg(), RMAddr(i), &op2_8);
op2_8 = read_virtual_byte(i->seg(), RMAddr(i));
diff_8 = op1_8 - op2_8;
BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), diff_8);
@ -310,7 +310,7 @@ void BX_CPU_C::CMP_EbGbM(bxInstruction_c *i)
{
Bit8u op1_8, op2_8, diff_8;
read_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_virtual_byte(i->seg(), RMAddr(i));
op2_8 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
diff_8 = op1_8 - op2_8;
@ -333,7 +333,7 @@ void BX_CPU_C::CMP_GbEbM(bxInstruction_c *i)
Bit8u op1_8, op2_8, diff_8;
op1_8 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
read_virtual_byte(i->seg(), RMAddr(i), &op2_8);
op2_8 = read_virtual_byte(i->seg(), RMAddr(i));
diff_8 = op1_8 - op2_8;
SET_FLAGS_OSZAPC_SUB_8(op1_8, op2_8, diff_8);
@ -372,7 +372,7 @@ void BX_CPU_C::XADD_EbGbM(bxInstruction_c *i)
* dst <-- tmp | op1 = sum
*/
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1);
op1 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op2 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
sum = op1 + op2;
write_RMW_virtual_byte(sum);
@ -420,7 +420,7 @@ void BX_CPU_C::ADD_EbIbM(bxInstruction_c *i)
{
Bit8u op1, op2 = i->Ib(), sum;
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1);
op1 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
sum = op1 + op2;
write_RMW_virtual_byte(sum);
@ -443,7 +443,7 @@ void BX_CPU_C::ADC_EbIbM(bxInstruction_c *i)
Bit8u op1, op2 = i->Ib(), sum;
bx_bool temp_CF = getB_CF();
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1);
op1 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
sum = op1 + op2 + temp_CF;
write_RMW_virtual_byte(sum);
@ -466,7 +466,7 @@ void BX_CPU_C::SUB_EbIbM(bxInstruction_c *i)
{
Bit8u op1_8, op2_8 = i->Ib(), diff_8;
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
diff_8 = op1_8 - op2_8;
write_RMW_virtual_byte(diff_8);
@ -488,7 +488,8 @@ void BX_CPU_C::CMP_EbIbM(bxInstruction_c *i)
{
Bit8u op1_8, op2_8 = i->Ib(), diff_8;
read_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_virtual_byte(i->seg(), RMAddr(i));
diff_8 = op1_8 - op2_8;
SET_FLAGS_OSZAPC_SUB_8(op1_8, op2_8, diff_8);
@ -507,7 +508,7 @@ void BX_CPU_C::NEG_EbM(bxInstruction_c *i)
{
Bit8u op1_8;
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op1_8 = -op1_8;
write_RMW_virtual_byte(op1_8);
@ -527,7 +528,7 @@ void BX_CPU_C::INC_EbM(bxInstruction_c *i)
{
Bit8u op1_8;
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op1_8++;
write_RMW_virtual_byte(op1_8);
@ -547,7 +548,7 @@ void BX_CPU_C::DEC_EbM(bxInstruction_c *i)
{
Bit8u op1_8;
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op1_8--;
write_RMW_virtual_byte(op1_8);
@ -568,7 +569,7 @@ void BX_CPU_C::CMPXCHG_EbGbM(bxInstruction_c *i)
#if BX_CPU_LEVEL >= 4
Bit8u op1_8, op2_8, diff_8;
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
diff_8 = AL - op1_8;
SET_FLAGS_OSZAPC_SUB_8(AL, op1_8, diff_8);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bit.cc,v 1.47 2007-12-20 18:29:38 sshwarts Exp $
// $Id: bit.cc,v 1.48 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -308,13 +308,13 @@ static Bit32u mod2_64bit(Bit64u divisor, Bit64u dividend)
void BX_CPU_C::CRC32_GdEb(bxInstruction_c *i)
{
#if (BX_SUPPORT_SSE >= 5) || (BX_SUPPORT_SSE >= 4 && BX_SUPPORT_SSE_EXTENSION > 0)
Bit8u op1;
Bit8u op1;
if (i->modC0()) {
op1 = BX_READ_8BIT_REGx(i->rm(),i->extend8bitL());
}
else {
read_virtual_byte(i->seg(), RMAddr(i), &op1);
op1 = read_virtual_byte(i->seg(), RMAddr(i));
}
Bit32u op2 = BX_READ_32BIT_REG(i->nnn());
@ -349,7 +349,7 @@ void BX_CPU_C::CRC32_GdEv(bxInstruction_c *i)
op1 = BX_READ_64BIT_REG(i->rm());
}
else {
read_virtual_qword(i->seg(), RMAddr(i), &op1);
op1 = read_virtual_qword(i->seg(), RMAddr(i));
}
Bit64u tmp1 = ((Bit64u) BitReflect32(op1 & 0xffffffff)) << 32;
@ -372,7 +372,7 @@ void BX_CPU_C::CRC32_GdEv(bxInstruction_c *i)
op1 = BX_READ_32BIT_REG(i->rm());
}
else {
read_virtual_dword(i->seg(), RMAddr(i), &op1);
op1 = read_virtual_dword(i->seg(), RMAddr(i));
}
Bit64u tmp1 = ((Bit64u) BitReflect32(op1)) << 32;
@ -387,7 +387,7 @@ void BX_CPU_C::CRC32_GdEv(bxInstruction_c *i)
op1 = BX_READ_16BIT_REG(i->rm());
}
else {
read_virtual_word(i->seg(), RMAddr(i), &op1);
op1 = read_virtual_word(i->seg(), RMAddr(i));
}
Bit64u tmp1 = ((Bit64u) BitReflect16(op1)) << 32;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bit16.cc,v 1.1 2007-12-07 10:59:18 sshwarts Exp $
// $Id: bit16.cc,v 1.2 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -44,7 +44,7 @@ void BX_CPU_C::BSF_GwEw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
op2_16 = read_virtual_word(i->seg(), RMAddr(i));
}
if (op2_16 == 0) {
@ -75,7 +75,7 @@ void BX_CPU_C::BSR_GwEw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
op2_16 = read_virtual_word(i->seg(), RMAddr(i));
}
if (op2_16 == 0) {
@ -108,7 +108,7 @@ void BX_CPU_C::BT_EwGwM(bxInstruction_c *i)
op1_addr = RMAddr(i) + 2 * displacement32;
/* pointer, segment address pair */
read_virtual_word(i->seg(), op1_addr, &op1_16);
op1_16 = read_virtual_word(i->seg(), op1_addr);
set_CF((op1_16 >> index) & 0x01);
}
@ -135,7 +135,7 @@ void BX_CPU_C::BTS_EwGwM(bxInstruction_c *i)
op1_addr = RMAddr(i) + 2 * displacement32;
/* pointer, segment address pair */
read_RMW_virtual_word(i->seg(), op1_addr, &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), op1_addr);
bit_i = (op1_16 >> index) & 0x01;
op1_16 |= (((Bit16u) 1) << index);
@ -171,7 +171,7 @@ void BX_CPU_C::BTR_EwGwM(bxInstruction_c *i)
op1_addr = RMAddr(i) + 2 * displacement32;
/* pointer, segment address pair */
read_RMW_virtual_word(i->seg(), op1_addr, &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), op1_addr);
bx_bool temp_cf = (op1_16 >> index) & 0x01;
op1_16 &= ~(((Bit16u) 1) << index);
@ -207,7 +207,7 @@ void BX_CPU_C::BTC_EwGwM(bxInstruction_c *i)
displacement16 = ((Bit16s) (op2_16 & 0xfff0)) / 16;
op1_addr = RMAddr(i) + 2 * displacement16;
read_RMW_virtual_word(i->seg(), op1_addr, &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), op1_addr);
bx_bool temp_CF = (op1_16 >> index_16) & 0x01;
op1_16 ^= (((Bit16u) 1) << index_16); /* toggle bit */
@ -237,10 +237,8 @@ void BX_CPU_C::BTC_EwGwR(bxInstruction_c *i)
void BX_CPU_C::BT_EwIbM(bxInstruction_c *i)
{
Bit16u op1_16;
Bit8u op2_8 = i->Ib() & 0xf;
read_virtual_word(i->seg(), RMAddr(i), &op1_16);
Bit16u op1_16 = read_virtual_word(i->seg(), RMAddr(i));
Bit8u op2_8 = i->Ib() & 0xf;
set_CF((op1_16 >> op2_8) & 0x01);
}
@ -255,11 +253,9 @@ void BX_CPU_C::BT_EwIbR(bxInstruction_c *i)
void BX_CPU_C::BTS_EwIbM(bxInstruction_c *i)
{
Bit16u op1_16;
Bit8u op2_8 = i->Ib() & 0xf;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
Bit16u op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
bx_bool temp_CF = (op1_16 >> op2_8) & 0x01;
op1_16 |= (((Bit16u) 1) << op2_8);
write_RMW_virtual_word(op1_16);
@ -269,11 +265,9 @@ void BX_CPU_C::BTS_EwIbM(bxInstruction_c *i)
void BX_CPU_C::BTS_EwIbR(bxInstruction_c *i)
{
Bit16u op1_16;
Bit8u op2_8 = i->Ib() & 0xf;
op1_16 = BX_READ_16BIT_REG(i->rm());
Bit16u op1_16 = BX_READ_16BIT_REG(i->rm());
bx_bool temp_CF = (op1_16 >> op2_8) & 0x01;
op1_16 |= (((Bit16u) 1) << op2_8);
BX_WRITE_16BIT_REG(i->rm(), op1_16);
@ -283,11 +277,9 @@ void BX_CPU_C::BTS_EwIbR(bxInstruction_c *i)
void BX_CPU_C::BTC_EwIbM(bxInstruction_c *i)
{
Bit16u op1_16;
Bit8u op2_8 = i->Ib() & 0xf;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
Bit16u op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
bx_bool temp_CF = (op1_16 >> op2_8) & 0x01;
op1_16 ^= (((Bit16u) 1) << op2_8); /* toggle bit */
write_RMW_virtual_word(op1_16);
@ -297,11 +289,9 @@ void BX_CPU_C::BTC_EwIbM(bxInstruction_c *i)
void BX_CPU_C::BTC_EwIbR(bxInstruction_c *i)
{
Bit16u op1_16;
Bit8u op2_8 = i->Ib() & 0xf;
op1_16 = BX_READ_16BIT_REG(i->rm());
Bit16u op1_16 = BX_READ_16BIT_REG(i->rm());
bx_bool temp_CF = (op1_16 >> op2_8) & 0x01;
op1_16 ^= (((Bit16u) 1) << op2_8); /* toggle bit */
BX_WRITE_16BIT_REG(i->rm(), op1_16);
@ -311,11 +301,9 @@ void BX_CPU_C::BTC_EwIbR(bxInstruction_c *i)
void BX_CPU_C::BTR_EwIbM(bxInstruction_c *i)
{
Bit16u op1_16;
Bit8u op2_8 = i->Ib() & 0xf;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
Bit16u op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
bx_bool temp_CF = (op1_16 >> op2_8) & 0x01;
op1_16 &= ~(((Bit16u) 1) << op2_8);
write_RMW_virtual_word(op1_16);
@ -325,11 +313,9 @@ void BX_CPU_C::BTR_EwIbM(bxInstruction_c *i)
void BX_CPU_C::BTR_EwIbR(bxInstruction_c *i)
{
Bit16u op1_16;
Bit8u op2_8 = i->Ib() & 0xf;
op1_16 = BX_READ_16BIT_REG(i->rm());
Bit16u op1_16 = BX_READ_16BIT_REG(i->rm());
bx_bool temp_CF = (op1_16 >> op2_8) & 0x01;
op1_16 &= ~(((Bit16u) 1) << op2_8);
BX_WRITE_16BIT_REG(i->rm(), op1_16);
@ -349,7 +335,7 @@ void BX_CPU_C::POPCNT_GwEw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
op2_16 = read_virtual_word(i->seg(), RMAddr(i));
}
op1_16 = 0;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bit32.cc,v 1.1 2007-12-07 10:59:18 sshwarts Exp $
// $Id: bit32.cc,v 1.2 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -45,7 +45,7 @@ void BX_CPU_C::BSF_GdEd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
op2_32 = read_virtual_dword(i->seg(), RMAddr(i));
}
if (op2_32 == 0) {
@ -77,7 +77,7 @@ void BX_CPU_C::BSR_GdEd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
op2_32 = read_virtual_dword(i->seg(), RMAddr(i));
}
if (op2_32 == 0) {
@ -111,7 +111,7 @@ void BX_CPU_C::BT_EdGdM(bxInstruction_c *i)
op1_addr = RMAddr(i) + 4 * displacement32;
/* pointer, segment address pair */
read_virtual_dword(i->seg(), op1_addr, &op1_32);
op1_32 = read_virtual_dword(i->seg(), op1_addr);
set_CF((op1_32 >> index) & 0x01);
}
@ -140,7 +140,7 @@ void BX_CPU_C::BTS_EdGdM(bxInstruction_c *i)
op1_addr = RMAddr(i) + 4 * displacement32;
/* pointer, segment address pair */
read_RMW_virtual_dword(i->seg(), op1_addr, &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), op1_addr);
bit_i = (op1_32 >> index) & 0x01;
op1_32 |= (((Bit32u) 1) << index);
@ -177,7 +177,7 @@ void BX_CPU_C::BTR_EdGdM(bxInstruction_c *i)
op1_addr = RMAddr(i) + 4 * displacement32;
/* pointer, segment address pair */
read_RMW_virtual_dword(i->seg(), op1_addr, &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), op1_addr);
bx_bool temp_cf = (op1_32 >> index) & 0x01;
op1_32 &= ~(((Bit32u) 1) << index);
@ -213,7 +213,7 @@ void BX_CPU_C::BTC_EdGdM(bxInstruction_c *i)
displacement32 = ((Bit32s) (op2_32 & 0xffffffe0)) / 32;
op1_addr = RMAddr(i) + 4 * displacement32;
read_RMW_virtual_dword(i->seg(), op1_addr, &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), op1_addr);
bx_bool temp_CF = (op1_32 >> index_32) & 0x01;
op1_32 ^= (((Bit32u) 1) << index_32); /* toggle bit */
@ -239,10 +239,8 @@ void BX_CPU_C::BTC_EdGdR(bxInstruction_c *i)
void BX_CPU_C::BT_EdIbM(bxInstruction_c *i)
{
Bit32u op1_32;
Bit8u op2_8 = i->Ib() & 0x1f;
read_virtual_dword(i->seg(), RMAddr(i), &op1_32);
Bit32u op1_32 = read_virtual_dword(i->seg(), RMAddr(i));
Bit8u op2_8 = i->Ib() & 0x1f;
set_CF((op1_32 >> op2_8) & 0x01);
}
@ -257,11 +255,9 @@ void BX_CPU_C::BT_EdIbR(bxInstruction_c *i)
void BX_CPU_C::BTS_EdIbM(bxInstruction_c *i)
{
Bit32u op1_32;
Bit8u op2_8 = i->Ib() & 0x1f;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
Bit32u op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
bx_bool temp_CF = (op1_32 >> op2_8) & 0x01;
op1_32 |= (((Bit32u) 1) << op2_8);
write_RMW_virtual_dword(op1_32);
@ -271,11 +267,9 @@ void BX_CPU_C::BTS_EdIbM(bxInstruction_c *i)
void BX_CPU_C::BTS_EdIbR(bxInstruction_c *i)
{
Bit32u op1_32;
Bit8u op2_8 = i->Ib() & 0x1f;
op1_32 = BX_READ_32BIT_REG(i->rm());
Bit32u op1_32 = BX_READ_32BIT_REG(i->rm());
bx_bool temp_CF = (op1_32 >> op2_8) & 0x01;
op1_32 |= (((Bit32u) 1) << op2_8);
BX_WRITE_32BIT_REGZ(i->rm(), op1_32);
@ -285,11 +279,9 @@ void BX_CPU_C::BTS_EdIbR(bxInstruction_c *i)
void BX_CPU_C::BTC_EdIbM(bxInstruction_c *i)
{
Bit32u op1_32;
Bit8u op2_8 = i->Ib() & 0x1f;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
Bit32u op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
bx_bool temp_CF = (op1_32 >> op2_8) & 0x01;
op1_32 ^= (((Bit32u) 1) << op2_8); /* toggle bit */
write_RMW_virtual_dword(op1_32);
@ -299,11 +291,9 @@ void BX_CPU_C::BTC_EdIbM(bxInstruction_c *i)
void BX_CPU_C::BTC_EdIbR(bxInstruction_c *i)
{
Bit32u op1_32;
Bit8u op2_8 = i->Ib() & 0x1f;
op1_32 = BX_READ_32BIT_REG(i->rm());
Bit32u op1_32 = BX_READ_32BIT_REG(i->rm());
bx_bool temp_CF = (op1_32 >> op2_8) & 0x01;
op1_32 ^= (((Bit32u) 1) << op2_8); /* toggle bit */
BX_WRITE_32BIT_REGZ(i->rm(), op1_32);
@ -313,11 +303,9 @@ void BX_CPU_C::BTC_EdIbR(bxInstruction_c *i)
void BX_CPU_C::BTR_EdIbM(bxInstruction_c *i)
{
Bit32u op1_32;
Bit8u op2_8 = i->Ib() & 0x1f;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
Bit32u op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
bx_bool temp_CF = (op1_32 >> op2_8) & 0x01;
op1_32 &= ~(((Bit32u) 1) << op2_8);
write_RMW_virtual_dword(op1_32);
@ -327,11 +315,9 @@ void BX_CPU_C::BTR_EdIbM(bxInstruction_c *i)
void BX_CPU_C::BTR_EdIbR(bxInstruction_c *i)
{
Bit32u op1_32;
Bit8u op2_8 = i->Ib() & 0x1f;
op1_32 = BX_READ_32BIT_REG(i->rm());
Bit32u op1_32 = BX_READ_32BIT_REG(i->rm());
bx_bool temp_CF = (op1_32 >> op2_8) & 0x01;
op1_32 &= ~(((Bit32u) 1) << op2_8);
BX_WRITE_32BIT_REGZ(i->rm(), op1_32);
@ -351,7 +337,7 @@ void BX_CPU_C::POPCNT_GdEd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
op2_32 = read_virtual_dword(i->seg(), RMAddr(i));
}
op1_32 = 0;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bit64.cc,v 1.1 2007-12-07 10:59:18 sshwarts Exp $
// $Id: bit64.cc,v 1.2 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -44,7 +44,7 @@ void BX_CPU_C::BSF_GqEq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
}
if (op2_64 == 0) {
@ -76,7 +76,7 @@ void BX_CPU_C::BSR_GqEq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
}
if (op2_64 == 0) {
@ -110,7 +110,7 @@ void BX_CPU_C::BT_EqGqM(bxInstruction_c *i)
op1_addr = RMAddr(i) + 8 * displacement64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), op1_addr, &op1_64);
op1_64 = read_virtual_qword(i->seg(), op1_addr);
set_CF((op1_64 >> index) & 0x01);
}
@ -138,7 +138,7 @@ void BX_CPU_C::BTS_EqGqM(bxInstruction_c *i)
op1_addr = RMAddr(i) + 8 * displacement64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), op1_addr, &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), op1_addr);
bit_i = (op1_64 >> index) & 0x01;
op1_64 |= (((Bit64u) 1) << index);
@ -174,7 +174,7 @@ void BX_CPU_C::BTR_EqGqM(bxInstruction_c *i)
op1_addr = RMAddr(i) + 8 * displacement64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), op1_addr, &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), op1_addr);
bx_bool temp_cf = (op1_64 >> index) & 0x01;
op1_64 &= ~(((Bit64u) 1) << index);
@ -210,7 +210,7 @@ void BX_CPU_C::BTC_EqGqM(bxInstruction_c *i)
index = op2_64 & 0x3f;
displacement64 = ((Bit64s) (op2_64 & BX_CONST64(0xffffffffffffffc0))) / 64;
op1_addr = RMAddr(i) + 8 * displacement64;
read_RMW_virtual_qword(i->seg(), op1_addr, &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), op1_addr);
bx_bool temp_CF = (op1_64 >> index) & 0x01;
op1_64 ^= (((Bit64u) 1) << index); /* toggle bit */
@ -236,10 +236,8 @@ void BX_CPU_C::BTC_EqGqR(bxInstruction_c *i)
void BX_CPU_C::BT_EqIbM(bxInstruction_c *i)
{
Bit64u op1_64;
Bit8u op2_8 = i->Ib() & 0x3f;
read_virtual_qword(i->seg(), RMAddr(i), &op1_64);
Bit64u op1_64 = read_virtual_qword(i->seg(), RMAddr(i));
Bit8u op2_8 = i->Ib() & 0x3f;
set_CF((op1_64 >> op2_8) & 0x01);
}
@ -254,11 +252,9 @@ void BX_CPU_C::BT_EqIbR(bxInstruction_c *i)
void BX_CPU_C::BTS_EqIbM(bxInstruction_c *i)
{
Bit64u op1_64;
Bit8u op2_8 = i->Ib() & 0x3f;
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
Bit64u op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
bx_bool temp_CF = (op1_64 >> op2_8) & 0x01;
op1_64 |= (((Bit64u) 1) << op2_8);
write_RMW_virtual_qword(op1_64);
@ -268,11 +264,9 @@ void BX_CPU_C::BTS_EqIbM(bxInstruction_c *i)
void BX_CPU_C::BTS_EqIbR(bxInstruction_c *i)
{
Bit64u op1_64;
Bit8u op2_8 = i->Ib() & 0x3f;
op1_64 = BX_READ_64BIT_REG(i->rm());
Bit64u op1_64 = BX_READ_64BIT_REG(i->rm());
bx_bool temp_CF = (op1_64 >> op2_8) & 0x01;
op1_64 |= (((Bit64u) 1) << op2_8);
BX_WRITE_64BIT_REG(i->rm(), op1_64);
@ -282,11 +276,9 @@ void BX_CPU_C::BTS_EqIbR(bxInstruction_c *i)
void BX_CPU_C::BTC_EqIbM(bxInstruction_c *i)
{
Bit64u op1_64;
Bit8u op2_8 = i->Ib() & 0x3f;
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
Bit64u op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
bx_bool temp_CF = (op1_64 >> op2_8) & 0x01;
op1_64 ^= (((Bit64u) 1) << op2_8); /* toggle bit */
write_RMW_virtual_qword(op1_64);
@ -296,11 +288,9 @@ void BX_CPU_C::BTC_EqIbM(bxInstruction_c *i)
void BX_CPU_C::BTC_EqIbR(bxInstruction_c *i)
{
Bit64u op1_64;
Bit8u op2_8 = i->Ib() & 0x3f;
op1_64 = BX_READ_64BIT_REG(i->rm());
Bit64u op1_64 = BX_READ_64BIT_REG(i->rm());
bx_bool temp_CF = (op1_64 >> op2_8) & 0x01;
op1_64 ^= (((Bit64u) 1) << op2_8); /* toggle bit */
BX_WRITE_64BIT_REG(i->rm(), op1_64);
@ -310,11 +300,9 @@ void BX_CPU_C::BTC_EqIbR(bxInstruction_c *i)
void BX_CPU_C::BTR_EqIbM(bxInstruction_c *i)
{
Bit64u op1_64;
Bit8u op2_8 = i->Ib() & 0x3f;
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
Bit64u op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
bx_bool temp_CF = (op1_64 >> op2_8) & 0x01;
op1_64 &= ~(((Bit64u) 1) << op2_8);
write_RMW_virtual_qword(op1_64);
@ -348,7 +336,7 @@ void BX_CPU_C::POPCNT_GqEq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
}
op1_64 = 0;

View File

@ -1,5 +1,5 @@
////////////////////////////////////////////////////////////////////////
// $Id: call_far.cc,v 1.23 2007-12-16 21:03:45 sshwarts Exp $
// $Id: call_far.cc,v 1.24 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2005 Stanislav Shwartsman
@ -345,12 +345,12 @@ BX_CPU_C::call_protected(bxInstruction_c *i, Bit16u cs_raw, bx_address disp)
if (gate_descriptor.type==BX_286_CALL_GATE) {
for (unsigned i=0; i<param_count; i++) {
read_virtual_word (BX_SEG_REG_SS, return_ESP + i*2, &parameter_word[i]);
parameter_word[i] = read_virtual_word(BX_SEG_REG_SS, return_ESP + i*2);
}
}
else {
for (unsigned i=0; i<param_count; i++) {
read_virtual_dword(BX_SEG_REG_SS, return_ESP + i*4, &parameter_dword[i]);
parameter_dword[i] = read_virtual_dword(BX_SEG_REG_SS, return_ESP + i*4);
}
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.399 2007-12-20 18:29:38 sshwarts Exp $
// $Id: cpu.h,v 1.400 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -3134,10 +3134,10 @@ public: // for now...
#if BX_SUPPORT_FPU
BX_SMF void write_virtual_tword(unsigned seg, bx_address offset, floatx80 *data) BX_CPP_AttrRegparmN(3);
#endif
BX_SMF void read_virtual_byte(unsigned seg, bx_address offset, Bit8u *data) BX_CPP_AttrRegparmN(3);
BX_SMF void read_virtual_word(unsigned seg, bx_address offset, Bit16u *data) BX_CPP_AttrRegparmN(3);
BX_SMF void read_virtual_dword(unsigned seg, bx_address offset, Bit32u *data) BX_CPP_AttrRegparmN(3);
BX_SMF void read_virtual_qword(unsigned seg, bx_address offset, Bit64u *data) BX_CPP_AttrRegparmN(3);
BX_SMF Bit8u read_virtual_byte(unsigned seg, bx_address offset) BX_CPP_AttrRegparmN(2);
BX_SMF Bit16u read_virtual_word(unsigned seg, bx_address offset) BX_CPP_AttrRegparmN(2);
BX_SMF Bit32u read_virtual_dword(unsigned seg, bx_address offset) BX_CPP_AttrRegparmN(2);
BX_SMF Bit64u read_virtual_qword(unsigned seg, bx_address offset) BX_CPP_AttrRegparmN(2);
BX_SMF void read_virtual_dqword(unsigned s, bx_address off, Bit8u *data) BX_CPP_AttrRegparmN(3);
BX_SMF void read_virtual_dqword_aligned(unsigned s, bx_address off, Bit8u *data) BX_CPP_AttrRegparmN(3);
#if BX_SUPPORT_FPU
@ -3167,10 +3167,10 @@ public: // for now...
#endif
BX_SMF void read_RMW_virtual_byte(unsigned seg, bx_address offset, Bit8u *data) BX_CPP_AttrRegparmN(3);
BX_SMF void read_RMW_virtual_word(unsigned seg, bx_address offset, Bit16u *data) BX_CPP_AttrRegparmN(3);
BX_SMF void read_RMW_virtual_dword(unsigned seg, bx_address offset, Bit32u *data) BX_CPP_AttrRegparmN(3);
BX_SMF void read_RMW_virtual_qword(unsigned seg, bx_address offset, Bit64u *data) BX_CPP_AttrRegparmN(3);
BX_SMF Bit8u read_RMW_virtual_byte(unsigned seg, bx_address offset) BX_CPP_AttrRegparmN(2);
BX_SMF Bit16u read_RMW_virtual_word(unsigned seg, bx_address offset) BX_CPP_AttrRegparmN(2);
BX_SMF Bit32u read_RMW_virtual_dword(unsigned seg, bx_address offset) BX_CPP_AttrRegparmN(2);
BX_SMF Bit64u read_RMW_virtual_qword(unsigned seg, bx_address offset) BX_CPP_AttrRegparmN(2);
BX_SMF void write_RMW_virtual_byte(Bit8u val8) BX_CPP_AttrRegparmN(1);
BX_SMF void write_RMW_virtual_word(Bit16u val16) BX_CPP_AttrRegparmN(1);
BX_SMF void write_RMW_virtual_dword(Bit32u val32) BX_CPP_AttrRegparmN(1);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: ctrl_xfer16.cc,v 1.48 2007-12-20 18:29:38 sshwarts Exp $
// $Id: ctrl_xfer16.cc,v 1.49 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -236,7 +236,7 @@ void BX_CPU_C::CALL_Ew(bxInstruction_c *i)
op1_16 = BX_READ_16BIT_REG(i->rm());
}
else {
read_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_virtual_word(i->seg(), RMAddr(i));
}
if (op1_16 > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled)
@ -262,8 +262,8 @@ void BX_CPU_C::CALL16_Ep(bxInstruction_c *i)
BX_CPU_THIS_PTR show_flag |= Flag_call;
#endif
read_virtual_word(i->seg(), RMAddr(i), &op1_16);
read_virtual_word(i->seg(), RMAddr(i)+2, &cs_raw);
op1_16 = read_virtual_word(i->seg(), RMAddr(i));
cs_raw = read_virtual_word(i->seg(), RMAddr(i)+2);
BX_CPU_THIS_PTR speculative_rsp = 1;
BX_CPU_THIS_PTR prev_rsp = RSP;
@ -505,9 +505,7 @@ void BX_CPU_C::JNLE_Jw(bxInstruction_c *i)
void BX_CPU_C::JMP_EwM(bxInstruction_c *i)
{
Bit16u new_IP;
read_virtual_word(i->seg(), RMAddr(i), &new_IP);
Bit16u new_IP = read_virtual_word(i->seg(), RMAddr(i));
branch_near32((Bit32u) new_IP);
@ -529,8 +527,8 @@ void BX_CPU_C::JMP16_Ep(bxInstruction_c *i)
invalidate_prefetch_q();
read_virtual_word(i->seg(), RMAddr(i), &op1_16);
read_virtual_word(i->seg(), RMAddr(i)+2, &cs_raw);
op1_16 = read_virtual_word(i->seg(), RMAddr(i));
cs_raw = read_virtual_word(i->seg(), RMAddr(i)+2);
// jump_protected doesn't affect RSP so it is RSP safe
if (protected_mode()) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: ctrl_xfer32.cc,v 1.60 2007-12-20 18:29:38 sshwarts Exp $
// $Id: ctrl_xfer32.cc,v 1.61 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -213,7 +213,7 @@ void BX_CPU_C::CALL_Ed(bxInstruction_c *i)
op1_32 = BX_READ_32BIT_REG(i->rm());
}
else {
read_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_virtual_dword(i->seg(), RMAddr(i));
}
if (op1_32 > BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled)
@ -240,8 +240,8 @@ void BX_CPU_C::CALL32_Ep(bxInstruction_c *i)
#endif
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op1_32);
read_virtual_word(i->seg(), RMAddr(i)+4, &cs_raw);
op1_32 = read_virtual_dword(i->seg(), RMAddr(i));
cs_raw = read_virtual_word (i->seg(), RMAddr(i)+4);
BX_CPU_THIS_PTR speculative_rsp = 1;
BX_CPU_THIS_PTR prev_rsp = RSP;
@ -495,10 +495,8 @@ void BX_CPU_C::JMP_Ap(bxInstruction_c *i)
void BX_CPU_C::JMP_EdM(bxInstruction_c *i)
{
Bit32u new_EIP;
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &new_EIP);
Bit32u new_EIP = read_virtual_dword(i->seg(), RMAddr(i));
branch_near32(new_EIP);
@ -521,8 +519,8 @@ void BX_CPU_C::JMP32_Ep(bxInstruction_c *i)
invalidate_prefetch_q();
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op1_32);
read_virtual_word(i->seg(), RMAddr(i)+4, &cs_raw);
op1_32 = read_virtual_dword(i->seg(), RMAddr(i));
cs_raw = read_virtual_word (i->seg(), RMAddr(i)+4);
// jump_protected doesn't affect RSP so it is RSP safe
if (protected_mode()) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: ctrl_xfer64.cc,v 1.57 2007-12-16 21:40:44 sshwarts Exp $
// $Id: ctrl_xfer64.cc,v 1.58 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -36,15 +36,11 @@
void BX_CPU_C::RETnear64_Iw(bxInstruction_c *i)
{
Bit64u return_RIP;
#if BX_DEBUGGER
BX_CPU_THIS_PTR show_flag |= Flag_ret;
#endif
Bit16u imm16 = i->Iw();
read_virtual_qword(BX_SEG_REG_SS, RSP, &return_RIP);
Bit64u return_RIP = read_virtual_qword(BX_SEG_REG_SS, RSP);
if (! IsCanonical(return_RIP)) {
BX_ERROR(("RETnear64_Iw: canonical RIP violation"));
@ -52,20 +48,18 @@ void BX_CPU_C::RETnear64_Iw(bxInstruction_c *i)
}
RIP = return_RIP;
RSP += 8 + imm16;
RSP += 8 + i->Iw();
BX_INSTR_UCNEAR_BRANCH(BX_CPU_ID, BX_INSTR_IS_RET, RIP);
}
void BX_CPU_C::RETnear64(bxInstruction_c *i)
{
Bit64u return_RIP;
#if BX_DEBUGGER
BX_CPU_THIS_PTR show_flag |= Flag_ret;
#endif
read_virtual_qword(BX_SEG_REG_SS, RSP, &return_RIP);
Bit64u return_RIP = read_virtual_qword(BX_SEG_REG_SS, RSP);
if (! IsCanonical(return_RIP)) {
BX_ERROR(("RETnear64_Iw: canonical RIP violation"));
@ -154,7 +148,7 @@ void BX_CPU_C::CALL_Eq(bxInstruction_c *i)
op1_64 = BX_READ_64BIT_REG(i->rm());
}
else {
read_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_virtual_qword(i->seg(), RMAddr(i));
}
if (! IsCanonical(op1_64))
@ -181,8 +175,8 @@ void BX_CPU_C::CALL64_Ep(bxInstruction_c *i)
#endif
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op1_32);
read_virtual_word(i->seg(), RMAddr(i)+8, &cs_raw);
op1_32 = read_virtual_dword(i->seg(), RMAddr(i));
cs_raw = read_virtual_word (i->seg(), RMAddr(i)+8);
BX_ASSERT(protected_mode());
@ -372,7 +366,7 @@ void BX_CPU_C::JMP_Eq(bxInstruction_c *i)
op1_64 = BX_READ_64BIT_REG(i->rm());
}
else {
read_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_virtual_qword(i->seg(), RMAddr(i));
}
if (! IsCanonical(op1_64)) {
@ -393,8 +387,8 @@ void BX_CPU_C::JMP64_Ep(bxInstruction_c *i)
invalidate_prefetch_q();
read_virtual_dword(i->seg(), RMAddr(i), &op1_32);
read_virtual_word(i->seg(), RMAddr(i)+4, &cs_raw);
op1_32 = read_virtual_dword(i->seg(), RMAddr(i));
cs_raw = read_virtual_word (i->seg(), RMAddr(i)+4);
BX_ASSERT(protected_mode());

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: data_xfer16.cc,v 1.49 2007-12-20 18:29:38 sshwarts Exp $
// $Id: data_xfer16.cc,v 1.50 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -64,8 +64,8 @@ void BX_CPU_C::MOV_GwEwR(bxInstruction_c *i)
void BX_CPU_C::MOV_GwEwM(bxInstruction_c *i)
{
// 2nd modRM operand Ex, is known to be a memory operand, Ew.
read_virtual_word(i->seg(), RMAddr(i), &BX_READ_16BIT_REG(i->nnn()));
Bit16u val16 = read_virtual_word(i->seg(), RMAddr(i));
BX_WRITE_16BIT_REG(i->nnn(), val16);
}
void BX_CPU_C::MOV_EwSw(bxInstruction_c *i)
@ -105,7 +105,7 @@ void BX_CPU_C::MOV_SwEw(bxInstruction_c *i)
op2_16 = BX_READ_16BIT_REG(i->rm());
}
else {
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
op2_16 = read_virtual_word(i->seg(), RMAddr(i));
}
load_seg_reg(&BX_CPU_THIS_PTR sregs[i->nnn()], op2_16);
@ -127,7 +127,7 @@ void BX_CPU_C::LEA_GwM(bxInstruction_c *i)
void BX_CPU_C::MOV_AXOd(bxInstruction_c *i)
{
read_virtual_word(i->seg(), i->Id(), &AX);
AX = read_virtual_word(i->seg(), i->Id());
}
void BX_CPU_C::MOV_OdAX(bxInstruction_c *i)
@ -148,10 +148,7 @@ void BX_CPU_C::MOV_EwIwR(bxInstruction_c *i)
#if BX_CPU_LEVEL >= 3
void BX_CPU_C::MOVZX_GwEbM(bxInstruction_c *i)
{
Bit8u op2_8;
/* pointer, segment address pair */
read_virtual_byte(i->seg(), RMAddr(i), &op2_8);
Bit8u op2_8 = read_virtual_byte(i->seg(), RMAddr(i));
/* zero extend byte op2 into word op1 */
BX_WRITE_16BIT_REG(i->nnn(), (Bit16u) op2_8);
@ -167,10 +164,7 @@ void BX_CPU_C::MOVZX_GwEbR(bxInstruction_c *i)
void BX_CPU_C::MOVSX_GwEbM(bxInstruction_c *i)
{
Bit8u op2_8;
/* pointer, segment address pair */
read_virtual_byte(i->seg(), RMAddr(i), &op2_8);
Bit8u op2_8 = read_virtual_byte(i->seg(), RMAddr(i));
/* sign extend byte op2 into word op1 */
BX_WRITE_16BIT_REG(i->nnn(), (Bit8s) op2_8);
@ -189,8 +183,7 @@ void BX_CPU_C::XCHG_EwGwM(bxInstruction_c *i)
{
Bit16u op1_16, op2_16;
/* pointer, segment address pair */
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op2_16 = BX_READ_16BIT_REG(i->nnn());
write_RMW_virtual_word(op2_16);
@ -254,7 +247,8 @@ void BX_CPU_C::CMOV_GwEw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
op2_16 = read_virtual_word(i->seg(), RMAddr(i)
);
}
if (condition) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: data_xfer32.cc,v 1.48 2007-12-20 18:29:38 sshwarts Exp $
// $Id: data_xfer32.cc,v 1.49 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -72,9 +72,8 @@ void BX_CPU_C::MOV_GdEdR(bxInstruction_c *i)
void BX_CPU_C::MOV_GdEdM(bxInstruction_c *i)
{
// 2nd modRM operand Ex, is known to be a memory operand, Ed.
read_virtual_dword(i->seg(), RMAddr(i), &BX_READ_32BIT_REG(i->nnn()));
BX_CLEAR_64BIT_HIGH(i->nnn());
Bit32u val32 = read_virtual_dword(i->seg(), RMAddr(i));
BX_WRITE_32BIT_REGZ(i->nnn(), val32);
}
void BX_CPU_C::LEA_GdM(bxInstruction_c *i)
@ -84,8 +83,7 @@ void BX_CPU_C::LEA_GdM(bxInstruction_c *i)
void BX_CPU_C::MOV_EAXOd(bxInstruction_c *i)
{
read_virtual_dword(i->seg(), i->Id(), &EAX);
BX_CLEAR_64BIT_HIGH(BX_64BIT_REG_RAX);
RAX = read_virtual_dword(i->seg(), i->Id());
}
void BX_CPU_C::MOV_OdEAX(bxInstruction_c *i)
@ -105,10 +103,7 @@ void BX_CPU_C::MOV_EdIdR(bxInstruction_c *i)
void BX_CPU_C::MOVZX_GdEbM(bxInstruction_c *i)
{
Bit8u op2_8;
/* pointer, segment address pair */
read_virtual_byte(i->seg(), RMAddr(i), &op2_8);
Bit8u op2_8 = read_virtual_byte(i->seg(), RMAddr(i));
/* zero extend byte op2 into dword op1 */
BX_WRITE_32BIT_REGZ(i->nnn(), (Bit32u) op2_8);
@ -124,10 +119,7 @@ void BX_CPU_C::MOVZX_GdEbR(bxInstruction_c *i)
void BX_CPU_C::MOVZX_GdEwM(bxInstruction_c *i)
{
Bit16u op2_16;
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
Bit16u op2_16 = read_virtual_word(i->seg(), RMAddr(i));
/* zero extend word op2 into dword op1 */
BX_WRITE_32BIT_REGZ(i->nnn(), (Bit32u) op2_16);
@ -143,10 +135,7 @@ void BX_CPU_C::MOVZX_GdEwR(bxInstruction_c *i)
void BX_CPU_C::MOVSX_GdEbM(bxInstruction_c *i)
{
Bit8u op2_8;
/* pointer, segment address pair */
read_virtual_byte(i->seg(), RMAddr(i), &op2_8);
Bit8u op2_8 = read_virtual_byte(i->seg(), RMAddr(i));
/* sign extend byte op2 into dword op1 */
BX_WRITE_32BIT_REGZ(i->nnn(), (Bit8s) op2_8);
@ -162,10 +151,7 @@ void BX_CPU_C::MOVSX_GdEbR(bxInstruction_c *i)
void BX_CPU_C::MOVSX_GdEwM(bxInstruction_c *i)
{
Bit16u op2_16;
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
Bit16u op2_16 = read_virtual_word(i->seg(), RMAddr(i));
/* sign extend word op2 into dword op1 */
BX_WRITE_32BIT_REGZ(i->nnn(), (Bit16s) op2_16);
@ -183,8 +169,7 @@ void BX_CPU_C::XCHG_EdGdM(bxInstruction_c *i)
{
Bit32u op2_32, op1_32;
/* pointer, segment address pair */
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op2_32 = BX_READ_32BIT_REG(i->nnn());
write_RMW_virtual_dword(op2_32);
@ -237,7 +222,7 @@ void BX_CPU_C::CMOV_GdEd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
op2_32 = read_virtual_dword(i->seg(), RMAddr(i));
}
if (condition) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: data_xfer64.cc,v 1.31 2007-12-20 18:29:38 sshwarts Exp $
// $Id: data_xfer64.cc,v 1.32 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -59,8 +59,8 @@ void BX_CPU_C::MOV_EqGqR(bxInstruction_c *i)
void BX_CPU_C::MOV_GqEqM(bxInstruction_c *i)
{
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &BX_READ_64BIT_REG(i->nnn()));
Bit64u val64 = read_virtual_qword(i->seg(), RMAddr(i));
BX_WRITE_64BIT_REG(i->nnn(), val64);
}
void BX_CPU_C::MOV_GqEqR(bxInstruction_c *i)
@ -76,7 +76,7 @@ void BX_CPU_C::LEA_GqM(bxInstruction_c *i)
void BX_CPU_C::MOV_ALOq(bxInstruction_c *i)
{
read_virtual_byte(i->seg(), i->Iq(), &AL);
AL = read_virtual_byte(i->seg(), i->Iq());
}
void BX_CPU_C::MOV_OqAL(bxInstruction_c *i)
@ -86,7 +86,7 @@ void BX_CPU_C::MOV_OqAL(bxInstruction_c *i)
void BX_CPU_C::MOV_AXOq(bxInstruction_c *i)
{
read_virtual_word(i->seg(), i->Iq(), &AX);
AX = read_virtual_word(i->seg(), i->Iq());
}
void BX_CPU_C::MOV_OqAX(bxInstruction_c *i)
@ -96,12 +96,7 @@ void BX_CPU_C::MOV_OqAX(bxInstruction_c *i)
void BX_CPU_C::MOV_EAXOq(bxInstruction_c *i)
{
Bit32u temp_32;
read_virtual_dword(i->seg(), i->Iq(), &temp_32);
/* write to register */
RAX = temp_32;
RAX = read_virtual_dword(i->seg(), i->Iq());
}
void BX_CPU_C::MOV_OqEAX(bxInstruction_c *i)
@ -111,7 +106,7 @@ void BX_CPU_C::MOV_OqEAX(bxInstruction_c *i)
void BX_CPU_C::MOV_RAXOq(bxInstruction_c *i)
{
read_virtual_qword(i->seg(), i->Iq(), &RAX);
RAX = read_virtual_qword(i->seg(), i->Iq());
}
void BX_CPU_C::MOV_OqRAX(bxInstruction_c *i)
@ -133,10 +128,7 @@ void BX_CPU_C::MOV_EqIdR(bxInstruction_c *i)
void BX_CPU_C::MOVZX_GqEbM(bxInstruction_c *i)
{
Bit8u op2_8;
/* pointer, segment address pair */
read_virtual_byte(i->seg(), RMAddr(i), &op2_8);
Bit8u op2_8 = read_virtual_byte(i->seg(), RMAddr(i));
/* zero extend byte op2 into qword op1 */
BX_WRITE_64BIT_REG(i->nnn(), (Bit64u) op2_8);
@ -152,10 +144,7 @@ void BX_CPU_C::MOVZX_GqEbR(bxInstruction_c *i)
void BX_CPU_C::MOVZX_GqEwM(bxInstruction_c *i)
{
Bit16u op2_16;
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
Bit16u op2_16 = read_virtual_word(i->seg(), RMAddr(i));
/* zero extend word op2 into qword op1 */
BX_WRITE_64BIT_REG(i->nnn(), (Bit64u) op2_16);
@ -171,10 +160,7 @@ void BX_CPU_C::MOVZX_GqEwR(bxInstruction_c *i)
void BX_CPU_C::MOVSX_GqEbM(bxInstruction_c *i)
{
Bit8u op2_8;
/* pointer, segment address pair */
read_virtual_byte(i->seg(), RMAddr(i), &op2_8);
Bit8u op2_8 = read_virtual_byte(i->seg(), RMAddr(i));
/* sign extend byte op2 into qword op1 */
BX_WRITE_64BIT_REG(i->nnn(), (Bit8s) op2_8);
@ -190,10 +176,7 @@ void BX_CPU_C::MOVSX_GqEbR(bxInstruction_c *i)
void BX_CPU_C::MOVSX_GqEwM(bxInstruction_c *i)
{
Bit16u op2_16;
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
Bit16u op2_16 = read_virtual_word(i->seg(), RMAddr(i));
/* sign extend word op2 into qword op1 */
BX_WRITE_64BIT_REG(i->nnn(), (Bit16s) op2_16);
@ -209,10 +192,7 @@ void BX_CPU_C::MOVSX_GqEwR(bxInstruction_c *i)
void BX_CPU_C::MOVSX_GqEdM(bxInstruction_c *i)
{
Bit32u op2_32;
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
Bit32u op2_32 = read_virtual_dword(i->seg(), RMAddr(i));
/* sign extend word op2 into qword op1 */
BX_WRITE_64BIT_REG(i->nnn(), (Bit32s) op2_32);
@ -230,8 +210,7 @@ void BX_CPU_C::XCHG_EqGqM(bxInstruction_c *i)
{
Bit64u op2_64, op1_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op2_64 = BX_READ_64BIT_REG(i->nnn());
write_RMW_virtual_qword(op2_64);
@ -253,10 +232,7 @@ void BX_CPU_C::XCHG_EqGqR(bxInstruction_c *i)
void BX_CPU_C::CMOVO_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (get_OF())
BX_WRITE_64BIT_REG(i->nnn(), op2_64);
@ -270,10 +246,7 @@ void BX_CPU_C::CMOVO_GqEqR(bxInstruction_c *i)
void BX_CPU_C::CMOVNO_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (!get_OF())
BX_WRITE_64BIT_REG(i->nnn(), op2_64);
@ -287,10 +260,7 @@ void BX_CPU_C::CMOVNO_GqEqR(bxInstruction_c *i)
void BX_CPU_C::CMOVB_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (get_CF())
BX_WRITE_64BIT_REG(i->nnn(), op2_64);
@ -304,10 +274,7 @@ void BX_CPU_C::CMOVB_GqEqR(bxInstruction_c *i)
void BX_CPU_C::CMOVNB_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (!get_CF())
BX_WRITE_64BIT_REG(i->nnn(), op2_64);
@ -321,10 +288,7 @@ void BX_CPU_C::CMOVNB_GqEqR(bxInstruction_c *i)
void BX_CPU_C::CMOVZ_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (get_ZF())
BX_WRITE_64BIT_REG(i->nnn(), op2_64);
@ -338,10 +302,7 @@ void BX_CPU_C::CMOVZ_GqEqR(bxInstruction_c *i)
void BX_CPU_C::CMOVNZ_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (!get_ZF())
BX_WRITE_64BIT_REG(i->nnn(), op2_64);
@ -355,10 +316,7 @@ void BX_CPU_C::CMOVNZ_GqEqR(bxInstruction_c *i)
void BX_CPU_C::CMOVBE_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (get_CF() || get_ZF())
BX_WRITE_64BIT_REG(i->nnn(), op2_64);
@ -372,10 +330,7 @@ void BX_CPU_C::CMOVBE_GqEqR(bxInstruction_c *i)
void BX_CPU_C::CMOVNBE_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (! (get_CF() || get_ZF()))
BX_WRITE_64BIT_REG(i->nnn(), op2_64);
@ -389,10 +344,7 @@ void BX_CPU_C::CMOVNBE_GqEqR(bxInstruction_c *i)
void BX_CPU_C::CMOVS_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (get_SF())
BX_WRITE_64BIT_REG(i->nnn(), op2_64);
@ -406,10 +358,7 @@ void BX_CPU_C::CMOVS_GqEqR(bxInstruction_c *i)
void BX_CPU_C::CMOVNS_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (!get_SF())
BX_WRITE_64BIT_REG(i->nnn(), op2_64);
@ -423,10 +372,7 @@ void BX_CPU_C::CMOVNS_GqEqR(bxInstruction_c *i)
void BX_CPU_C::CMOVP_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (get_PF())
BX_WRITE_64BIT_REG(i->nnn(), op2_64);
@ -440,10 +386,7 @@ void BX_CPU_C::CMOVP_GqEqR(bxInstruction_c *i)
void BX_CPU_C::CMOVNP_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (!get_PF())
BX_WRITE_64BIT_REG(i->nnn(), op2_64);
@ -457,10 +400,7 @@ void BX_CPU_C::CMOVNP_GqEqR(bxInstruction_c *i)
void BX_CPU_C::CMOVL_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (getB_SF() != getB_OF())
BX_WRITE_64BIT_REG(i->nnn(), op2_64);
@ -474,10 +414,7 @@ void BX_CPU_C::CMOVL_GqEqR(bxInstruction_c *i)
void BX_CPU_C::CMOVNL_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (getB_SF() == getB_OF())
BX_WRITE_64BIT_REG(i->nnn(), op2_64);
@ -491,10 +428,7 @@ void BX_CPU_C::CMOVNL_GqEqR(bxInstruction_c *i)
void BX_CPU_C::CMOVLE_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (get_ZF() || (getB_SF() != getB_OF()))
BX_WRITE_64BIT_REG(i->nnn(), op2_64);
@ -508,10 +442,7 @@ void BX_CPU_C::CMOVLE_GqEqR(bxInstruction_c *i)
void BX_CPU_C::CMOVNLE_GqEqM(bxInstruction_c *i)
{
Bit64u op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
Bit64u op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
if (! get_ZF() && (getB_SF() == getB_OF()))
BX_WRITE_64BIT_REG(i->nnn(), op2_64);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: data_xfer8.cc,v 1.32 2007-12-20 18:29:38 sshwarts Exp $
// $Id: data_xfer8.cc,v 1.33 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -55,7 +55,8 @@ void BX_CPU_C::MOV_EbGbR(bxInstruction_c *i)
void BX_CPU_C::MOV_GbEbM(bxInstruction_c *i)
{
read_virtual_byte(i->seg(), RMAddr(i), &BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL()));
Bit8u val8 = read_virtual_byte(i->seg(), RMAddr(i));
BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), val8);
}
void BX_CPU_C::MOV_GbEbR(bxInstruction_c *i)
@ -66,7 +67,7 @@ void BX_CPU_C::MOV_GbEbR(bxInstruction_c *i)
void BX_CPU_C::MOV_ALOd(bxInstruction_c *i)
{
read_virtual_byte(i->seg(), i->Id(), &AL);
AL = read_virtual_byte(i->seg(), i->Id());
}
void BX_CPU_C::MOV_OdAL(bxInstruction_c *i)
@ -102,7 +103,7 @@ void BX_CPU_C::XLAT(bxInstruction_c *i)
offset = BX + AL;
}
read_virtual_byte(i->seg(), offset, &AL);
AL = read_virtual_byte(i->seg(), offset);
}
void BX_CPU_C::XCHG_EbGbM(bxInstruction_c *i)
@ -110,7 +111,7 @@ void BX_CPU_C::XCHG_EbGbM(bxInstruction_c *i)
Bit8u op1, op2;
/* pointer, segment address pair */
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1);
op1 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op2 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
write_RMW_virtual_byte(op2);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: io.cc,v 1.45 2007-12-20 18:29:38 sshwarts Exp $
// $Id: io.cc,v 1.46 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -581,7 +581,7 @@ void BX_CPU_C::OUTSB_DXXb(bxInstruction_c *i)
else
esi = SI;
read_virtual_byte(i->seg(), esi, &value8);
value8 = read_virtual_byte(i->seg(), esi);
BX_OUTP(DX, value8, 1);
@ -666,14 +666,14 @@ void BX_CPU_C::OUTSW_DXXw(bxInstruction_c *i)
incr = wordCount << 1; // count * 2.
}
else {
read_virtual_word(i->seg(), esi, &value16);
value16 = read_virtual_word(i->seg(), esi);
BX_OUTP(DX, value16, 2);
}
}
else
#endif
{
read_virtual_word(i->seg(), esi, &value16);
value16 = read_virtual_word(i->seg(), esi);
BX_OUTP(DX, value16, 2);
}
@ -720,8 +720,7 @@ void BX_CPU_C::OUTSD_DXXd(bxInstruction_c *i)
else
esi = SI;
Bit32u value32=0;
read_virtual_dword(i->seg(), esi, &value32);
Bit32u value32 = read_virtual_dword(i->seg(), esi);
BX_OUTP(DX, value32, 4);
#if BX_SUPPORT_X86_64

View File

@ -1,5 +1,5 @@
////////////////////////////////////////////////////////////////////////
// $Id: iret.cc,v 1.23 2007-11-24 14:22:34 sshwarts Exp $
// $Id: iret.cc,v 1.24 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2005 Stanislav Shwartsman
@ -19,7 +19,7 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
/////////////////////////////////////////////////////////////////////////
#define NEED_CPU_REG_SHORTCUTS 1
#include "bochs.h"
@ -31,7 +31,6 @@
#define RIP EIP
#endif
void BX_CPP_AttrRegparmN(1)
BX_CPU_C::iret_protected(bxInstruction_c *i)
{
@ -112,8 +111,8 @@ BX_CPU_C::iret_protected(bxInstruction_c *i)
/* NT = 0: INTERRUPT RETURN ON STACK -or STACK_RETURN_TO_V86 */
unsigned top_nbytes_same, top_nbytes_outer;
Bit32u new_eip, new_esp, temp_ESP, new_eflags;
Bit16u new_ip, new_flags;
Bit32u new_eip = 0, new_esp, temp_ESP, new_eflags = 0;
Bit16u new_ip = 0, new_flags = 0;
Bit32u ss_offset;
/* 16bit opsize | 32bit opsize
@ -149,9 +148,9 @@ BX_CPU_C::iret_protected(bxInstruction_c *i)
temp_ESP = SP;
if (i->os32L()) {
read_virtual_word (BX_SEG_REG_SS, temp_ESP + 4, &raw_cs_selector);
read_virtual_dword(BX_SEG_REG_SS, temp_ESP + 0, &new_eip);
read_virtual_dword(BX_SEG_REG_SS, temp_ESP + 8, &new_eflags);
raw_cs_selector = read_virtual_word (BX_SEG_REG_SS, temp_ESP + 4);
new_eip = read_virtual_dword(BX_SEG_REG_SS, temp_ESP + 0);
new_eflags = read_virtual_dword(BX_SEG_REG_SS, temp_ESP + 8);
// if VM=1 in flags image on stack then STACK_RETURN_TO_V86
if (new_eflags & EFlagsVMMask) {
@ -163,15 +162,15 @@ BX_CPU_C::iret_protected(bxInstruction_c *i)
}
}
else {
read_virtual_word(BX_SEG_REG_SS, temp_ESP + 2, &raw_cs_selector);
read_virtual_word(BX_SEG_REG_SS, temp_ESP + 0, &new_ip);
read_virtual_word(BX_SEG_REG_SS, temp_ESP + 4, &new_flags);
raw_cs_selector = read_virtual_word(BX_SEG_REG_SS, temp_ESP + 2);
new_ip = read_virtual_word(BX_SEG_REG_SS, temp_ESP + 0);
new_flags = read_virtual_word(BX_SEG_REG_SS, temp_ESP + 4);
}
parse_selector(raw_cs_selector, &cs_selector);
// return CS selector must be non-null, else #GP(0)
if ( (raw_cs_selector & 0xfffc) == 0 ) {
if ((raw_cs_selector & 0xfffc) == 0) {
BX_ERROR(("iret: return CS selector null"));
exception(BX_GP_EXCEPTION, 0, 0);
}
@ -218,7 +217,7 @@ BX_CPU_C::iret_protected(bxInstruction_c *i)
branch_far32(&cs_selector, &cs_descriptor, (Bit32u) new_ip, cs_selector.rpl);
/* load flags with third word on stack */
write_flags(new_flags, CPL==0, CPL<=BX_CPU_THIS_PTR get_IOPL ());
write_flags(new_flags, CPL==0, CPL<=BX_CPU_THIS_PTR get_IOPL());
}
/* increment stack by 6/12 */
@ -245,7 +244,7 @@ BX_CPU_C::iret_protected(bxInstruction_c *i)
}
/* examine return SS selector and associated descriptor */
read_virtual_word(BX_SEG_REG_SS, temp_ESP + ss_offset, &raw_ss_selector);
raw_ss_selector = read_virtual_word(BX_SEG_REG_SS, temp_ESP + ss_offset);
/* selector must be non-null, else #GP(0) */
if ( (raw_ss_selector & 0xfffc) == 0 ) {
@ -292,20 +291,14 @@ BX_CPU_C::iret_protected(bxInstruction_c *i)
}
if (i->os32L()) {
read_virtual_dword(BX_SEG_REG_SS, temp_ESP + 0, &new_eip);
read_virtual_dword(BX_SEG_REG_SS, temp_ESP + 8, &new_eflags);
read_virtual_dword(BX_SEG_REG_SS, temp_ESP + 12, &new_esp);
new_eip = read_virtual_dword(BX_SEG_REG_SS, temp_ESP + 0);
new_eflags = read_virtual_dword(BX_SEG_REG_SS, temp_ESP + 8);
new_esp = read_virtual_dword(BX_SEG_REG_SS, temp_ESP + 12);
}
else {
Bit16u new_sp = 0;
read_virtual_word(BX_SEG_REG_SS, temp_ESP + 0, &new_ip);
read_virtual_word(BX_SEG_REG_SS, temp_ESP + 4, &new_flags);
read_virtual_word(BX_SEG_REG_SS, temp_ESP + 6, &new_sp);
new_eip = new_ip;
new_esp = new_sp;
new_eflags = new_flags;
new_eip = read_virtual_word(BX_SEG_REG_SS, temp_ESP + 0);
new_eflags = read_virtual_word(BX_SEG_REG_SS, temp_ESP + 4);
new_esp = read_virtual_word(BX_SEG_REG_SS, temp_ESP + 6);
}
Bit8u prev_cpl = CPL; /* previous CPL */
@ -386,9 +379,9 @@ BX_CPU_C::long_iret(bxInstruction_c *i)
if (i->os64L()) {
Bit64u new_rflags = 0;
read_virtual_word (BX_SEG_REG_SS, temp_RSP + 8, &raw_cs_selector);
read_virtual_qword(BX_SEG_REG_SS, temp_RSP + 0, &new_rip);
read_virtual_qword(BX_SEG_REG_SS, temp_RSP + 16, &new_rflags);
raw_cs_selector = read_virtual_word (BX_SEG_REG_SS, temp_RSP + 8);
new_rip = read_virtual_qword(BX_SEG_REG_SS, temp_RSP + 0);
new_rflags = read_virtual_qword(BX_SEG_REG_SS, temp_RSP + 16);
new_eflags = (Bit32u) new_rflags;
top_nbytes_outer = 40;
@ -401,13 +394,10 @@ BX_CPU_C::long_iret(bxInstruction_c *i)
exception(BX_SS_EXCEPTION, 0, 0);
}
Bit32u return_EIP = 0;
raw_cs_selector = read_virtual_word (BX_SEG_REG_SS, temp_RSP + 4);
new_rip = (Bit64u) read_virtual_dword(BX_SEG_REG_SS, temp_RSP + 0);
new_eflags = read_virtual_dword(BX_SEG_REG_SS, temp_RSP + 8);
read_virtual_word (BX_SEG_REG_SS, temp_RSP + 4, &raw_cs_selector);
read_virtual_dword(BX_SEG_REG_SS, temp_RSP + 0, &return_EIP);
read_virtual_dword(BX_SEG_REG_SS, temp_RSP + 8, &new_eflags);
new_rip = return_EIP;
top_nbytes_outer = 20;
top_nbytes_same = 12;
ss_offset = 16;
@ -419,14 +409,10 @@ BX_CPU_C::long_iret(bxInstruction_c *i)
exception(BX_SS_EXCEPTION, 0, 0);
}
Bit16u return_IP = 0, new_flags = 0;
raw_cs_selector = read_virtual_word(BX_SEG_REG_SS, temp_RSP + 2);
new_rip = (Bit64u) read_virtual_word(BX_SEG_REG_SS, temp_RSP + 0);
new_eflags = read_virtual_word(BX_SEG_REG_SS, temp_RSP + 4);
read_virtual_word(BX_SEG_REG_SS, temp_RSP + 2, &raw_cs_selector);
read_virtual_word(BX_SEG_REG_SS, temp_RSP + 0, &return_IP);
read_virtual_word(BX_SEG_REG_SS, temp_RSP + 4, &new_flags);
new_rip = return_IP;
new_eflags = (Bit32u) new_flags;
top_nbytes_outer = 10;
top_nbytes_same = 6;
ss_offset = 8;
@ -506,7 +492,7 @@ BX_CPU_C::long_iret(bxInstruction_c *i)
}
/* examine return SS selector and associated descriptor */
read_virtual_word(BX_SEG_REG_SS, temp_RSP + ss_offset, &raw_ss_selector);
raw_ss_selector = read_virtual_word(BX_SEG_REG_SS, temp_RSP + ss_offset);
if ((raw_ss_selector & 0xfffc) == 0) {
if (! IS_LONG64_SEGMENT(cs_descriptor) || (cs_selector.rpl == 3)) {
@ -554,17 +540,13 @@ BX_CPU_C::long_iret(bxInstruction_c *i)
}
if (i->os64L()) {
read_virtual_qword(BX_SEG_REG_SS, temp_RSP + 24, &new_rsp);
new_rsp = read_virtual_qword(BX_SEG_REG_SS, temp_RSP + 24);
}
else if (i->os32L()) {
Bit32u return_ESP = 0;
read_virtual_dword(BX_SEG_REG_SS, temp_RSP + 12, &return_ESP);
new_rsp = return_ESP;
new_rsp = (Bit64u) read_virtual_dword(BX_SEG_REG_SS, temp_RSP + 12);
}
else {
Bit16u return_SP = 0;
read_virtual_word(BX_SEG_REG_SS, temp_RSP + 6, &return_SP);
new_rsp = return_SP;
new_rsp = (Bit64u) read_virtual_word(BX_SEG_REG_SS, temp_RSP + 6);
}
Bit8u prev_cpl = CPL; /* previous CPL */

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: logical16.cc,v 1.35 2007-11-21 22:36:01 sshwarts Exp $
// $Id: logical16.cc,v 1.36 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -34,7 +34,7 @@ void BX_CPU_C::XOR_EwGwM(bxInstruction_c *i)
{
Bit16u op1_16, op2_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op2_16 = BX_READ_16BIT_REG(i->nnn());
op1_16 ^= op2_16;
write_RMW_virtual_word(op1_16);
@ -57,7 +57,7 @@ void BX_CPU_C::XOR_GwEwM(bxInstruction_c *i)
Bit16u op1_16, op2_16;
op1_16 = BX_READ_16BIT_REG(i->nnn());
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
op2_16 = read_virtual_word(i->seg(), RMAddr(i));
op1_16 ^= op2_16;
BX_WRITE_16BIT_REG(i->nnn(), op1_16);
@ -91,7 +91,7 @@ void BX_CPU_C::XOR_EwIwM(bxInstruction_c *i)
{
Bit16u op1_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op1_16 ^= i->Iw();
write_RMW_virtual_word(op1_16);
@ -111,7 +111,7 @@ void BX_CPU_C::OR_EwIwM(bxInstruction_c *i)
{
Bit16u op1_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op1_16 |= i->Iw();
write_RMW_virtual_word(op1_16);
@ -131,7 +131,7 @@ void BX_CPU_C::NOT_EwM(bxInstruction_c *i)
{
Bit16u op1_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op1_16 = ~op1_16;
write_RMW_virtual_word(op1_16);
}
@ -147,7 +147,7 @@ void BX_CPU_C::OR_EwGwM(bxInstruction_c *i)
{
Bit16u op1_16, op2_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op2_16 = BX_READ_16BIT_REG(i->nnn());
op1_16 |= op2_16;
write_RMW_virtual_word(op1_16);
@ -172,7 +172,7 @@ void BX_CPU_C::OR_GwEwM(bxInstruction_c *i)
Bit16u op1_16, op2_16;
op1_16 = BX_READ_16BIT_REG(i->nnn());
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
op2_16 = read_virtual_word(i->seg(), RMAddr(i));
op1_16 |= op2_16;
BX_WRITE_16BIT_REG(i->nnn(), op1_16);
@ -207,7 +207,7 @@ void BX_CPU_C::AND_EwGwM(bxInstruction_c *i)
{
Bit16u op1_16, op2_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op2_16 = BX_READ_16BIT_REG(i->nnn());
op1_16 &= op2_16;
write_RMW_virtual_word(op1_16);
@ -232,7 +232,7 @@ void BX_CPU_C::AND_GwEwM(bxInstruction_c *i)
Bit16u op1_16, op2_16;
op1_16 = BX_READ_16BIT_REG(i->nnn());
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
op2_16 = read_virtual_word(i->seg(), RMAddr(i));
op1_16 &= op2_16;
BX_WRITE_16BIT_REG(i->nnn(), op1_16);
@ -267,7 +267,7 @@ void BX_CPU_C::AND_EwIwM(bxInstruction_c *i)
{
Bit16u op1_16;
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
op1_16 &= i->Iw();
write_RMW_virtual_word(op1_16);
@ -287,7 +287,7 @@ void BX_CPU_C::TEST_EwGwM(bxInstruction_c *i)
{
Bit16u op1_16, op2_16;
read_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_virtual_word(i->seg(), RMAddr(i));
op2_16 = BX_READ_16BIT_REG(i->nnn());
op1_16 &= op2_16;
SET_FLAGS_OSZAPC_LOGIC_16(op1_16);
@ -316,11 +316,8 @@ void BX_CPU_C::TEST_AXIw(bxInstruction_c *i)
void BX_CPU_C::TEST_EwIwM(bxInstruction_c *i)
{
Bit16u op1_16;
read_virtual_word(i->seg(), RMAddr(i), &op1_16);
Bit16u op1_16 = read_virtual_word(i->seg(), RMAddr(i));
op1_16 &= i->Iw();
SET_FLAGS_OSZAPC_LOGIC_16(op1_16);
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: logical32.cc,v 1.36 2007-11-21 22:36:01 sshwarts Exp $
// $Id: logical32.cc,v 1.37 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -39,7 +39,7 @@ void BX_CPU_C::XOR_EdGdM(bxInstruction_c *i)
{
Bit32u op1_32, op2_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op2_32 = BX_READ_32BIT_REG(i->nnn());
op1_32 ^= op2_32;
write_RMW_virtual_dword(op1_32);
@ -64,7 +64,7 @@ void BX_CPU_C::XOR_GdEdM(bxInstruction_c *i)
Bit32u op1_32, op2_32;
op1_32 = BX_READ_32BIT_REG(i->nnn());
read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
op2_32 = read_virtual_dword(i->seg(), RMAddr(i));
op1_32 ^= op2_32;
BX_WRITE_32BIT_REGZ(i->nnn(), op1_32);
@ -98,7 +98,7 @@ void BX_CPU_C::XOR_EdIdM(bxInstruction_c *i)
{
Bit32u op1_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op1_32 ^= i->Id();
write_RMW_virtual_dword(op1_32);
@ -118,7 +118,7 @@ void BX_CPU_C::OR_EdIdM(bxInstruction_c *i)
{
Bit32u op1_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op1_32 |= i->Id();
write_RMW_virtual_dword(op1_32);
@ -138,7 +138,7 @@ void BX_CPU_C::NOT_EdM(bxInstruction_c *i)
{
Bit32u op1_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op1_32 = ~op1_32;
write_RMW_virtual_dword(op1_32);
}
@ -154,7 +154,7 @@ void BX_CPU_C::OR_EdGdM(bxInstruction_c *i)
{
Bit32u op1_32, op2_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op2_32 = BX_READ_32BIT_REG(i->nnn());
op1_32 |= op2_32;
write_RMW_virtual_dword(op1_32);
@ -179,7 +179,7 @@ void BX_CPU_C::OR_GdEdM(bxInstruction_c *i)
Bit32u op1_32, op2_32;
op1_32 = BX_READ_32BIT_REG(i->nnn());
read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
op2_32 = read_virtual_dword(i->seg(), RMAddr(i));
op1_32 |= op2_32;
BX_WRITE_32BIT_REGZ(i->nnn(), op1_32);
@ -214,7 +214,7 @@ void BX_CPU_C::AND_EdGdM(bxInstruction_c *i)
{
Bit32u op1_32, op2_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op2_32 = BX_READ_32BIT_REG(i->nnn());
op1_32 &= op2_32;
write_RMW_virtual_dword(op1_32);
@ -239,7 +239,7 @@ void BX_CPU_C::AND_GdEdM(bxInstruction_c *i)
Bit32u op1_32, op2_32;
op1_32 = BX_READ_32BIT_REG(i->nnn());
read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
op2_32 = read_virtual_dword(i->seg(), RMAddr(i));
op1_32 &= op2_32;
BX_WRITE_32BIT_REGZ(i->nnn(), op1_32);
@ -274,7 +274,7 @@ void BX_CPU_C::AND_EdIdM(bxInstruction_c *i)
{
Bit32u op1_32;
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
op1_32 &= i->Id();
write_RMW_virtual_dword(op1_32);
@ -294,7 +294,7 @@ void BX_CPU_C::TEST_EdGdM(bxInstruction_c *i)
{
Bit32u op1_32, op2_32;
read_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_virtual_dword(i->seg(), RMAddr(i));
op2_32 = BX_READ_32BIT_REG(i->nnn());
op1_32 &= op2_32;
@ -325,11 +325,8 @@ void BX_CPU_C::TEST_EAXId(bxInstruction_c *i)
void BX_CPU_C::TEST_EdIdM(bxInstruction_c *i)
{
Bit32u op1_32;
read_virtual_dword(i->seg(), RMAddr(i), &op1_32);
Bit32u op1_32 = read_virtual_dword(i->seg(), RMAddr(i));
op1_32 &= i->Id();
SET_FLAGS_OSZAPC_LOGIC_32(op1_32);
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: logical64.cc,v 1.24 2007-11-21 22:36:02 sshwarts Exp $
// $Id: logical64.cc,v 1.25 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -36,8 +36,7 @@ void BX_CPU_C::XOR_EqGqM(bxInstruction_c *i)
{
Bit64u op1_64, op2_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op2_64 = BX_READ_64BIT_REG(i->nnn());
op1_64 ^= op2_64;
write_RMW_virtual_qword(op1_64);
@ -62,7 +61,7 @@ void BX_CPU_C::XOR_GqEqM(bxInstruction_c *i)
Bit64u op1_64, op2_64;
op1_64 = BX_READ_64BIT_REG(i->nnn());
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
op1_64 ^= op2_64;
/* now write result back to destination */
@ -102,8 +101,7 @@ void BX_CPU_C::XOR_EqIdM(bxInstruction_c *i)
{
Bit64u op1_64, op2_64 = (Bit32s) i->Id();
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op1_64 ^= op2_64;
write_RMW_virtual_qword(op1_64);
@ -125,8 +123,7 @@ void BX_CPU_C::OR_EqIdM(bxInstruction_c *i)
{
Bit64u op1_64, op2_64 = (Bit32s) i->Id();
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op1_64 |= op2_64;
write_RMW_virtual_qword(op1_64);
@ -148,8 +145,7 @@ void BX_CPU_C::NOT_EqM(bxInstruction_c *i)
{
Bit64u op1_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op1_64 = ~op1_64;
write_RMW_virtual_qword(op1_64);
}
@ -165,8 +161,7 @@ void BX_CPU_C::OR_EqGqM(bxInstruction_c *i)
{
Bit64u op1_64, op2_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op2_64 = BX_READ_64BIT_REG(i->nnn());
op1_64 |= op2_64;
write_RMW_virtual_qword(op1_64);
@ -191,7 +186,7 @@ void BX_CPU_C::OR_GqEqM(bxInstruction_c *i)
Bit64u op1_64, op2_64;
op1_64 = BX_READ_64BIT_REG(i->nnn());
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
op1_64 |= op2_64;
/* now write result back to destination */
@ -231,8 +226,7 @@ void BX_CPU_C::AND_EqGqM(bxInstruction_c *i)
{
Bit64u op1_64, op2_64;
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op2_64 = BX_READ_64BIT_REG(i->nnn());
op1_64 &= op2_64;
write_RMW_virtual_qword(op1_64);
@ -257,7 +251,7 @@ void BX_CPU_C::AND_GqEqM(bxInstruction_c *i)
Bit64u op1_64, op2_64;
op1_64 = BX_READ_64BIT_REG(i->nnn());
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
op1_64 &= op2_64;
/* now write result back to destination */
@ -296,8 +290,7 @@ void BX_CPU_C::AND_EqIdM(bxInstruction_c *i)
{
Bit64u op1_64, op2_64 = (Bit32s) i->Id();
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
op1_64 &= op2_64;
write_RMW_virtual_qword(op1_64);
@ -319,8 +312,7 @@ void BX_CPU_C::TEST_EqGqM(bxInstruction_c *i)
{
Bit64u op1_64, op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_virtual_qword(i->seg(), RMAddr(i));
op2_64 = BX_READ_64BIT_REG(i->nnn());
op1_64 &= op2_64;
@ -353,8 +345,7 @@ void BX_CPU_C::TEST_EqIdM(bxInstruction_c *i)
{
Bit64u op1_64, op2_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_virtual_qword(i->seg(), RMAddr(i));
op2_64 = (Bit32s) i->Id();
op1_64 &= op2_64;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: logical8.cc,v 1.35 2007-11-21 22:36:02 sshwarts Exp $
// $Id: logical8.cc,v 1.36 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -36,7 +36,7 @@ void BX_CPU_C::XOR_EbGbM(bxInstruction_c *i)
{
Bit8u op1, op2;
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1);
op1 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op2 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
op1 ^= op2;
write_RMW_virtual_byte(op1);
@ -61,7 +61,7 @@ void BX_CPU_C::XOR_GbEbM(bxInstruction_c *i)
Bit8u op1, op2;
op1 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
read_virtual_byte(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_byte(i->seg(), RMAddr(i));
op1 ^= op2;
BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), op1);
@ -95,7 +95,7 @@ void BX_CPU_C::XOR_EbIbM(bxInstruction_c *i)
{
Bit8u op1, op2 = i->Ib();
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1);
op1 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op1 ^= op2;
write_RMW_virtual_byte(op1);
@ -117,7 +117,7 @@ void BX_CPU_C::OR_EbIbM(bxInstruction_c *i)
{
Bit8u op1, op2 = i->Ib();
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1);
op1 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op1 |= op2;
write_RMW_virtual_byte(op1);
@ -139,7 +139,7 @@ void BX_CPU_C::NOT_EbM(bxInstruction_c *i)
{
Bit8u op1_8;
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op1_8 = ~op1_8;
write_RMW_virtual_byte(op1_8);
}
@ -155,7 +155,7 @@ void BX_CPU_C::OR_EbGbM(bxInstruction_c *i)
{
Bit8u op1, op2;
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1);
op1 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op2 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
op1 |= op2;
write_RMW_virtual_byte(op1);
@ -180,7 +180,7 @@ void BX_CPU_C::OR_GbEbM(bxInstruction_c *i)
Bit8u op1, op2;
op1 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
read_virtual_byte(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_byte(i->seg(), RMAddr(i));
op1 |= op2;
BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), op1);
@ -215,7 +215,7 @@ void BX_CPU_C::AND_EbGbM(bxInstruction_c *i)
{
Bit8u op1, op2;
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1);
op1 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op2 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
op1 &= op2;
write_RMW_virtual_byte(op1);
@ -240,7 +240,7 @@ void BX_CPU_C::AND_GbEbM(bxInstruction_c *i)
Bit8u op1, op2;
op1 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
read_virtual_byte(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_byte(i->seg(), RMAddr(i));
op1 &= op2;
BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), op1);
@ -275,7 +275,7 @@ void BX_CPU_C::AND_EbIbM(bxInstruction_c *i)
{
Bit8u op1, op2 = i->Ib();
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1);
op1 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
op1 &= op2;
write_RMW_virtual_byte(op1);
@ -297,7 +297,7 @@ void BX_CPU_C::TEST_EbGbM(bxInstruction_c *i)
{
Bit8u op1, op2;
read_virtual_byte(i->seg(), RMAddr(i), &op1);
op1 = read_virtual_byte(i->seg(), RMAddr(i));
op2 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
op1 &= op2;
@ -317,8 +317,10 @@ void BX_CPU_C::TEST_EbGbR(bxInstruction_c *i)
void BX_CPU_C::TEST_ALIb(bxInstruction_c *i)
{
Bit8u op1 = AL;
Bit8u op2 = i->Ib();
Bit8u op1, op2;
op1 = AL;
op2 = i->Ib();
op1 &= op2;
SET_FLAGS_OSZAPC_LOGIC_8(op1);
@ -326,11 +328,8 @@ void BX_CPU_C::TEST_ALIb(bxInstruction_c *i)
void BX_CPU_C::TEST_EbIbM(bxInstruction_c *i)
{
Bit8u op1;
read_virtual_byte(i->seg(), RMAddr(i), &op1);
Bit8u op1 = read_virtual_byte(i->seg(), RMAddr(i));
op1 &= i->Ib();
SET_FLAGS_OSZAPC_LOGIC_8(op1);
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: mmx.cc,v 1.67 2007-12-20 18:29:38 sshwarts Exp $
// $Id: mmx.cc,v 1.68 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2002 Stanislav Shwartsman
@ -131,7 +131,7 @@ void BX_CPU_C::PSHUFB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
for(unsigned j=0; j<8; j++)
@ -164,7 +164,7 @@ void BX_CPU_C::PHADDW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUW0(result) = MMXUW0(op1) + MMXUW1(op1);
@ -193,7 +193,7 @@ void BX_CPU_C::PHADDD_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUD0(result) = MMXUD0(op1) + MMXUD1(op1);
@ -220,7 +220,7 @@ void BX_CPU_C::PHADDSW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXSW0(result) = SaturateDwordSToWordS(Bit32s(MMXSW0(op1)) + Bit32s(MMXSW1(op1)));
@ -250,7 +250,7 @@ void BX_CPU_C::PMADDUBSW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
for(unsigned j=0; j<4; j++)
@ -283,7 +283,7 @@ void BX_CPU_C::PHSUBSW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXSW0(result) = SaturateDwordSToWordS(Bit32s(MMXSW0(op1)) - Bit32s(MMXSW1(op1)));
@ -313,7 +313,7 @@ void BX_CPU_C::PHSUBW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUW0(result) = MMXUW0(op1) - MMXUW1(op1);
@ -342,7 +342,7 @@ void BX_CPU_C::PHSUBD_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUD0(result) = MMXUD0(op1) - MMXUD1(op1);
@ -369,7 +369,7 @@ void BX_CPU_C::PSIGNB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
for(unsigned j=0; j<8; j++) {
@ -398,7 +398,7 @@ void BX_CPU_C::PSIGNW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
for(unsigned j=0; j<4; j++) {
@ -427,7 +427,7 @@ void BX_CPU_C::PSIGND_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
int sign;
@ -458,7 +458,7 @@ void BX_CPU_C::PMULHRSW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
for(unsigned j=0; j<4; j++) {
@ -492,7 +492,7 @@ void BX_CPU_C::PABSB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op);
MMXUQ(op) = read_virtual_qword(i->seg(), RMAddr(i));
}
if (MMXSB0(op) < 0) MMXUB0(op) = -MMXSB0(op);
@ -525,7 +525,7 @@ void BX_CPU_C::PABSW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op);
MMXUQ(op) = read_virtual_qword(i->seg(), RMAddr(i));
}
if (MMXSW0(op) < 0) MMXUW0(op) = -MMXSW0(op);
@ -554,7 +554,7 @@ void BX_CPU_C::PABSD_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op);
MMXUQ(op) = read_virtual_qword(i->seg(), RMAddr(i));
}
if (MMXSD0(op) < 0) MMXUD0(op) = -MMXSD0(op);
@ -582,7 +582,7 @@ void BX_CPU_C::PALIGNR_PqQqIb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
unsigned shift = i->Ib() * 8;
@ -620,7 +620,7 @@ void BX_CPU_C::PUNPCKLBW_PqQd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUB7(result) = MMXUB3(op2);
@ -654,7 +654,7 @@ void BX_CPU_C::PUNPCKLWD_PqQd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUW3(result) = MMXUW1(op2);
@ -684,7 +684,7 @@ void BX_CPU_C::PUNPCKLDQ_PqQd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUD1(op1) = MMXUD0(op2);
@ -711,7 +711,7 @@ void BX_CPU_C::PACKSSWB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXSB0(result) = SaturateWordSToByteS(MMXSW0(op1));
@ -745,7 +745,7 @@ void BX_CPU_C::PCMPGTB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUB0(op1) = (MMXSB0(op1) > MMXSB0(op2)) ? 0xff : 0;
@ -779,7 +779,7 @@ void BX_CPU_C::PCMPGTW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUW0(op1) = (MMXSW0(op1) > MMXSW0(op2)) ? 0xffff : 0;
@ -809,7 +809,7 @@ void BX_CPU_C::PCMPGTD_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUD0(op1) = (MMXSD0(op1) > MMXSD0(op2)) ? 0xffffffff : 0;
@ -837,7 +837,7 @@ void BX_CPU_C::PACKUSWB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUB0(result) = SaturateWordSToByteU(MMXSW0(op1));
@ -871,7 +871,7 @@ void BX_CPU_C::PUNPCKHBW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUB7(result) = MMXUB7(op2);
@ -905,7 +905,7 @@ void BX_CPU_C::PUNPCKHWD_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUW3(result) = MMXUW3(op2);
@ -935,7 +935,7 @@ void BX_CPU_C::PUNPCKHDQ_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUD1(result) = MMXUD1(op2);
@ -963,7 +963,7 @@ void BX_CPU_C::PACKSSDW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXSW0(result) = SaturateDwordSToWordS(MMXSD0(op1));
@ -995,7 +995,7 @@ void BX_CPU_C::MOVD_PqEd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &(MMXUD0(op)));
MMXUD0(op) = read_virtual_dword(i->seg(), RMAddr(i));
}
/* now write result back to destination */
@ -1021,7 +1021,7 @@ void BX_CPU_C::MOVQ_PqEq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &(MMXUQ(op)));
MMXUQ(op) = read_virtual_qword(i->seg(), RMAddr(i));
}
/* now write result back to destination */
@ -1044,7 +1044,7 @@ void BX_CPU_C::MOVQ_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op);
MMXUQ(op) = read_virtual_qword(i->seg(), RMAddr(i));
}
/* now write result back to destination */
@ -1070,7 +1070,7 @@ void BX_CPU_C::PSHUFW_PqQqIb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op);
MMXUQ(op) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUW0(result) = op.mmx16u((order) & 0x3);
@ -1100,7 +1100,7 @@ void BX_CPU_C::PCMPEQB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUB0(op1) = (MMXUB0(op1) == MMXUB0(op2)) ? 0xff : 0;
@ -1134,7 +1134,7 @@ void BX_CPU_C::PCMPEQW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUW0(op1) = (MMXUW0(op1) == MMXUW0(op2)) ? 0xffff : 0;
@ -1164,7 +1164,7 @@ void BX_CPU_C::PCMPEQD_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUD0(op1) = (MMXUD0(op1) == MMXUD0(op2)) ? 0xffffffff : 0;
@ -1268,7 +1268,7 @@ void BX_CPU_C::PINSRW_PqEwIb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_word(i->seg(), RMAddr(i));
}
op1.xmm16u(i->Ib() & 0x3) = op2;
@ -1311,7 +1311,7 @@ void BX_CPU_C::PSRLW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
if(MMXUQ(op2) > 15) MMXUQ(op1) = 0;
@ -1347,7 +1347,7 @@ void BX_CPU_C::PSRLD_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
if(MMXUQ(op2) > 31) MMXUQ(op1) = 0;
@ -1381,7 +1381,7 @@ void BX_CPU_C::PSRLQ_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
if(MMXUQ(op2) > 63) {
@ -1413,7 +1413,7 @@ void BX_CPU_C::PADDQ_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUQ(op1) += MMXUQ(op2);
@ -1440,7 +1440,7 @@ void BX_CPU_C::PMULLW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
Bit32u product1 = Bit32u(MMXUW0(op1)) * Bit32u(MMXUW0(op2));
@ -1502,7 +1502,7 @@ void BX_CPU_C::PSUBUSB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUQ(result) = 0;
@ -1538,7 +1538,7 @@ void BX_CPU_C::PSUBUSW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUQ(result) = 0;
@ -1570,7 +1570,7 @@ void BX_CPU_C::PMINUB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
if(MMXUB0(op2) < MMXUB0(op1)) MMXUB0(op1) = MMXUB0(op2);
@ -1604,7 +1604,7 @@ void BX_CPU_C::PAND_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUQ(op1) &= MMXUQ(op2);
@ -1631,7 +1631,7 @@ void BX_CPU_C::PADDUSB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUB0(result) = SaturateWordSToByteU(Bit16s(MMXUB0(op1)) + Bit16s(MMXUB0(op2)));
@ -1665,7 +1665,7 @@ void BX_CPU_C::PADDUSW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUW0(result) = SaturateDwordSToWordU(Bit32s(MMXUW0(op1)) + Bit32s(MMXUW0(op2)));
@ -1695,7 +1695,7 @@ void BX_CPU_C::PMAXUB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
if(MMXUB0(op2) > MMXUB0(op1)) MMXUB0(op1) = MMXUB0(op2);
@ -1729,7 +1729,7 @@ void BX_CPU_C::PANDN_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUQ(op1) = ~(MMXUQ(op1)) & MMXUQ(op2);
@ -1756,7 +1756,7 @@ void BX_CPU_C::PAVGB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUB0(op1) = (MMXUB0(op1) + MMXUB0(op2) + 1) >> 1;
@ -1790,7 +1790,7 @@ void BX_CPU_C::PSRAW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
if(!MMXUQ(op2)) return;
@ -1837,7 +1837,7 @@ void BX_CPU_C::PSRAD_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
if(!MMXUQ(op2)) return;
@ -1881,7 +1881,7 @@ void BX_CPU_C::PAVGW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUW0(op1) = (MMXUW0(op1) + MMXUW0(op2) + 1) >> 1;
@ -1911,7 +1911,7 @@ void BX_CPU_C::PMULHUW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
Bit32u product1 = Bit32u(MMXUW0(op1)) * Bit32u(MMXUW0(op2));
@ -1946,7 +1946,7 @@ void BX_CPU_C::PMULHW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
Bit32s product1 = Bit32s(MMXSW0(op1)) * Bit32s(MMXSW0(op2));
@ -1994,7 +1994,7 @@ void BX_CPU_C::PSUBSB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXSB0(result) = SaturateWordSToByteS(Bit16s(MMXSB0(op1)) - Bit16s(MMXSB0(op2)));
@ -2028,7 +2028,7 @@ void BX_CPU_C::PSUBSW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXSW0(result) = SaturateDwordSToWordS(Bit32s(MMXSW0(op1)) - Bit32s(MMXSW0(op2)));
@ -2058,7 +2058,7 @@ void BX_CPU_C::PMINSW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
if(MMXSW0(op2) < MMXSW0(op1)) MMXSW0(op1) = MMXSW0(op2);
@ -2088,7 +2088,7 @@ void BX_CPU_C::POR_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUQ(op1) |= MMXUQ(op2);
@ -2115,7 +2115,7 @@ void BX_CPU_C::PADDSB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXSB0(result) = SaturateWordSToByteS(Bit16s(MMXSB0(op1)) + Bit16s(MMXSB0(op2)));
@ -2149,7 +2149,7 @@ void BX_CPU_C::PADDSW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXSW0(result) = SaturateDwordSToWordS(Bit32s(MMXSW0(op1)) + Bit32s(MMXSW0(op2)));
@ -2179,7 +2179,7 @@ void BX_CPU_C::PMAXSW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
if(MMXSW0(op2) > MMXSW0(op1)) MMXSW0(op1) = MMXSW0(op2);
@ -2209,7 +2209,7 @@ void BX_CPU_C::PXOR_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUQ(op1) ^= MMXUQ(op2);
@ -2236,7 +2236,7 @@ void BX_CPU_C::PSLLW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
if(MMXUQ(op2) > 15) MMXUQ(op1) = 0;
@ -2272,7 +2272,7 @@ void BX_CPU_C::PSLLD_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
if(MMXUQ(op2) > 31) MMXUQ(op1) = 0;
@ -2306,7 +2306,7 @@ void BX_CPU_C::PSLLQ_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
if(MMXUQ(op2) > 63) {
@ -2338,7 +2338,7 @@ void BX_CPU_C::PMULUDQ_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUQ(result) = Bit64u(MMXUD0(op1)) * Bit64u(MMXUD0(op2));
@ -2365,7 +2365,7 @@ void BX_CPU_C::PMADDWD_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
if(MMXUD0(op1) == 0x80008000 && MMXUD0(op2) == 0x80008000) {
@ -2405,7 +2405,7 @@ void BX_CPU_C::PSADBW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
temp += abs(MMXUB0(op1) - MMXUB0(op2));
@ -2453,7 +2453,7 @@ void BX_CPU_C::MASKMOVQ_PqPRq(bxInstruction_c *i)
if (MMXUQ(mask) == 0) return;
/* do read-modify-write for efficiency */
read_RMW_virtual_qword(BX_SEG_REG_DS, rdi, (Bit64u *) &tmp);
MMXUQ(tmp) = read_RMW_virtual_qword(BX_SEG_REG_DS, rdi);
if(MMXUB0(mask) & 0x80) MMXUB0(tmp) = MMXUB0(op);
if(MMXUB1(mask) & 0x80) MMXUB1(tmp) = MMXUB1(op);
@ -2485,7 +2485,7 @@ void BX_CPU_C::PSUBB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUB0(op1) -= MMXUB0(op2);
@ -2519,7 +2519,7 @@ void BX_CPU_C::PSUBW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUW0(op1) -= MMXUW0(op2);
@ -2549,7 +2549,7 @@ void BX_CPU_C::PSUBD_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUD0(op1) -= MMXUD0(op2);
@ -2577,7 +2577,7 @@ void BX_CPU_C::PSUBQ_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUQ(op1) -= MMXUQ(op2);
@ -2604,7 +2604,7 @@ void BX_CPU_C::PADDB_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUB0(op1) += MMXUB0(op2);
@ -2638,7 +2638,7 @@ void BX_CPU_C::PADDW_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUW0(op1) += MMXUW0(op2);
@ -2668,7 +2668,7 @@ void BX_CPU_C::PADDD_PqQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
MMXUQ(op2) = read_virtual_qword(i->seg(), RMAddr(i));
}
MMXUD0(op1) += MMXUD0(op2);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: mult16.cc,v 1.24 2007-12-06 16:57:59 sshwarts Exp $
// $Id: mult16.cc,v 1.25 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -44,7 +44,7 @@ void BX_CPU_C::MUL_AXEw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
op2_16 = read_virtual_word(i->seg(), RMAddr(i));
}
Bit32u product_32 = ((Bit32u) op1_16) * ((Bit32u) op2_16);
@ -74,7 +74,7 @@ void BX_CPU_C::IMUL_AXEw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), (Bit16u *) &op2_16);
op2_16 = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
}
Bit32s product_32 = ((Bit32s) op1_16) * ((Bit32s) op2_16);
@ -109,7 +109,7 @@ void BX_CPU_C::DIV_AXEw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &op2_16);
op2_16 = read_virtual_word(i->seg(), RMAddr(i));
}
if (op2_16 == 0)
@ -148,7 +148,7 @@ void BX_CPU_C::IDIV_AXEw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), (Bit16u *) &op2_16);
op2_16 = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
}
if (op2_16 == 0)
@ -190,7 +190,7 @@ void BX_CPU_C::IMUL_GwEwIw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), (Bit16u *) &op2_16);
op2_16 = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
}
Bit32s product_32 = op2_16 * op3_16;
@ -220,7 +220,7 @@ void BX_CPU_C::IMUL_GwEw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), (Bit16u *) &op2_16);
op2_16 = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
}
op1_16 = BX_READ_16BIT_REG(i->nnn());

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: mult32.cc,v 1.23 2007-12-06 16:57:59 sshwarts Exp $
// $Id: mult32.cc,v 1.24 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -51,7 +51,7 @@ void BX_CPU_C::MUL_EAXEd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
op2_32 = read_virtual_dword(i->seg(), RMAddr(i));
}
product_64 = ((Bit64u) op1_32) * ((Bit64u) op2_32);
@ -82,7 +82,7 @@ void BX_CPU_C::IMUL_EAXEd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), (Bit32u *) &op2_32);
op2_32 = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
}
Bit64s product_64 = ((Bit64s) op1_32) * ((Bit64s) op2_32);
@ -117,7 +117,7 @@ void BX_CPU_C::DIV_EAXEd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2_32);
op2_32 = read_virtual_dword(i->seg(), RMAddr(i));
}
if (op2_32 == 0) {
@ -155,7 +155,7 @@ void BX_CPU_C::IDIV_EAXEd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), (Bit32u *) &op2_32);
op2_32 = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
}
if (op2_32 == 0)
@ -195,7 +195,7 @@ void BX_CPU_C::IMUL_GdEdId(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), (Bit32u *) &op2_32);
op2_32 = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
}
Bit64s product_64 = ((Bit64s) op2_32) * ((Bit64s) op3_32);
@ -225,7 +225,7 @@ void BX_CPU_C::IMUL_GdEd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), (Bit32u *) &op2_32);
op2_32 = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
}
op1_32 = BX_READ_32BIT_REG(i->nnn());

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: mult64.cc,v 1.21 2007-12-06 16:57:59 sshwarts Exp $
// $Id: mult64.cc,v 1.22 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -219,7 +219,7 @@ void BX_CPU_C::MUL_RAXEq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
}
// product_128 = ((Bit128u) op1_64) * ((Bit128u) op2_64);
@ -253,7 +253,7 @@ void BX_CPU_C::IMUL_RAXEq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2_64);
op2_64 = (Bit64s) read_virtual_qword(i->seg(), RMAddr(i));
}
// product_128 = ((Bit128s) op1_64) * ((Bit128s) op2_64);
@ -293,7 +293,7 @@ void BX_CPU_C::DIV_RAXEq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2_64);
op2_64 = read_virtual_qword(i->seg(), RMAddr(i));
}
if (op2_64 == 0) {
@ -333,7 +333,7 @@ void BX_CPU_C::IDIV_RAXEq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2_64);
op2_64 = (Bit64s) read_virtual_qword(i->seg(), RMAddr(i));
}
if (op2_64 == 0) {
@ -382,7 +382,7 @@ void BX_CPU_C::IMUL_GqEqId(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2_64);
op2_64 = (Bit64s) read_virtual_qword(i->seg(), RMAddr(i));
}
long_imul(&product_128,op2_64,op3_64);
@ -409,7 +409,7 @@ void BX_CPU_C::IMUL_GqEq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2_64);
op2_64 = (Bit64s) read_virtual_qword(i->seg(), RMAddr(i));
}
op1_64 = BX_READ_64BIT_REG(i->nnn());

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: mult8.cc,v 1.24 2007-12-06 16:57:59 sshwarts Exp $
// $Id: mult8.cc,v 1.25 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -44,10 +44,10 @@ void BX_CPU_C::MUL_ALEb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_byte(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_byte(i->seg(), RMAddr(i));
}
Bit32u product_16 = ((Bit16u) op1) * ((Bit16u) op2);
Bit32u product_16 = ((Bit16u) op1) * ((Bit16u) op2);
Bit8u product_8l = (product_16 & 0xFF);
Bit8u product_8h = product_16 >> 8;
@ -75,7 +75,7 @@ void BX_CPU_C::IMUL_ALEb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_byte(i->seg(), RMAddr(i), (Bit8u *) &op2);
op2 = (Bit8s) read_virtual_byte(i->seg(), RMAddr(i));
}
Bit16s product_16 = op1 * op2;
@ -109,7 +109,7 @@ void BX_CPU_C::DIV_ALEb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_byte(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_byte(i->seg(), RMAddr(i));
}
if (op2 == 0) {
@ -151,7 +151,7 @@ void BX_CPU_C::IDIV_ALEb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_byte(i->seg(), RMAddr(i), (Bit8u *) &op2);
op2 = (Bit8s) read_virtual_byte(i->seg(), RMAddr(i));
}
if (op2 == 0)

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.191 2007-12-20 18:29:38 sshwarts Exp $
// $Id: proc_ctrl.cc,v 1.192 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -836,7 +836,7 @@ void BX_CPU_C::LMSW_Ew(bxInstruction_c *i)
msw = BX_READ_16BIT_REG(i->rm());
}
else {
read_virtual_word(i->seg(), RMAddr(i), &msw);
msw = read_virtual_word(i->seg(), RMAddr(i));
}
// LMSW does not affect PG,CD,NW,AM,WP,NE,ET bits, and cannot clear PE

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: protect_ctrl.cc,v 1.67 2007-12-20 18:29:38 sshwarts Exp $
// $Id: protect_ctrl.cc,v 1.68 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -45,7 +45,7 @@ void BX_CPU_C::ARPL_EwGw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
}
op2_16 = BX_READ_16BIT_REG(i->nnn());
@ -84,7 +84,7 @@ void BX_CPU_C::LAR_GvEw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &raw_selector);
raw_selector = read_virtual_word(i->seg(), RMAddr(i));
}
/* if selector null, clear ZF and done */
@ -186,7 +186,7 @@ void BX_CPU_C::LSL_GvEw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &raw_selector);
raw_selector = read_virtual_word(i->seg(), RMAddr(i));
}
/* if selector null, clear ZF and done */
@ -320,7 +320,7 @@ void BX_CPU_C::LLDT_Ew(bxInstruction_c *i)
raw_selector = BX_READ_16BIT_REG(i->rm());
}
else {
read_virtual_word(i->seg(), RMAddr(i), &raw_selector);
raw_selector = read_virtual_word(i->seg(), RMAddr(i));
}
invalidate_prefetch_q();
@ -397,7 +397,7 @@ void BX_CPU_C::LTR_Ew(bxInstruction_c *i)
raw_selector = BX_READ_16BIT_REG(i->rm());
}
else {
read_virtual_word(i->seg(), RMAddr(i), &raw_selector);
raw_selector = read_virtual_word(i->seg(), RMAddr(i));
}
invalidate_prefetch_q();
@ -484,7 +484,7 @@ void BX_CPU_C::VERR_Ew(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &raw_selector);
raw_selector = read_virtual_word(i->seg(), RMAddr(i));
}
/* if selector null, clear ZF and done */
@ -572,7 +572,7 @@ void BX_CPU_C::VERW_Ew(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &raw_selector);
raw_selector = read_virtual_word(i->seg(), RMAddr(i));
}
/* if selector null, clear ZF and done */
@ -659,23 +659,13 @@ void BX_CPU_C::LGDT_Ms(bxInstruction_c *i)
Bit16u limit_16;
Bit32u base_32;
#if BX_CPU_LEVEL >= 3
if (i->os32L()) {
read_virtual_word(i->seg(), RMAddr(i), &limit_16);
read_virtual_dword(i->seg(), RMAddr(i) + 2, &base_32);
limit_16 = read_virtual_word(i->seg(), RMAddr(i));
base_32 = read_virtual_dword(i->seg(), RMAddr(i) + 2);
BX_CPU_THIS_PTR gdtr.limit = limit_16;
BX_CPU_THIS_PTR gdtr.base = base_32;
}
else
#endif
{
read_virtual_word(i->seg(), RMAddr(i), &limit_16);
read_virtual_dword(i->seg(), RMAddr(i) + 2, &base_32);
if (i->os32L() == 0) base_32 &= 0x00ffffff; /* ignore upper 8 bits */
BX_CPU_THIS_PTR gdtr.limit = limit_16;
BX_CPU_THIS_PTR gdtr.base = base_32 & 0x00ffffff; /* ignore upper 8 bits */
}
BX_CPU_THIS_PTR gdtr.limit = limit_16;
BX_CPU_THIS_PTR gdtr.base = base_32;
}
void BX_CPU_C::LIDT_Ms(bxInstruction_c *i)
@ -695,23 +685,13 @@ void BX_CPU_C::LIDT_Ms(bxInstruction_c *i)
Bit16u limit_16;
Bit32u base_32;
#if BX_CPU_LEVEL >= 3
if (i->os32L()) {
read_virtual_word(i->seg(), RMAddr(i), &limit_16);
read_virtual_dword(i->seg(), RMAddr(i) + 2, &base_32);
limit_16 = read_virtual_word(i->seg(), RMAddr(i));
base_32 = read_virtual_dword(i->seg(), RMAddr(i) + 2);
BX_CPU_THIS_PTR idtr.limit = limit_16;
BX_CPU_THIS_PTR idtr.base = base_32;
}
else
#endif
{
read_virtual_word(i->seg(), RMAddr(i), &limit_16);
read_virtual_dword(i->seg(), RMAddr(i) + 2, &base_32);
if (i->os32L() == 0) base_32 &= 0x00ffffff; /* ignore upper 8 bits */
BX_CPU_THIS_PTR idtr.limit = limit_16;
BX_CPU_THIS_PTR idtr.base = base_32 & 0x00ffffff; /* ignore upper 8 bits */
}
BX_CPU_THIS_PTR idtr.limit = limit_16;
BX_CPU_THIS_PTR idtr.base = base_32;
}
#if BX_SUPPORT_X86_64
@ -748,8 +728,8 @@ void BX_CPU_C::LGDT64_Ms(bxInstruction_c *i)
Bit16u limit_16;
Bit64u base_64;
read_virtual_word(i->seg(), RMAddr(i), &limit_16);
read_virtual_qword(i->seg(), RMAddr(i) + 2, &base_64);
limit_16 = read_virtual_word(i->seg(), RMAddr(i));
base_64 = read_virtual_qword(i->seg(), RMAddr(i) + 2);
BX_CPU_THIS_PTR gdtr.limit = limit_16;
BX_CPU_THIS_PTR gdtr.base = base_64;
@ -769,8 +749,8 @@ void BX_CPU_C::LIDT64_Ms(bxInstruction_c *i)
Bit16u limit_16;
Bit64u base_64;
read_virtual_word(i->seg(), RMAddr(i), &limit_16);
read_virtual_qword(i->seg(), RMAddr(i) + 2, &base_64);
limit_16 = read_virtual_word(i->seg(), RMAddr(i));
base_64 = read_virtual_qword(i->seg(), RMAddr(i) + 2);
BX_CPU_THIS_PTR idtr.limit = limit_16;
BX_CPU_THIS_PTR idtr.base = base_64;

View File

@ -1,5 +1,5 @@
////////////////////////////////////////////////////////////////////////
// $Id: ret_far.cc,v 1.11 2007-11-17 23:28:32 sshwarts Exp $
// $Id: ret_far.cc,v 1.12 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2005 Stanislav Shwartsman
@ -66,8 +66,8 @@ BX_CPU_C::return_protected(bxInstruction_c *i, Bit16u pop_bytes)
/* operand size=64: in long mode 1st and 2nd quadword on the stack
must be in canonical address space */
read_virtual_word (BX_SEG_REG_SS, temp_RSP + 8, &raw_cs_selector);
read_virtual_qword(BX_SEG_REG_SS, temp_RSP + 0, &return_RIP);
raw_cs_selector = read_virtual_word (BX_SEG_REG_SS, temp_RSP + 8);
return_RIP = read_virtual_qword(BX_SEG_REG_SS, temp_RSP);
stack_param_offset = 16;
}
@ -82,10 +82,8 @@ BX_CPU_C::return_protected(bxInstruction_c *i, Bit16u pop_bytes)
exception(BX_SS_EXCEPTION, 0, 0);
}
Bit32u return_EIP = 0;
read_virtual_word (BX_SEG_REG_SS, temp_RSP + 4, &raw_cs_selector);
read_virtual_dword(BX_SEG_REG_SS, temp_RSP + 0, &return_EIP);
return_RIP = return_EIP;
raw_cs_selector = read_virtual_word (BX_SEG_REG_SS, temp_RSP + 4);
return_RIP = read_virtual_dword(BX_SEG_REG_SS, temp_RSP);
stack_param_offset = 8;
}
@ -98,10 +96,8 @@ BX_CPU_C::return_protected(bxInstruction_c *i, Bit16u pop_bytes)
exception(BX_SS_EXCEPTION, 0, 0);
}
Bit16u return_IP = 0;
read_virtual_word(BX_SEG_REG_SS, temp_RSP + 2, &raw_cs_selector);
read_virtual_word(BX_SEG_REG_SS, temp_RSP + 0, &return_IP);
return_RIP = return_IP;
raw_cs_selector = read_virtual_word(BX_SEG_REG_SS, temp_RSP + 2);
return_RIP = read_virtual_word(BX_SEG_REG_SS, temp_RSP);
stack_param_offset = 4;
}
@ -176,8 +172,8 @@ BX_CPU_C::return_protected(bxInstruction_c *i, Bit16u pop_bytes)
exception(BX_SS_EXCEPTION, 0, 0);
}
read_virtual_word (BX_SEG_REG_SS, temp_RSP + 24 + pop_bytes, &raw_ss_selector);
read_virtual_qword(BX_SEG_REG_SS, temp_RSP + 16 + pop_bytes, &return_RSP);
raw_ss_selector = read_virtual_word (BX_SEG_REG_SS, temp_RSP + 24 + pop_bytes);
return_RSP = read_virtual_qword(BX_SEG_REG_SS, temp_RSP + 16 + pop_bytes);
}
else
#endif
@ -188,10 +184,8 @@ BX_CPU_C::return_protected(bxInstruction_c *i, Bit16u pop_bytes)
exception(BX_SS_EXCEPTION, 0, 0);
}
Bit32u return_ESP = 0;
read_virtual_word (BX_SEG_REG_SS, temp_RSP + 12 + pop_bytes, &raw_ss_selector);
read_virtual_dword(BX_SEG_REG_SS, temp_RSP + 8 + pop_bytes, &return_ESP);
return_RSP = return_ESP;
raw_ss_selector = read_virtual_word (BX_SEG_REG_SS, temp_RSP + 12 + pop_bytes);
return_RSP = read_virtual_dword(BX_SEG_REG_SS, temp_RSP + 8 + pop_bytes);
}
else {
/* top 8+immediate bytes on stack must be within stack limits, else #SS(0) */
@ -200,10 +194,8 @@ BX_CPU_C::return_protected(bxInstruction_c *i, Bit16u pop_bytes)
exception(BX_SS_EXCEPTION, 0, 0);
}
Bit16u return_SP = 0;
read_virtual_word(BX_SEG_REG_SS, temp_RSP + 6 + pop_bytes, &raw_ss_selector);
read_virtual_word(BX_SEG_REG_SS, temp_RSP + 4 + pop_bytes, &return_SP);
return_RSP = return_SP;
raw_ss_selector = read_virtual_word(BX_SEG_REG_SS, temp_RSP + 6 + pop_bytes);
return_RSP = read_virtual_word(BX_SEG_REG_SS, temp_RSP + 4 + pop_bytes);
}
/* selector index must be within its descriptor table limits,

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: segment_ctrl.cc,v 1.16 2007-11-17 12:44:10 sshwarts Exp $
// $Id: segment_ctrl.cc,v 1.17 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -37,8 +37,8 @@ void BX_CPU_C::LES_GwMp(bxInstruction_c *i)
{
Bit16u reg_16, es;
read_virtual_word(i->seg(), RMAddr(i), &reg_16);
read_virtual_word(i->seg(), RMAddr(i) + 2, &es);
reg_16 = read_virtual_word(i->seg(), RMAddr(i));
es = read_virtual_word(i->seg(), RMAddr(i) + 2);
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES], es);
@ -50,8 +50,8 @@ void BX_CPU_C::LES_GdMp(bxInstruction_c *i)
Bit16u es;
Bit32u reg_32;
read_virtual_dword(i->seg(), RMAddr(i), &reg_32);
read_virtual_word(i->seg(), RMAddr(i) + 4, &es);
reg_32 = read_virtual_dword(i->seg(), RMAddr(i));
es = read_virtual_word (i->seg(), RMAddr(i) + 4);
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES], es);
@ -62,8 +62,8 @@ void BX_CPU_C::LDS_GwMp(bxInstruction_c *i)
{
Bit16u reg_16, ds;
read_virtual_word(i->seg(), RMAddr(i), &reg_16);
read_virtual_word(i->seg(), RMAddr(i) + 2, &ds);
reg_16 = read_virtual_word(i->seg(), RMAddr(i));
ds = read_virtual_word(i->seg(), RMAddr(i) + 2);
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS], ds);
@ -75,8 +75,8 @@ void BX_CPU_C::LDS_GdMp(bxInstruction_c *i)
Bit16u ds;
Bit32u reg_32;
read_virtual_dword(i->seg(), RMAddr(i), &reg_32);
read_virtual_word(i->seg(), RMAddr(i) + 4, &ds);
reg_32 = read_virtual_dword(i->seg(), RMAddr(i));
ds = read_virtual_word (i->seg(), RMAddr(i) + 4);
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS], ds);
@ -87,8 +87,8 @@ void BX_CPU_C::LFS_GwMp(bxInstruction_c *i)
{
Bit16u reg_16, fs;
read_virtual_word(i->seg(), RMAddr(i), &reg_16);
read_virtual_word(i->seg(), RMAddr(i) + 2, &fs);
reg_16 = read_virtual_word(i->seg(), RMAddr(i));
fs = read_virtual_word(i->seg(), RMAddr(i) + 2);
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS], fs);
@ -100,8 +100,8 @@ void BX_CPU_C::LFS_GdMp(bxInstruction_c *i)
Bit32u reg_32;
Bit16u fs;
read_virtual_dword(i->seg(), RMAddr(i), &reg_32);
read_virtual_word(i->seg(), RMAddr(i) + 4, &fs);
reg_32 = read_virtual_dword(i->seg(), RMAddr(i));
fs = read_virtual_word (i->seg(), RMAddr(i) + 4);
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS], fs);
@ -114,8 +114,8 @@ void BX_CPU_C::LFS_GqMp(bxInstruction_c *i)
Bit64u reg_64;
Bit16u fs;
read_virtual_qword(i->seg(), RMAddr(i), &reg_64);
read_virtual_word(i->seg(), RMAddr(i) + 8, &fs);
reg_64 = read_virtual_qword(i->seg(), RMAddr(i));
fs = read_virtual_word (i->seg(), RMAddr(i) + 8);
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS], fs);
@ -127,8 +127,8 @@ void BX_CPU_C::LGS_GwMp(bxInstruction_c *i)
{
Bit16u reg_16, gs;
read_virtual_word(i->seg(), RMAddr(i), &reg_16);
read_virtual_word(i->seg(), RMAddr(i) + 2, &gs);
reg_16 = read_virtual_word(i->seg(), RMAddr(i));
gs = read_virtual_word(i->seg(), RMAddr(i) + 2);
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS], gs);
@ -140,8 +140,8 @@ void BX_CPU_C::LGS_GdMp(bxInstruction_c *i)
Bit32u reg_32;
Bit16u gs;
read_virtual_dword(i->seg(), RMAddr(i), &reg_32);
read_virtual_word(i->seg(), RMAddr(i) + 4, &gs);
reg_32 = read_virtual_dword(i->seg(), RMAddr(i));
gs = read_virtual_word (i->seg(), RMAddr(i) + 4);
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS], gs);
@ -154,8 +154,8 @@ void BX_CPU_C::LGS_GqMp(bxInstruction_c *i)
Bit64u reg_64;
Bit16u gs;
read_virtual_qword(i->seg(), RMAddr(i), &reg_64);
read_virtual_word(i->seg(), RMAddr(i) + 8, &gs);
reg_64 = read_virtual_qword(i->seg(), RMAddr(i));
gs = read_virtual_word (i->seg(), RMAddr(i) + 8);
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS], gs);
@ -167,8 +167,8 @@ void BX_CPU_C::LSS_GwMp(bxInstruction_c *i)
{
Bit16u reg_16, ss;
read_virtual_word(i->seg(), RMAddr(i), &reg_16);
read_virtual_word(i->seg(), RMAddr(i) + 2, &ss);
reg_16 = read_virtual_word(i->seg(), RMAddr(i));
ss = read_virtual_word(i->seg(), RMAddr(i) + 2);
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS], ss);
@ -180,8 +180,8 @@ void BX_CPU_C::LSS_GdMp(bxInstruction_c *i)
Bit32u reg_32;
Bit16u ss;
read_virtual_dword(i->seg(), RMAddr(i), &reg_32);
read_virtual_word(i->seg(), RMAddr(i) + 4, &ss);
reg_32 = read_virtual_dword(i->seg(), RMAddr(i));
ss = read_virtual_word (i->seg(), RMAddr(i) + 4);
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS], ss);
@ -194,8 +194,8 @@ void BX_CPU_C::LSS_GqMp(bxInstruction_c *i)
Bit64u reg_64;
Bit16u ss;
read_virtual_qword(i->seg(), RMAddr(i), &reg_64);
read_virtual_word(i->seg(), RMAddr(i) + 8, &ss);
reg_64 = read_virtual_qword(i->seg(), RMAddr(i));
ss = read_virtual_word (i->seg(), RMAddr(i) + 8);
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS], ss);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: shift16.cc,v 1.38 2007-12-06 20:39:11 sshwarts Exp $
// $Id: shift16.cc,v 1.39 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -53,7 +53,7 @@ void BX_CPU_C::SHLD_EwGw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
}
if (!count) return;
@ -108,7 +108,7 @@ void BX_CPU_C::SHRD_EwGw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
}
if (!count) return;
@ -162,7 +162,7 @@ void BX_CPU_C::ROL_Ew(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
}
if ((count & 0x0f) == 0) {
@ -212,7 +212,7 @@ void BX_CPU_C::ROR_Ew(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
}
if ((count & 0x0f) == 0) {
@ -264,7 +264,7 @@ void BX_CPU_C::RCL_Ew(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
}
if (!count) return;
@ -314,7 +314,7 @@ void BX_CPU_C::RCR_Ew(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
}
if (! count) return;
@ -356,7 +356,7 @@ void BX_CPU_C::SHL_Ew(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
}
if (!count) return;
@ -403,7 +403,7 @@ void BX_CPU_C::SHR_Ew(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
}
if (!count) return;
@ -447,7 +447,7 @@ void BX_CPU_C::SAR_Ew(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
op1_16 = read_RMW_virtual_word(i->seg(), RMAddr(i));
}
if (!count) return;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: shift32.cc,v 1.37 2007-12-06 20:39:11 sshwarts Exp $
// $Id: shift32.cc,v 1.38 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -51,7 +51,7 @@ void BX_CPU_C::SHLD_EdGd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
}
if (!count) return;
@ -94,7 +94,7 @@ void BX_CPU_C::SHRD_EdGd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
}
if (!count) return;
@ -137,7 +137,7 @@ void BX_CPU_C::ROL_Ed(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
}
if (! count) return;
@ -177,7 +177,7 @@ void BX_CPU_C::ROR_Ed(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
}
if (! count) return;
@ -217,7 +217,7 @@ void BX_CPU_C::RCL_Ed(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
}
if (!count) return;
@ -262,7 +262,7 @@ void BX_CPU_C::RCR_Ed(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
}
if (!count) return;
@ -308,7 +308,7 @@ void BX_CPU_C::SHL_Ed(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
}
if (!count) return;
@ -349,7 +349,7 @@ void BX_CPU_C::SHR_Ed(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
}
if (!count) return;
@ -391,7 +391,7 @@ void BX_CPU_C::SAR_Ed(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_dword(i->seg(), RMAddr(i), &op1_32);
op1_32 = read_RMW_virtual_dword(i->seg(), RMAddr(i));
}
if (!count) return;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: shift64.cc,v 1.27 2007-12-06 20:39:11 sshwarts Exp $
// $Id: shift64.cc,v 1.28 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -53,7 +53,7 @@ void BX_CPU_C::SHLD_EqGq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
}
if (!count) return;
@ -96,7 +96,7 @@ void BX_CPU_C::SHRD_EqGq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
}
if (!count) return;
@ -139,7 +139,7 @@ void BX_CPU_C::ROL_Eq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
}
if (! count) return;
@ -179,7 +179,7 @@ void BX_CPU_C::ROR_Eq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
}
if (! count) return;
@ -219,7 +219,7 @@ void BX_CPU_C::RCL_Eq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
}
if (!count) return;
@ -264,7 +264,7 @@ void BX_CPU_C::RCR_Eq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
}
if (!count) return;
@ -309,7 +309,7 @@ void BX_CPU_C::SHL_Eq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
}
if (!count) return;
@ -350,7 +350,7 @@ void BX_CPU_C::SHR_Eq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
}
if (!count) return;
@ -392,7 +392,7 @@ void BX_CPU_C::SAR_Eq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
op1_64 = read_RMW_virtual_qword(i->seg(), RMAddr(i));
}
if (!count) return;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: shift8.cc,v 1.31 2007-12-06 20:39:11 sshwarts Exp $
// $Id: shift8.cc,v 1.32 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -51,7 +51,7 @@ void BX_CPU_C::ROL_Eb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
}
if ((count & 0x07) == 0) {
@ -104,7 +104,7 @@ void BX_CPU_C::ROR_Eb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
}
if ((count & 0x07) == 0) {
@ -160,7 +160,7 @@ void BX_CPU_C::RCL_Eb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
}
if (! count) return;
@ -207,7 +207,7 @@ void BX_CPU_C::RCR_Eb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
}
if (! count) return;
@ -249,7 +249,7 @@ void BX_CPU_C::SHL_Eb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
}
if (!count) return;
@ -296,7 +296,7 @@ void BX_CPU_C::SHR_Eb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
}
if (!count) return;
@ -340,7 +340,7 @@ void BX_CPU_C::SAR_Eb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
op1_8 = read_RMW_virtual_byte(i->seg(), RMAddr(i));
}
if (!count) return;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: soft_int.cc,v 1.35 2007-11-24 14:22:34 sshwarts Exp $
// $Id: soft_int.cc,v 1.36 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -44,8 +44,8 @@ void BX_CPU_C::BOUND_GwMa(bxInstruction_c *i)
Bit16s bound_min, bound_max;
Bit16s op1_16 = BX_READ_16BIT_REG(i->nnn());
read_virtual_word(i->seg(), RMAddr(i), (Bit16u *) &bound_min);
read_virtual_word(i->seg(), RMAddr(i)+2, (Bit16u *) &bound_max);
bound_min = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
bound_max = (Bit16s) read_virtual_word(i->seg(), RMAddr(i)+2);
if (op1_16 < bound_min || op1_16 > bound_max) {
BX_INFO(("BOUND_GdMa: fails bounds test"));
@ -58,8 +58,8 @@ void BX_CPU_C::BOUND_GdMa(bxInstruction_c *i)
Bit32s bound_min, bound_max;
Bit32s op1_32 = BX_READ_32BIT_REG(i->nnn());
read_virtual_dword(i->seg(), RMAddr(i), (Bit32u *) &bound_min);
read_virtual_dword(i->seg(), RMAddr(i)+4, (Bit32u *) &bound_max);
bound_min = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
bound_max = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i)+4);
if (op1_32 < bound_min || op1_32 > bound_max) {
BX_INFO(("BOUND_GdMa: fails bounds test"));

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sse.cc,v 1.52 2007-12-20 18:29:38 sshwarts Exp $
// $Id: sse.cc,v 1.53 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
@ -1297,7 +1297,7 @@ void BX_CPU_C::PINSRB_VdqEbIb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_byte(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_byte(i->seg(), RMAddr(i));
}
op1.xmmubyte(i->Ib() & 0xF) = op2;
@ -1327,7 +1327,7 @@ void BX_CPU_C::INSERTPS_VpsWssIb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_dword(i->seg(), RMAddr(i));
}
op1.xmm32u((control >> 4) & 3) = op2;
@ -1364,7 +1364,7 @@ void BX_CPU_C::PINSRD_VdqEdIb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_qword(i->seg(), RMAddr(i));
}
op1.xmm64u(i->Ib() & 1) = op2;
@ -1380,7 +1380,7 @@ void BX_CPU_C::PINSRD_VdqEdIb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_dword(i->seg(), RMAddr(i));
}
op1.xmm32u(i->Ib() & 3) = op2;
@ -2169,7 +2169,7 @@ void BX_CPU_C::PINSRW_VdqEwIb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_word(i->seg(), RMAddr(i));
}
op1.xmm16u(count) = op2;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sse_move.cc,v 1.71 2007-12-20 18:29:38 sshwarts Exp $
// $Id: sse_move.cc,v 1.72 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
@ -66,9 +66,7 @@ void BX_CPU_C::LDMXCSR(bxInstruction_c *i)
#if BX_SUPPORT_SSE >= 1
BX_CPU_THIS_PTR prepareSSE();
Bit32u new_mxcsr;
read_virtual_dword(i->seg(), RMAddr(i), &new_mxcsr);
Bit32u new_mxcsr = read_virtual_dword(i->seg(), RMAddr(i));
if(new_mxcsr & ~MXCSR_MASK)
exception(BX_GP_EXCEPTION, 0, 0);
@ -492,7 +490,6 @@ void BX_CPU_C::MOVSS_VssWss(bxInstruction_c *i)
BX_CPU_THIS_PTR prepareSSE();
BxPackedXmmRegister op = BX_READ_XMM_REG(i->nnn());
Bit32u val32;
/* op2 is a register or memory reference */
if (i->modC0())
@ -502,12 +499,9 @@ void BX_CPU_C::MOVSS_VssWss(bxInstruction_c *i)
op.xmm32u(0) = BX_READ_XMM_REG_LO_DWORD(i->rm());
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &val32);
/* If the source operand is a memory location, the high-order
96 bits of the destination XMM register are cleared to 0s */
op.xmm32u(0) = val32;
op.xmm32u(0) = read_virtual_dword(i->seg(), RMAddr(i));
op.xmm32u(1) = 0;
op.xmm64u(1) = 0;
}
@ -552,7 +546,6 @@ void BX_CPU_C::MOVSD_VsdWsd(bxInstruction_c *i)
BX_CPU_THIS_PTR prepareSSE();
BxPackedXmmRegister op = BX_READ_XMM_REG(i->nnn());
Bit64u val64;
/* op2 is a register or memory reference */
if (i->modC0())
@ -562,12 +555,9 @@ void BX_CPU_C::MOVSD_VsdWsd(bxInstruction_c *i)
op.xmm64u(0) = BX_READ_XMM_REG_LO_QWORD(i->rm());
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &val64);
/* If the source operand is a memory location, the high-order
64 bits of the destination XMM register are cleared to 0s */
op.xmm64u(0) = val64;
op.xmm64u(0) = read_virtual_qword(i->seg(), RMAddr(i));
op.xmm64u(1) = 0;
}
@ -618,7 +608,7 @@ void BX_CPU_C::MOVLPS_VpsMq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &val64);
val64 = read_virtual_qword(i->seg(), RMAddr(i));
}
/* now write result back to destination */
@ -643,7 +633,7 @@ void BX_CPU_C::MOVDDUP_VpdWq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &val64);
val64 = read_virtual_qword(i->seg(), RMAddr(i));
}
op.xmm64u(0) = val64;
@ -742,7 +732,7 @@ void BX_CPU_C::MOVHPS_VpsMq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &val64);
val64 = read_virtual_qword(i->seg(), RMAddr(i));
}
/* now write result back to destination */
@ -875,7 +865,7 @@ void BX_CPU_C::MOVD_VdqEd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_dword(i->seg(), RMAddr(i));
}
op1.xmm64u(0) = (Bit64u)(op2);
@ -906,7 +896,7 @@ void BX_CPU_C::MOVQ_VdqEq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_qword(i->seg(), RMAddr(i));
}
op1.xmm64u(0) = op2;
@ -977,15 +967,13 @@ void BX_CPU_C::MOVQ_VqWq(bxInstruction_c *i)
BX_CPU_THIS_PTR prepareSSE();
BxPackedXmmRegister op;
Bit64u val64;
if (i->modC0()) {
op.xmm64u(0) = BX_READ_XMM_REG_LO_QWORD(i->rm());
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &val64);
op.xmm64u(0) = val64;
op.xmm64u(0) = read_virtual_qword(i->seg(), RMAddr(i));
}
/* zero-extension to 128 bit */
@ -1181,7 +1169,7 @@ void BX_CPU_C::PMOVSXBW_VdqWq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &val64);
val64 = read_virtual_qword(i->seg(), RMAddr(i));
}
result.xmm16u(0) = (Bit8s) (val64 & 0xFF);
@ -1215,7 +1203,7 @@ void BX_CPU_C::PMOVSXBD_VdqWd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &val32);
val32 = read_virtual_dword(i->seg(), RMAddr(i));
}
result.xmm32u(0) = (Bit8s) (val32 & 0xFF);
@ -1245,7 +1233,7 @@ void BX_CPU_C::PMOVSXBQ_VdqWw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &val16);
val16 = read_virtual_word(i->seg(), RMAddr(i));
}
result.xmm64u(0) = (Bit8s) (val16 & 0xFF);
@ -1273,7 +1261,7 @@ void BX_CPU_C::PMOVSXWD_VdqWq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &val64);
val64 = read_virtual_qword(i->seg(), RMAddr(i));
}
result.xmm32u(0) = (Bit16s) (val64 & 0xFFFF);
@ -1303,7 +1291,7 @@ void BX_CPU_C::PMOVSXWQ_VdqWd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &val32);
val32 = read_virtual_dword(i->seg(), RMAddr(i));
}
result.xmm64u(0) = (Bit16s) (val32 & 0xFFFF);
@ -1331,7 +1319,7 @@ void BX_CPU_C::PMOVSXDQ_VdqWq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &val64);
val64 = read_virtual_qword(i->seg(), RMAddr(i));
}
result.xmm64u(0) = (Bit32s) (val64 & 0xFFFFFFFF);
@ -1384,7 +1372,7 @@ void BX_CPU_C::PMOVZXBW_VdqWq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &val64);
val64 = read_virtual_qword(i->seg(), RMAddr(i));
}
result.xmm16u(0) = val64 & 0xFF;
@ -1418,7 +1406,7 @@ void BX_CPU_C::PMOVZXBD_VdqWd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &val32);
val32 = read_virtual_dword(i->seg(), RMAddr(i));
}
result.xmm32u(0) = val32 & 0xFF;
@ -1448,7 +1436,7 @@ void BX_CPU_C::PMOVZXBQ_VdqWw(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &val16);
val16 = read_virtual_word(i->seg(), RMAddr(i));
}
result.xmm64u(0) = val16 & 0xFF;
@ -1476,7 +1464,7 @@ void BX_CPU_C::PMOVZXWD_VdqWq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &val64);
val64 = read_virtual_qword(i->seg(), RMAddr(i));
}
result.xmm32u(0) = val64 & 0xFFFF;
@ -1506,7 +1494,7 @@ void BX_CPU_C::PMOVZXWQ_VdqWd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &val32);
val32 = read_virtual_dword(i->seg(), RMAddr(i));
}
result.xmm64u(0) = val32 & 0xFFFF;
@ -1534,7 +1522,7 @@ void BX_CPU_C::PMOVZXDQ_VdqWq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &val64);
val64 = read_virtual_qword(i->seg(), RMAddr(i));
}
result.xmm64u(0) = val64 & 0xFFFFFFFF;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sse_pfp.cc,v 1.37 2007-12-16 20:37:59 sshwarts Exp $
// $Id: sse_pfp.cc,v 1.38 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
@ -109,7 +109,7 @@ void BX_CPU_C::CVTPI2PS_VpsQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op);
MMXUQ(op) = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -146,7 +146,7 @@ void BX_CPU_C::CVTPI2PD_VpdQq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op);
MMXUQ(op) = read_virtual_qword(i->seg(), RMAddr(i));
}
result.xmm64u(0) = int32_to_float64(MMXUD0(op));
@ -184,7 +184,7 @@ void BX_CPU_C::CVTSI2SD_VsdEd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op);
op = read_virtual_qword(i->seg(), RMAddr(i));
}
result = int64_to_float64(op, status_word);
@ -200,7 +200,7 @@ void BX_CPU_C::CVTSI2SD_VsdEd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op);
op = read_virtual_dword(i->seg(), RMAddr(i));
}
result = int32_to_float64(op);
@ -241,7 +241,7 @@ void BX_CPU_C::CVTSI2SS_VssEd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op);
op = read_virtual_qword(i->seg(), RMAddr(i));
}
result = int64_to_float32(op, status_word);
@ -257,7 +257,7 @@ void BX_CPU_C::CVTSI2SS_VssEd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op);
op = read_virtual_dword(i->seg(), RMAddr(i));
}
result = int32_to_float32(op, status_word);
@ -292,7 +292,7 @@ void BX_CPU_C::CVTTPS2PI_PqWps(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op);
op = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -379,7 +379,7 @@ void BX_CPU_C::CVTTSD2SI_GdWsd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op);
op = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -427,7 +427,7 @@ void BX_CPU_C::CVTTSS2SI_GdWss(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op);
op = read_virtual_dword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -478,7 +478,7 @@ void BX_CPU_C::CVTPS2PI_PqWps(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op);
op = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -567,7 +567,7 @@ void BX_CPU_C::CVTSD2SI_GdWsd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op);
op = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -615,7 +615,7 @@ void BX_CPU_C::CVTSS2SI_GdWss(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op);
op = read_virtual_dword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -662,7 +662,7 @@ void BX_CPU_C::CVTPS2PD_VpsWps(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op);
op = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -754,7 +754,7 @@ void BX_CPU_C::CVTSD2SS_VsdWsd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op);
op = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -789,7 +789,7 @@ void BX_CPU_C::CVTSS2SD_VssWss(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op);
op = read_virtual_dword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -1039,7 +1039,7 @@ void BX_CPU_C::CVTDQ2PD_VpdWq(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op);
op = read_virtual_qword(i->seg(), RMAddr(i));
}
Bit32u r0 = (Bit32u)(op & 0xFFFFFFFF);
@ -1073,7 +1073,7 @@ void BX_CPU_C::UCOMISS_VssWss(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_dword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -1112,7 +1112,7 @@ void BX_CPU_C::UCOMISD_VsdWsd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -1151,7 +1151,7 @@ void BX_CPU_C::COMISS_VpsWps(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_dword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -1190,7 +1190,7 @@ void BX_CPU_C::COMISD_VpdWpd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -1317,7 +1317,7 @@ void BX_CPU_C::SQRTSD_VsdWsd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op);
op = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -1351,7 +1351,7 @@ void BX_CPU_C::SQRTSS_VssWss(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op);
op = read_virtual_dword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -1479,7 +1479,7 @@ void BX_CPU_C::ADDSD_VsdWsd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
op2 = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -1519,7 +1519,7 @@ void BX_CPU_C::ADDSS_VssWss(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_dword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -1653,7 +1653,7 @@ void BX_CPU_C::MULSD_VsdWsd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
op2 = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -1693,7 +1693,7 @@ void BX_CPU_C::MULSS_VssWss(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_dword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -1827,7 +1827,7 @@ void BX_CPU_C::SUBSD_VsdWsd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
op2 = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -1867,7 +1867,7 @@ void BX_CPU_C::SUBSS_VssWss(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_dword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -2009,7 +2009,7 @@ void BX_CPU_C::MINSD_VsdWsd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -2050,7 +2050,7 @@ void BX_CPU_C::MINSS_VssWss(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_dword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -2185,7 +2185,7 @@ void BX_CPU_C::DIVSD_VsdWsd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
op2 = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -2225,7 +2225,7 @@ void BX_CPU_C::DIVSS_VssWss(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_dword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -2367,7 +2367,7 @@ void BX_CPU_C::MAXSD_VsdWsd(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -2408,7 +2408,7 @@ void BX_CPU_C::MAXSS_VssWss(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op2);
op2 = read_virtual_dword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -2779,7 +2779,7 @@ void BX_CPU_C::CMPSD_VsdWsdIb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u *) &op2);
op2 = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -2838,7 +2838,7 @@ void BX_CPU_C::CMPSS_VssWssIb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), (Bit32u *) &op2);
op2 = read_virtual_dword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -3092,7 +3092,7 @@ void BX_CPU_C::ROUNDSS_VssWssIb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op);
op = read_virtual_dword(i->seg(), RMAddr(i));
}
float_status_t status_word;
@ -3137,7 +3137,7 @@ void BX_CPU_C::ROUNDSD_VsdWsdIb(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op);
op = read_virtual_qword(i->seg(), RMAddr(i));
}
float_status_t status_word;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sse_rcp.cc,v 1.14 2007-11-17 23:28:33 sshwarts Exp $
// $Id: sse_rcp.cc,v 1.15 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
@ -389,7 +389,7 @@ void BX_CPU_C::RCPSS_VssWss(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op);
op = read_virtual_dword(i->seg(), RMAddr(i));
}
op = approximate_rcp(op);
@ -738,7 +738,7 @@ void BX_CPU_C::RSQRTSS_VssWss(bxInstruction_c *i)
}
else {
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op);
op = read_virtual_dword(i->seg(), RMAddr(i));
}
op = approximate_rsqrt(op);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: stack16.cc,v 1.28 2007-12-20 18:29:38 sshwarts Exp $
// $Id: stack16.cc,v 1.29 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -170,10 +170,7 @@ void BX_CPU_C::PUSH_Iw(bxInstruction_c *i)
void BX_CPU_C::PUSH_EwM(bxInstruction_c *i)
{
Bit16u op1_16;
/* pointer, segment address pair */
read_virtual_word(i->seg(), RMAddr(i), &op1_16);
Bit16u op1_16 = read_virtual_word(i->seg(), RMAddr(i));
push_16(op1_16);
}
@ -222,25 +219,25 @@ void BX_CPU_C::POPAD16(bxInstruction_c *i)
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b)
{
Bit32u temp_ESP = ESP;
read_virtual_word(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 0), &di);
read_virtual_word(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 2), &si);
read_virtual_word(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 4), &bp);
read_virtual_word(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 8), &bx);
read_virtual_word(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 10), &dx);
read_virtual_word(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 12), &cx);
read_virtual_word(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 14), &ax);
di = read_virtual_word(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 0));
si = read_virtual_word(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 2));
bp = read_virtual_word(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 4));
bx = read_virtual_word(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 8));
dx = read_virtual_word(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 10));
cx = read_virtual_word(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 12));
ax = read_virtual_word(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 14));
ESP += 16;
}
else
{
Bit16u temp_SP = SP;
read_virtual_word(BX_SEG_REG_SS, (Bit16u) (temp_SP + 0), &di);
read_virtual_word(BX_SEG_REG_SS, (Bit16u) (temp_SP + 2), &si);
read_virtual_word(BX_SEG_REG_SS, (Bit16u) (temp_SP + 4), &bp);
read_virtual_word(BX_SEG_REG_SS, (Bit16u) (temp_SP + 8), &bx);
read_virtual_word(BX_SEG_REG_SS, (Bit16u) (temp_SP + 10), &dx);
read_virtual_word(BX_SEG_REG_SS, (Bit16u) (temp_SP + 12), &cx);
read_virtual_word(BX_SEG_REG_SS, (Bit16u) (temp_SP + 14), &ax);
di = read_virtual_word(BX_SEG_REG_SS, (Bit16u) (temp_SP + 0));
si = read_virtual_word(BX_SEG_REG_SS, (Bit16u) (temp_SP + 2));
bp = read_virtual_word(BX_SEG_REG_SS, (Bit16u) (temp_SP + 4));
bx = read_virtual_word(BX_SEG_REG_SS, (Bit16u) (temp_SP + 8));
dx = read_virtual_word(BX_SEG_REG_SS, (Bit16u) (temp_SP + 10));
cx = read_virtual_word(BX_SEG_REG_SS, (Bit16u) (temp_SP + 12));
ax = read_virtual_word(BX_SEG_REG_SS, (Bit16u) (temp_SP + 14));
SP += 16;
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: stack32.cc,v 1.43 2007-12-20 18:29:38 sshwarts Exp $
// $Id: stack32.cc,v 1.44 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -170,10 +170,7 @@ void BX_CPU_C::PUSH_Id(bxInstruction_c *i)
void BX_CPU_C::PUSH_EdM(bxInstruction_c *i)
{
Bit32u op1_32;
/* pointer, segment address pair */
read_virtual_dword(i->seg(), RMAddr(i), &op1_32);
Bit32u op1_32 = read_virtual_dword(i->seg(), RMAddr(i));
push_32(op1_32);
}
@ -221,25 +218,25 @@ void BX_CPU_C::POPAD32(bxInstruction_c *i)
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b)
{
Bit32u temp_ESP = ESP;
read_virtual_dword(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 0), &edi);
read_virtual_dword(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 4), &esi);
read_virtual_dword(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 8), &ebp);
read_virtual_dword(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 16), &ebx);
read_virtual_dword(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 20), &edx);
read_virtual_dword(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 24), &ecx);
read_virtual_dword(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 28), &eax);
edi = read_virtual_dword(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 0));
esi = read_virtual_dword(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 4));
ebp = read_virtual_dword(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 8));
ebx = read_virtual_dword(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 16));
edx = read_virtual_dword(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 20));
ecx = read_virtual_dword(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 24));
eax = read_virtual_dword(BX_SEG_REG_SS, (Bit32u) (temp_ESP + 28));
ESP += 32;
}
else
{
Bit16u temp_SP = SP;
read_virtual_dword(BX_SEG_REG_SS, (Bit16u) (temp_SP + 0), &edi);
read_virtual_dword(BX_SEG_REG_SS, (Bit16u) (temp_SP + 4), &esi);
read_virtual_dword(BX_SEG_REG_SS, (Bit16u) (temp_SP + 8), &ebp);
read_virtual_dword(BX_SEG_REG_SS, (Bit16u) (temp_SP + 16), &ebx);
read_virtual_dword(BX_SEG_REG_SS, (Bit16u) (temp_SP + 20), &edx);
read_virtual_dword(BX_SEG_REG_SS, (Bit16u) (temp_SP + 24), &ecx);
read_virtual_dword(BX_SEG_REG_SS, (Bit16u) (temp_SP + 28), &eax);
edi = read_virtual_dword(BX_SEG_REG_SS, (Bit16u) (temp_SP + 0));
esi = read_virtual_dword(BX_SEG_REG_SS, (Bit16u) (temp_SP + 4));
ebp = read_virtual_dword(BX_SEG_REG_SS, (Bit16u) (temp_SP + 8));
ebx = read_virtual_dword(BX_SEG_REG_SS, (Bit16u) (temp_SP + 16));
edx = read_virtual_dword(BX_SEG_REG_SS, (Bit16u) (temp_SP + 20));
ecx = read_virtual_dword(BX_SEG_REG_SS, (Bit16u) (temp_SP + 24));
eax = read_virtual_dword(BX_SEG_REG_SS, (Bit16u) (temp_SP + 28));
SP += 32;
}
@ -283,11 +280,12 @@ void BX_CPU_C::ENTER16_IwIb(bxInstruction_c *i)
if (ss32) {
ebp -= 2;
read_virtual_word(BX_SEG_REG_SS, ebp, &temp16);
temp16 = read_virtual_word(BX_SEG_REG_SS, ebp);
}
else { /* 16bit stacksize */
ebp -= 2; ebp &= 0xffff;
read_virtual_word(BX_SEG_REG_SS, ebp, &temp16);
ebp -= 2;
ebp &= 0xffff;
temp16 = read_virtual_word(BX_SEG_REG_SS, ebp);
}
push_16(temp16);
}
@ -338,11 +336,12 @@ void BX_CPU_C::ENTER32_IwIb(bxInstruction_c *i)
if (ss32) {
ebp -= 4;
read_virtual_dword(BX_SEG_REG_SS, ebp, &temp32);
temp32 = read_virtual_dword(BX_SEG_REG_SS, ebp);
}
else { /* 16bit stacksize */
ebp -= 4; ebp &= 0xffff;
read_virtual_dword(BX_SEG_REG_SS, ebp, &temp32);
ebp -= 4;
ebp &= 0xffff;
temp32 = read_virtual_dword(BX_SEG_REG_SS, ebp);
}
push_32(temp32);
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: stack64.cc,v 1.31 2007-12-20 18:29:38 sshwarts Exp $
// $Id: stack64.cc,v 1.32 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -78,18 +78,16 @@ void BX_CPU_C::PUSH64_GS(bxInstruction_c *i)
void BX_CPU_C::POP64_FS(bxInstruction_c *i)
{
Bit64u fs;
// this way is faster and RSP safe
read_virtual_qword(BX_SEG_REG_SS, RSP, &fs);
Bit64u fs = read_virtual_qword(BX_SEG_REG_SS, RSP);
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS], (Bit16u) fs);
RSP += 8;
}
void BX_CPU_C::POP64_GS(bxInstruction_c *i)
{
Bit64u gs;
// this way is faster and RSP safe
read_virtual_qword(BX_SEG_REG_SS, RSP, &gs);
Bit64u gs = read_virtual_qword(BX_SEG_REG_SS, RSP);
load_seg_reg(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS], (Bit16u) gs);
RSP += 8;
}
@ -102,10 +100,7 @@ void BX_CPU_C::PUSH64_Id(bxInstruction_c *i)
void BX_CPU_C::PUSH_EqM(bxInstruction_c *i)
{
Bit64u op1_64;
/* pointer, segment address pair */
read_virtual_qword(i->seg(), RMAddr(i), &op1_64);
Bit64u op1_64 = read_virtual_qword(i->seg(), RMAddr(i));
push_64(op1_64);
}
@ -134,7 +129,7 @@ void BX_CPU_C::ENTER64_IwIb(bxInstruction_c *i)
Bit64u temp64;
RBP -= 8;
read_virtual_qword(BX_SEG_REG_SS, RBP, &temp64);
temp64 = read_virtual_qword(BX_SEG_REG_SS, RBP);
RSP -= 8;
write_virtual_qword(BX_SEG_REG_SS, RSP, temp64);
} /* while (--level) */
@ -152,9 +147,8 @@ void BX_CPU_C::ENTER64_IwIb(bxInstruction_c *i)
void BX_CPU_C::LEAVE64(bxInstruction_c *i)
{
Bit64u temp64;
// restore frame pointer
read_virtual_qword(BX_SEG_REG_SS, RBP, &temp64);
Bit64u temp64 = read_virtual_qword(BX_SEG_REG_SS, RBP);
RSP = RBP + 8;
RBP = temp64;
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: stack_pro.cc,v 1.37 2007-12-20 18:29:38 sshwarts Exp $
// $Id: stack_pro.cc,v 1.38 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -95,17 +95,17 @@ Bit16u BX_CPU_C::pop_16(void)
#if BX_SUPPORT_X86_64
if (StackAddrSize64()) {
read_virtual_word(BX_SEG_REG_SS, RSP, &value16);
value16 = read_virtual_word(BX_SEG_REG_SS, RSP);
RSP += 2;
}
else
#endif
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b) {
read_virtual_word(BX_SEG_REG_SS, ESP, &value16);
value16 = read_virtual_word(BX_SEG_REG_SS, ESP);
ESP += 2;
}
else {
read_virtual_word(BX_SEG_REG_SS, SP, &value16);
value16 = read_virtual_word(BX_SEG_REG_SS, SP);
SP += 2;
}
@ -119,17 +119,17 @@ Bit32u BX_CPU_C::pop_32()
#if BX_SUPPORT_X86_64
if (StackAddrSize64()) {
read_virtual_dword(BX_SEG_REG_SS, RSP, &value32);
value32 = read_virtual_dword(BX_SEG_REG_SS, RSP);
RSP += 4;
}
else
#endif
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.u.segment.d_b) {
read_virtual_dword(BX_SEG_REG_SS, ESP, &value32);
value32 = read_virtual_dword(BX_SEG_REG_SS, ESP);
ESP += 4;
}
else {
read_virtual_dword(BX_SEG_REG_SS, SP, &value32);
value32 = read_virtual_dword(BX_SEG_REG_SS, SP);
SP += 4;
}
@ -140,11 +140,9 @@ Bit32u BX_CPU_C::pop_32()
#if BX_SUPPORT_X86_64
Bit64u BX_CPU_C::pop_64()
{
Bit64u value64;
BX_ASSERT(StackAddrSize64());
read_virtual_qword(BX_SEG_REG_SS, RSP, &value64);
Bit64u value64 = read_virtual_qword(BX_SEG_REG_SS, RSP);
RSP += 8;
return value64;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: string.cc,v 1.47 2007-12-20 18:29:38 sshwarts Exp $
// $Id: string.cc,v 1.48 2007-12-20 20:58:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -881,14 +881,14 @@ void BX_CPU_C::MOVSB16_XbYb(bxInstruction_c *i)
incr = byteCount;
}
else {
read_virtual_byte(i->seg(), SI, &temp8);
temp8 = read_virtual_byte(i->seg(), SI);
write_virtual_byte(BX_SEG_REG_ES, DI, temp8);
}
}
else
#endif
{
read_virtual_byte(i->seg(), SI, &temp8);
temp8 = read_virtual_byte(i->seg(), SI);
write_virtual_byte(BX_SEG_REG_ES, DI, temp8);
}
@ -931,14 +931,14 @@ void BX_CPU_C::MOVSB32_XbYb(bxInstruction_c *i)
incr = byteCount;
}
else {
read_virtual_byte(i->seg(), ESI, &temp8);
temp8 = read_virtual_byte(i->seg(), ESI);
write_virtual_byte(BX_SEG_REG_ES, EDI, temp8);
}
}
else
#endif
{
read_virtual_byte(i->seg(), ESI, &temp8);
temp8 = read_virtual_byte(i->seg(), ESI);
write_virtual_byte(BX_SEG_REG_ES, EDI, temp8);
}
@ -961,7 +961,7 @@ void BX_CPU_C::MOVSB64_XbYb(bxInstruction_c *i)
Bit64u rsi = RSI;
Bit64u rdi = RDI;
read_virtual_byte(i->seg(), rsi, &temp8);
temp8 = read_virtual_byte(i->seg(), rsi);
write_virtual_byte(BX_SEG_REG_ES, rdi, temp8);
if (BX_CPU_THIS_PTR get_DF()) {
@ -1011,14 +1011,14 @@ void BX_CPU_C::MOVSW16_XwYw(bxInstruction_c *i)
incr = wordCount << 1; // count * 2
}
else {
read_virtual_word(i->seg(), si, &temp16);
temp16 = read_virtual_word(i->seg(), si);
write_virtual_word(BX_SEG_REG_ES, di, temp16);
}
}
else
#endif
{
read_virtual_word(i->seg(), si, &temp16);
temp16 = read_virtual_word(i->seg(), si);
write_virtual_word(BX_SEG_REG_ES, di, temp16);
}
@ -1045,7 +1045,7 @@ void BX_CPU_C::MOVSW32_XwYw(bxInstruction_c *i)
Bit32u esi = ESI;
Bit32u edi = EDI;
read_virtual_word(i->seg(), esi, &temp16);
temp16 = read_virtual_word(i->seg(), esi);
write_virtual_word(BX_SEG_REG_ES, edi, temp16);
if (BX_CPU_THIS_PTR get_DF()) {
@ -1071,7 +1071,7 @@ void BX_CPU_C::MOVSW64_XwYw(bxInstruction_c *i)
Bit64u rsi = RSI;
Bit64u rdi = RDI;
read_virtual_word(i->seg(), rsi, &temp16);
temp16 = read_virtual_word(i->seg(), rsi);
write_virtual_word(BX_SEG_REG_ES, rdi, temp16);
if (BX_CPU_THIS_PTR get_DF()) {
@ -1096,7 +1096,7 @@ void BX_CPU_C::MOVSD16_XdYd(bxInstruction_c *i)
Bit16u si = SI;
Bit16u di = DI;
read_virtual_dword(i->seg(), si, &temp32);
temp32 = read_virtual_dword(i->seg(), si);
write_virtual_dword(BX_SEG_REG_ES, di, temp32);
if (BX_CPU_THIS_PTR get_DF()) {
@ -1143,14 +1143,14 @@ void BX_CPU_C::MOVSD32_XdYd(bxInstruction_c *i)
incr = dwordCount << 2; // count * 4
}
else {
read_virtual_dword(i->seg(), esi, &temp32);
temp32 = read_virtual_dword(i->seg(), esi);
write_virtual_dword(BX_SEG_REG_ES, edi, temp32);
}
}
else
#endif
{
read_virtual_dword(i->seg(), esi, &temp32);
temp32 = read_virtual_dword(i->seg(), esi);
write_virtual_dword(BX_SEG_REG_ES, edi, temp32);
}
@ -1178,7 +1178,7 @@ void BX_CPU_C::MOVSD64_XdYd(bxInstruction_c *i)
Bit64u rsi = RSI;
Bit64u rdi = RDI;
read_virtual_dword(i->seg(), rsi, &temp32);
temp32 = read_virtual_dword(i->seg(), rsi);
write_virtual_dword(BX_SEG_REG_ES, rdi, temp32);
if (BX_CPU_THIS_PTR get_DF()) {
@ -1202,7 +1202,7 @@ void BX_CPU_C::MOVSQ32_XqYq(bxInstruction_c *i)
Bit32u esi = ESI;
Bit32u edi = EDI;
read_virtual_qword(i->seg(), esi, &temp64);
temp64 = read_virtual_qword(i->seg(), esi);
write_virtual_qword(BX_SEG_REG_ES, edi, temp64);
if (BX_CPU_THIS_PTR get_DF()) {
@ -1227,7 +1227,7 @@ void BX_CPU_C::MOVSQ64_XqYq(bxInstruction_c *i)
Bit64u rsi = RSI;
Bit64u rdi = RDI;
read_virtual_qword(i->seg(), rsi, &temp64);
temp64 = read_virtual_qword(i->seg(), rsi);
write_virtual_qword(BX_SEG_REG_ES, rdi, temp64);
if (BX_CPU_THIS_PTR get_DF()) {
@ -1310,8 +1310,8 @@ void BX_CPU_C::CMPSB16_XbYb(bxInstruction_c *i)
Bit16u si = SI;
Bit16u di = DI;
read_virtual_byte(i->seg(), si, &op1_8);
read_virtual_byte(BX_SEG_REG_ES, di, &op2_8);
op1_8 = read_virtual_byte(i->seg(), si);
op2_8 = read_virtual_byte(BX_SEG_REG_ES, di);
diff_8 = op1_8 - op2_8;
@ -1338,8 +1338,8 @@ void BX_CPU_C::CMPSB32_XbYb(bxInstruction_c *i)
Bit32u esi = ESI;
Bit32u edi = EDI;
read_virtual_byte(i->seg(), esi, &op1_8);
read_virtual_byte(BX_SEG_REG_ES, edi, &op2_8);
op1_8 = read_virtual_byte(i->seg(), esi);
op2_8 = read_virtual_byte(BX_SEG_REG_ES, edi);
diff_8 = op1_8 - op2_8;
@ -1368,8 +1368,8 @@ void BX_CPU_C::CMPSB64_XbYb(bxInstruction_c *i)
Bit64u rsi = RSI;
Bit64u rdi = RDI;
read_virtual_byte(i->seg(), rsi, &op1_8);
read_virtual_byte(BX_SEG_REG_ES, rdi, &op2_8);
op1_8 = read_virtual_byte(i->seg(), rsi);
op2_8 = read_virtual_byte(BX_SEG_REG_ES, rdi);
diff_8 = op1_8 - op2_8;
@ -1397,8 +1397,8 @@ void BX_CPU_C::CMPSW16_XwYw(bxInstruction_c *i)
Bit16u si = SI;
Bit16u di = DI;
read_virtual_word(i->seg(), si, &op1_16);
read_virtual_word(BX_SEG_REG_ES, di, &op2_16);
op1_16 = read_virtual_word(i->seg(), si);
op2_16 = read_virtual_word(BX_SEG_REG_ES, di);
diff_16 = op1_16 - op2_16;
@ -1425,8 +1425,8 @@ void BX_CPU_C::CMPSW32_XwYw(bxInstruction_c *i)
Bit32u esi = ESI;
Bit32u edi = EDI;
read_virtual_word(i->seg(), esi, &op1_16);
read_virtual_word(BX_SEG_REG_ES, edi, &op2_16);
op1_16 = read_virtual_word(i->seg(), esi);
op2_16 = read_virtual_word(BX_SEG_REG_ES, edi);
diff_16 = op1_16 - op2_16;
@ -1455,8 +1455,8 @@ void BX_CPU_C::CMPSW64_XwYw(bxInstruction_c *i)
Bit64u rsi = RSI;
Bit64u rdi = RDI;
read_virtual_word(i->seg(), rsi, &op1_16);
read_virtual_word(BX_SEG_REG_ES, rdi, &op2_16);
op1_16 = read_virtual_word(i->seg(), rsi);
op2_16 = read_virtual_word(BX_SEG_REG_ES, rdi);
diff_16 = op1_16 - op2_16;
@ -1484,8 +1484,8 @@ void BX_CPU_C::CMPSD16_XdYd(bxInstruction_c *i)
Bit16u si = SI;
Bit16u di = DI;
read_virtual_dword(i->seg(), si, &op1_32);
read_virtual_dword(BX_SEG_REG_ES, di, &op2_32);
op1_32 = read_virtual_dword(i->seg(), si);
op2_32 = read_virtual_dword(BX_SEG_REG_ES, di);
diff_32 = op1_32 - op2_32;
@ -1512,8 +1512,8 @@ void BX_CPU_C::CMPSD32_XdYd(bxInstruction_c *i)
Bit32u esi = ESI;
Bit32u edi = EDI;
read_virtual_dword(i->seg(), esi, &op1_32);
read_virtual_dword(BX_SEG_REG_ES, edi, &op2_32);
op1_32 = read_virtual_dword(i->seg(), esi);
op2_32 = read_virtual_dword(BX_SEG_REG_ES, edi);
diff_32 = op1_32 - op2_32;
@ -1543,8 +1543,8 @@ void BX_CPU_C::CMPSD64_XdYd(bxInstruction_c *i)
Bit64u rsi = RSI;
Bit64u rdi = RDI;
read_virtual_dword(i->seg(), rsi, &op1_32);
read_virtual_dword(BX_SEG_REG_ES, rdi, &op2_32);
op1_32 = read_virtual_dword(i->seg(), rsi);
op2_32 = read_virtual_dword(BX_SEG_REG_ES, rdi);
diff_32 = op1_32 - op2_32;
@ -1571,8 +1571,8 @@ void BX_CPU_C::CMPSQ32_XqYq(bxInstruction_c *i)
Bit32u esi = ESI;
Bit32u edi = EDI;
read_virtual_qword(i->seg(), esi, &op1_64);
read_virtual_qword(BX_SEG_REG_ES, edi, &op2_64);
op1_64 = read_virtual_qword(i->seg(), esi);
op2_64 = read_virtual_qword(BX_SEG_REG_ES, edi);
diff_64 = op1_64 - op2_64;
@ -1600,8 +1600,8 @@ void BX_CPU_C::CMPSQ64_XqYq(bxInstruction_c *i)
Bit64u rsi = RSI;
Bit64u rdi = RDI;
read_virtual_qword(i->seg(), rsi, &op1_64);
read_virtual_qword(BX_SEG_REG_ES, rdi, &op2_64);
op1_64 = read_virtual_qword(i->seg(), rsi);
op2_64 = read_virtual_qword(BX_SEG_REG_ES, rdi);
diff_64 = op1_64 - op2_64;
@ -1686,7 +1686,7 @@ void BX_CPU_C::SCASB16_ALXb(bxInstruction_c *i)
Bit16u di = DI;
read_virtual_byte(BX_SEG_REG_ES, di, &op2_8);
op2_8 = read_virtual_byte(BX_SEG_REG_ES, di);
diff_8 = op1_8 - op2_8;
@ -1709,8 +1709,7 @@ void BX_CPU_C::SCASB32_ALXb(bxInstruction_c *i)
Bit32u edi = EDI;
read_virtual_byte(BX_SEG_REG_ES, edi, &op2_8);
op2_8 = read_virtual_byte(BX_SEG_REG_ES, edi);
diff_8 = op1_8 - op2_8;
SET_FLAGS_OSZAPC_SUB_8(op1_8, op2_8, diff_8);
@ -1734,7 +1733,7 @@ void BX_CPU_C::SCASB64_ALXb(bxInstruction_c *i)
Bit64u rdi = RDI;
read_virtual_byte(BX_SEG_REG_ES, rdi, &op2_8);
op2_8 = read_virtual_byte(BX_SEG_REG_ES, rdi);
diff_8 = op1_8 - op2_8;
@ -1758,8 +1757,7 @@ void BX_CPU_C::SCASW16_AXXw(bxInstruction_c *i)
Bit16u di = DI;
read_virtual_word(BX_SEG_REG_ES, di, &op2_16);
op2_16 = read_virtual_word(BX_SEG_REG_ES, di);
diff_16 = op1_16 - op2_16;
SET_FLAGS_OSZAPC_SUB_16(op1_16, op2_16, diff_16);
@ -1781,7 +1779,7 @@ void BX_CPU_C::SCASW32_AXXw(bxInstruction_c *i)
Bit32u edi = EDI;
read_virtual_word(BX_SEG_REG_ES, edi, &op2_16);
op2_16 = read_virtual_word(BX_SEG_REG_ES, edi);
diff_16 = op1_16 - op2_16;
SET_FLAGS_OSZAPC_SUB_16(op1_16, op2_16, diff_16);
@ -1805,8 +1803,7 @@ void BX_CPU_C::SCASW64_AXXw(bxInstruction_c *i)
Bit64u rdi = RDI;
read_virtual_word(BX_SEG_REG_ES, rdi, &op2_16);
op2_16 = read_virtual_word(BX_SEG_REG_ES, rdi);
diff_16 = op1_16 - op2_16;
SET_FLAGS_OSZAPC_SUB_16(op1_16, op2_16, diff_16);
@ -1829,8 +1826,7 @@ void BX_CPU_C::SCASD16_EAXXd(bxInstruction_c *i)
Bit16u di = DI;
read_virtual_dword(BX_SEG_REG_ES, di, &op2_32);
op2_32 = read_virtual_dword(BX_SEG_REG_ES, di);
diff_32 = op1_32 - op2_32;
SET_FLAGS_OSZAPC_SUB_32(op1_32, op2_32, diff_32);
@ -1852,8 +1848,7 @@ void BX_CPU_C::SCASD32_EAXXd(bxInstruction_c *i)
Bit32u edi = EDI;
read_virtual_dword(BX_SEG_REG_ES, edi, &op2_32);
op2_32 = read_virtual_dword(BX_SEG_REG_ES, edi);
diff_32 = op1_32 - op2_32;
SET_FLAGS_OSZAPC_SUB_32(op1_32, op2_32, diff_32);
@ -1878,8 +1873,7 @@ void BX_CPU_C::SCASD64_EAXXd(bxInstruction_c *i)
Bit64u rdi = RDI;
read_virtual_dword(BX_SEG_REG_ES, rdi, &op2_32);
op2_32 = read_virtual_dword(BX_SEG_REG_ES, rdi);
diff_32 = op1_32 - op2_32;
SET_FLAGS_OSZAPC_SUB_32(op1_32, op2_32, diff_32);
@ -1901,8 +1895,7 @@ void BX_CPU_C::SCASQ32_RAXXq(bxInstruction_c *i)
Bit32u edi = EDI;
read_virtual_qword(BX_SEG_REG_ES, edi, &op2_64);
op2_64 = read_virtual_qword(BX_SEG_REG_ES, edi);
diff_64 = op1_64 - op2_64;
SET_FLAGS_OSZAPC_SUB_64(op1_64, op2_64, diff_64);
@ -1925,8 +1918,7 @@ void BX_CPU_C::SCASQ64_RAXXq(bxInstruction_c *i)
Bit64u rdi = RDI;
read_virtual_qword(BX_SEG_REG_ES, rdi, &op2_64);
op2_64 = read_virtual_qword(BX_SEG_REG_ES, rdi);
diff_64 = op1_64 - op2_64;
SET_FLAGS_OSZAPC_SUB_64(op1_64, op2_64, diff_64);
@ -2310,7 +2302,7 @@ void BX_CPU_C::LODSB16_ALXb(bxInstruction_c *i)
{
Bit16u si = SI;
read_virtual_byte(i->seg(), si, &AL);
AL = read_virtual_byte(i->seg(), si);
if (BX_CPU_THIS_PTR get_DF()) {
si--;
@ -2327,7 +2319,7 @@ void BX_CPU_C::LODSB32_ALXb(bxInstruction_c *i)
{
Bit32u esi = ESI;
read_virtual_byte(i->seg(), esi, &AL);
AL = read_virtual_byte(i->seg(), esi);
if (BX_CPU_THIS_PTR get_DF()) {
esi--;
@ -2346,7 +2338,7 @@ void BX_CPU_C::LODSB64_ALXb(bxInstruction_c *i)
{
Bit64u rsi = RSI;
read_virtual_byte(i->seg(), rsi, &AL);
AL = read_virtual_byte(i->seg(), rsi);
if (BX_CPU_THIS_PTR get_DF()) {
rsi--;
@ -2364,7 +2356,7 @@ void BX_CPU_C::LODSW16_AXXw(bxInstruction_c *i)
{
Bit16u si = SI;
read_virtual_word(i->seg(), si, &AX);
AX = read_virtual_word(i->seg(), si);
if (BX_CPU_THIS_PTR get_DF()) {
si -= 2;
@ -2381,7 +2373,7 @@ void BX_CPU_C::LODSW32_AXXw(bxInstruction_c *i)
{
Bit32u esi = ESI;
read_virtual_word(i->seg(), esi, &AX);
AX = read_virtual_word(i->seg(), esi);
if (BX_CPU_THIS_PTR get_DF()) {
esi -= 2;
@ -2400,7 +2392,7 @@ void BX_CPU_C::LODSW64_AXXw(bxInstruction_c *i)
{
Bit64u rsi = RSI;
read_virtual_word(i->seg(), rsi, &AX);
AX = read_virtual_word(i->seg(), rsi);
if (BX_CPU_THIS_PTR get_DF()) {
rsi -= 2;
@ -2416,13 +2408,9 @@ void BX_CPU_C::LODSW64_AXXw(bxInstruction_c *i)
/* 32 bit opsize mode, 16 bit address size */
void BX_CPU_C::LODSD16_EAXXd(bxInstruction_c *i)
{
Bit32u eax;
Bit16u si = SI;
read_virtual_dword(i->seg(), si, &eax);
RAX = eax;
RAX = read_virtual_dword(i->seg(), si);
if (BX_CPU_THIS_PTR get_DF()) {
si -= 4;
@ -2437,13 +2425,9 @@ void BX_CPU_C::LODSD16_EAXXd(bxInstruction_c *i)
/* 32 bit opsize mode, 32 bit address size */
void BX_CPU_C::LODSD32_EAXXd(bxInstruction_c *i)
{
Bit32u eax;
Bit32u esi = ESI;
read_virtual_dword(i->seg(), esi, &eax);
RAX = eax;
RAX = read_virtual_dword(i->seg(), esi);
if (BX_CPU_THIS_PTR get_DF()) {
esi -= 4;
@ -2461,13 +2445,9 @@ void BX_CPU_C::LODSD32_EAXXd(bxInstruction_c *i)
/* 32 bit opsize mode, 64 bit address size */
void BX_CPU_C::LODSD64_EAXXd(bxInstruction_c *i)
{
Bit32u eax;
Bit64u rsi = RSI;
read_virtual_dword(i->seg(), rsi, &eax);
RAX = eax;
RAX = read_virtual_dword(i->seg(), rsi);
if (BX_CPU_THIS_PTR get_DF()) {
rsi -= 4;
@ -2484,7 +2464,7 @@ void BX_CPU_C::LODSQ32_RAXXq(bxInstruction_c *i)
{
Bit32u esi = ESI;
read_virtual_qword(i->seg(), esi, &RAX);
RAX = read_virtual_qword(i->seg(), esi);
if (BX_CPU_THIS_PTR get_DF()) {
esi -= 8;
@ -2502,7 +2482,7 @@ void BX_CPU_C::LODSQ64_RAXXq(bxInstruction_c *i)
{
Bit64u rsi = RSI;
read_virtual_qword(i->seg(), rsi, &RAX);
RAX = read_virtual_qword(i->seg(), rsi);
if (BX_CPU_THIS_PTR get_DF()) {
rsi -= 8;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: vm8086.cc,v 1.33 2007-12-20 18:29:38 sshwarts Exp $
// $Id: vm8086.cc,v 1.34 2007-12-20 20:58:38 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -91,14 +91,14 @@ void BX_CPU_C::stack_return_to_v86(Bit32u new_eip, Bit32u raw_cs_selector,
esp_laddr = BX_CPU_THIS_PTR get_segment_base(BX_SEG_REG_SS) + temp_ESP;
// load SS:ESP from stack
read_virtual_dword(BX_SEG_REG_SS, temp_ESP+12, &new_esp);
read_virtual_word (BX_SEG_REG_SS, temp_ESP+16, &raw_ss_selector);
new_esp = read_virtual_dword(BX_SEG_REG_SS, temp_ESP+12);
raw_ss_selector = read_virtual_word(BX_SEG_REG_SS, temp_ESP+16);
// load ES,DS,FS,GS from stack
read_virtual_word (BX_SEG_REG_SS, temp_ESP+20, &raw_es_selector);
read_virtual_word (BX_SEG_REG_SS, temp_ESP+24, &raw_ds_selector);
read_virtual_word (BX_SEG_REG_SS, temp_ESP+28, &raw_fs_selector);
read_virtual_word (BX_SEG_REG_SS, temp_ESP+32, &raw_gs_selector);
raw_es_selector = read_virtual_word(BX_SEG_REG_SS, temp_ESP+20);
raw_ds_selector = read_virtual_word(BX_SEG_REG_SS, temp_ESP+24);
raw_fs_selector = read_virtual_word(BX_SEG_REG_SS, temp_ESP+28);
raw_gs_selector = read_virtual_word(BX_SEG_REG_SS, temp_ESP+32);
writeEFlags(flags32, EFlagsValidMask);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fpu.cc,v 1.28 2007-12-20 18:29:39 sshwarts Exp $
// $Id: fpu.cc,v 1.29 2007-12-20 20:58:38 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
@ -193,21 +193,21 @@ int BX_CPU_C::fpu_load_environment(bxInstruction_c *i)
{
Bit32u tmp;
read_virtual_dword(i->seg(), RMAddr(i), &tmp);
tmp = read_virtual_dword(i->seg(), RMAddr(i));
BX_CPU_THIS_PTR the_i387.cwd = tmp & 0xffff;
read_virtual_dword(i->seg(), RMAddr(i) + 0x04, &tmp);
tmp = read_virtual_dword(i->seg(), RMAddr(i) + 0x04);
BX_CPU_THIS_PTR the_i387.swd = tmp & 0xffff;
BX_CPU_THIS_PTR the_i387.tos = (tmp >> 11) & 0x07;
read_virtual_dword(i->seg(), RMAddr(i) + 0x08, &tmp);
tmp = read_virtual_dword(i->seg(), RMAddr(i) + 0x08);
BX_CPU_THIS_PTR the_i387.twd = tmp & 0xffff;
read_virtual_dword(i->seg(), RMAddr(i) + 0x0c, &tmp);
tmp = read_virtual_dword(i->seg(), RMAddr(i) + 0x0c);
BX_CPU_THIS_PTR the_i387.fip = tmp;
read_virtual_dword(i->seg(), RMAddr(i) + 0x10, &tmp);
tmp = read_virtual_dword(i->seg(), RMAddr(i) + 0x10);
BX_CPU_THIS_PTR the_i387.fcs = tmp & 0xffff;
BX_CPU_THIS_PTR the_i387.foo = (tmp >> 16) & 0x07ff;
read_virtual_dword(i->seg(), RMAddr(i) + 0x14, &tmp);
tmp = read_virtual_dword(i->seg(), RMAddr(i) + 0x14);
BX_CPU_THIS_PTR the_i387.fdp = tmp;
read_virtual_dword(i->seg(), RMAddr(i) + 0x18, &tmp);
tmp = read_virtual_dword(i->seg(), RMAddr(i) + 0x18);
BX_CPU_THIS_PTR the_i387.fds = tmp & 0xffff;
offset = 0x1c;
}
@ -215,20 +215,20 @@ int BX_CPU_C::fpu_load_environment(bxInstruction_c *i)
{
Bit16u tmp;
read_virtual_word(i->seg(), RMAddr(i), &tmp);
tmp = read_virtual_word(i->seg(), RMAddr(i));
BX_CPU_THIS_PTR the_i387.cwd = tmp;
read_virtual_word(i->seg(), RMAddr(i) + 0x2, &tmp);
tmp = read_virtual_word(i->seg(), RMAddr(i) + 0x2);
BX_CPU_THIS_PTR the_i387.swd = tmp;
BX_CPU_THIS_PTR the_i387.tos = (tmp >> 11) & 0x07;
read_virtual_word(i->seg(), RMAddr(i) + 0x04, &tmp);
tmp = read_virtual_word(i->seg(), RMAddr(i) + 0x04);
BX_CPU_THIS_PTR the_i387.twd = tmp;
read_virtual_word(i->seg(), RMAddr(i) + 0x06, &tmp);
tmp = read_virtual_word(i->seg(), RMAddr(i) + 0x06);
BX_CPU_THIS_PTR the_i387.fip = tmp & 0xffff;
read_virtual_word(i->seg(), RMAddr(i) + 0x08, &tmp);
tmp = read_virtual_word(i->seg(), RMAddr(i) + 0x08);
BX_CPU_THIS_PTR the_i387.fcs = tmp;
read_virtual_word(i->seg(), RMAddr(i) + 0x0a, &tmp);
tmp = read_virtual_word(i->seg(), RMAddr(i) + 0x0a);
BX_CPU_THIS_PTR the_i387.fdp = tmp & 0xffff;
read_virtual_word(i->seg(), RMAddr(i) + 0x0c, &tmp);
tmp = read_virtual_word(i->seg(), RMAddr(i) + 0x0c);
BX_CPU_THIS_PTR the_i387.fds = tmp;
/* opcode is defined to be zero */
BX_CPU_THIS_PTR the_i387.foo = 0;
@ -243,23 +243,23 @@ int BX_CPU_C::fpu_load_environment(bxInstruction_c *i)
{
Bit32u tmp;
read_virtual_dword(i->seg(), RMAddr(i), &tmp);
tmp = read_virtual_dword(i->seg(), RMAddr(i));
BX_CPU_THIS_PTR the_i387.cwd = tmp & 0xffff;
read_virtual_dword(i->seg(), RMAddr(i) + 0x04, &tmp);
tmp = read_virtual_dword(i->seg(), RMAddr(i) + 0x04);
BX_CPU_THIS_PTR the_i387.swd = tmp & 0xffff;
BX_CPU_THIS_PTR the_i387.tos = (tmp >> 11) & 0x07;
read_virtual_dword(i->seg(), RMAddr(i) + 0x08, &tmp);
tmp = read_virtual_dword(i->seg(), RMAddr(i) + 0x08);
BX_CPU_THIS_PTR the_i387.twd = tmp & 0xffff;
read_virtual_dword(i->seg(), RMAddr(i) + 0x0c, &tmp);
tmp = read_virtual_dword(i->seg(), RMAddr(i) + 0x0c);
fp_ip = tmp & 0xffff;
read_virtual_dword(i->seg(), RMAddr(i) + 0x10, &tmp);
tmp = read_virtual_dword(i->seg(), RMAddr(i) + 0x10);
fp_ip = fp_ip | ((tmp & 0x0ffff000) << 4);
BX_CPU_THIS_PTR the_i387.fip = fp_ip;
BX_CPU_THIS_PTR the_i387.foo = tmp & 0x07ff;
BX_CPU_THIS_PTR the_i387.fcs = 0;
read_virtual_dword(i->seg(), RMAddr(i) + 0x14, &tmp);
tmp = read_virtual_dword(i->seg(), RMAddr(i) + 0x14);
fp_dp = tmp & 0xffff;
read_virtual_dword(i->seg(), RMAddr(i) + 0x18, &tmp);
tmp = read_virtual_dword(i->seg(), RMAddr(i) + 0x18);
fp_dp = fp_dp | ((tmp & 0x0ffff000) << 4);
BX_CPU_THIS_PTR the_i387.fdp = fp_dp;
BX_CPU_THIS_PTR the_i387.fds = 0;
@ -269,23 +269,23 @@ int BX_CPU_C::fpu_load_environment(bxInstruction_c *i)
{
Bit16u tmp;
read_virtual_word(i->seg(), RMAddr(i), &tmp);
tmp = read_virtual_word(i->seg(), RMAddr(i));
BX_CPU_THIS_PTR the_i387.cwd = tmp;
read_virtual_word(i->seg(), RMAddr(i) + 0x2, &tmp);
tmp = read_virtual_word(i->seg(), RMAddr(i) + 0x2);
BX_CPU_THIS_PTR the_i387.swd = tmp;
BX_CPU_THIS_PTR the_i387.tos = (tmp >> 11) & 0x07;
read_virtual_word(i->seg(), RMAddr(i) + 0x04, &tmp);
tmp = read_virtual_word(i->seg(), RMAddr(i) + 0x04);
BX_CPU_THIS_PTR the_i387.twd = tmp;
read_virtual_word(i->seg(), RMAddr(i) + 0x06, &tmp);
tmp = read_virtual_word(i->seg(), RMAddr(i) + 0x06);
fp_ip = tmp & 0xffff;
read_virtual_word(i->seg(), RMAddr(i) + 0x08, &tmp);
tmp = read_virtual_word(i->seg(), RMAddr(i) + 0x08);
fp_ip = fp_ip | ((tmp & 0xf000) << 4);
BX_CPU_THIS_PTR the_i387.fip = fp_ip;
BX_CPU_THIS_PTR the_i387.foo = tmp & 0x07ff;
BX_CPU_THIS_PTR the_i387.fcs = 0;
read_virtual_word(i->seg(), RMAddr(i) + 0x0a, &tmp);
tmp = read_virtual_word(i->seg(), RMAddr(i) + 0x0a);
fp_dp = tmp & 0xffff;
read_virtual_word(i->seg(), RMAddr(i) + 0x0c, &tmp);
tmp = read_virtual_word(i->seg(), RMAddr(i) + 0x0c);
fp_dp = fp_dp | ((tmp & 0xf000) << 4);
BX_CPU_THIS_PTR the_i387.fdp = fp_dp;
BX_CPU_THIS_PTR the_i387.fds = 0;
@ -314,8 +314,7 @@ void BX_CPU_C::FLDCW(bxInstruction_c *i)
{
#if BX_SUPPORT_FPU
BX_CPU_THIS_PTR prepareFPU(i, CHECK_PENDING_EXCEPTIONS, !UPDATE_LAST_OPCODE);
Bit16u cwd;
read_virtual_word(i->seg(), RMAddr(i), &cwd);
Bit16u cwd = read_virtual_word(i->seg(), RMAddr(i));
FPU_CONTROL_WORD = cwd;
/* check for unmasked exceptions */

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fpu_arith.cc,v 1.9 2007-03-23 21:27:13 sshwarts Exp $
// $Id: fpu_arith.cc,v 1.10 2007-12-20 20:58:38 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
@ -139,8 +139,7 @@ void BX_CPU_C::FADD_SINGLE_REAL(bxInstruction_c *i)
return;
}
float32 load_reg;
read_virtual_dword(i->seg(), RMAddr(i), &load_reg);
float32 load_reg = read_virtual_dword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -170,8 +169,7 @@ void BX_CPU_C::FADD_DOUBLE_REAL(bxInstruction_c *i)
return;
}
float64 load_reg;
read_virtual_qword(i->seg(), RMAddr(i), &load_reg);
float64 load_reg = read_virtual_qword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -201,8 +199,7 @@ void BX_CPU_C::FIADD_WORD_INTEGER(bxInstruction_c *i)
return;
}
Bit16s load_reg;
read_virtual_word(i->seg(), RMAddr(i), (Bit16u*)(&load_reg));
Bit16s load_reg = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
floatx80 a = BX_READ_FPU_REG(0);
floatx80 b = int32_to_floatx80((Bit32s)(load_reg));
@ -234,8 +231,7 @@ void BX_CPU_C::FIADD_DWORD_INTEGER(bxInstruction_c *i)
return;
}
Bit32s load_reg;
read_virtual_dword(i->seg(), RMAddr(i), (Bit32u*)(&load_reg));
Bit32s load_reg = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
floatx80 a = BX_READ_FPU_REG(0);
floatx80 b = int32_to_floatx80(load_reg);
@ -331,8 +327,7 @@ void BX_CPU_C::FMUL_SINGLE_REAL(bxInstruction_c *i)
return;
}
float32 load_reg;
read_virtual_dword(i->seg(), RMAddr(i), &load_reg);
float32 load_reg = read_virtual_dword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -362,8 +357,7 @@ void BX_CPU_C::FMUL_DOUBLE_REAL(bxInstruction_c *i)
return;
}
float64 load_reg;
read_virtual_qword(i->seg(), RMAddr(i), &load_reg);
float64 load_reg = read_virtual_qword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -393,8 +387,7 @@ void BX_CPU_C::FIMUL_WORD_INTEGER(bxInstruction_c *i)
return;
}
Bit16s load_reg;
read_virtual_word(i->seg(), RMAddr(i), (Bit16u*)(&load_reg));
Bit16s load_reg = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
floatx80 a = BX_READ_FPU_REG(0);
floatx80 b = int32_to_floatx80((Bit32s)(load_reg));
@ -426,8 +419,7 @@ void BX_CPU_C::FIMUL_DWORD_INTEGER(bxInstruction_c *i)
return;
}
Bit32s load_reg;
read_virtual_dword(i->seg(), RMAddr(i), (Bit32u*)(&load_reg));
Bit32s load_reg = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
floatx80 a = BX_READ_FPU_REG(0);
floatx80 b = int32_to_floatx80(load_reg);
@ -589,8 +581,7 @@ void BX_CPU_C::FSUB_SINGLE_REAL(bxInstruction_c *i)
return;
}
float32 load_reg;
read_virtual_dword(i->seg(), RMAddr(i), &load_reg);
float32 load_reg = read_virtual_dword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -620,8 +611,7 @@ void BX_CPU_C::FSUBR_SINGLE_REAL(bxInstruction_c *i)
return;
}
float32 load_reg;
read_virtual_dword(i->seg(), RMAddr(i), &load_reg);
float32 load_reg = read_virtual_dword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -651,8 +641,7 @@ void BX_CPU_C::FSUB_DOUBLE_REAL(bxInstruction_c *i)
return;
}
float64 load_reg;
read_virtual_qword(i->seg(), RMAddr(i), &load_reg);
float64 load_reg = read_virtual_qword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -682,8 +671,7 @@ void BX_CPU_C::FSUBR_DOUBLE_REAL(bxInstruction_c *i)
return;
}
float64 load_reg;
read_virtual_qword(i->seg(), RMAddr(i), &load_reg);
float64 load_reg = read_virtual_qword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -713,8 +701,7 @@ void BX_CPU_C::FISUB_WORD_INTEGER(bxInstruction_c *i)
return;
}
Bit16s load_reg;
read_virtual_word(i->seg(), RMAddr(i), (Bit16u*)(&load_reg));
Bit16s load_reg = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
floatx80 a = BX_READ_FPU_REG(0);
floatx80 b = int32_to_floatx80((Bit32s)(load_reg));
@ -746,8 +733,7 @@ void BX_CPU_C::FISUBR_WORD_INTEGER(bxInstruction_c *i)
return;
}
Bit16s load_reg;
read_virtual_word(i->seg(), RMAddr(i), (Bit16u*)(&load_reg));
Bit16s load_reg = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
floatx80 a = int32_to_floatx80((Bit32s)(load_reg));
floatx80 b = BX_READ_FPU_REG(0);
@ -779,8 +765,7 @@ void BX_CPU_C::FISUB_DWORD_INTEGER(bxInstruction_c *i)
return;
}
Bit32s load_reg;
read_virtual_dword(i->seg(), RMAddr(i), (Bit32u*)(&load_reg));
Bit32s load_reg = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
floatx80 a = BX_READ_FPU_REG(0);
floatx80 b = int32_to_floatx80(load_reg);
@ -813,8 +798,7 @@ void BX_CPU_C::FISUBR_DWORD_INTEGER(bxInstruction_c *i)
return;
}
Bit32s load_reg;
read_virtual_dword(i->seg(), RMAddr(i), (Bit32u*)(&load_reg));
Bit32s load_reg = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
floatx80 a = int32_to_floatx80(load_reg);
floatx80 b = BX_READ_FPU_REG(0);
@ -974,8 +958,7 @@ void BX_CPU_C::FDIV_SINGLE_REAL(bxInstruction_c *i)
return;
}
float32 load_reg;
read_virtual_dword(i->seg(), RMAddr(i), &load_reg);
float32 load_reg = read_virtual_dword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -1005,8 +988,7 @@ void BX_CPU_C::FDIVR_SINGLE_REAL(bxInstruction_c *i)
return;
}
float32 load_reg;
read_virtual_dword(i->seg(), RMAddr(i), &load_reg);
float32 load_reg = read_virtual_dword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -1036,8 +1018,7 @@ void BX_CPU_C::FDIV_DOUBLE_REAL(bxInstruction_c *i)
return;
}
float64 load_reg;
read_virtual_qword(i->seg(), RMAddr(i), &load_reg);
float64 load_reg = read_virtual_qword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -1067,8 +1048,7 @@ void BX_CPU_C::FDIVR_DOUBLE_REAL(bxInstruction_c *i)
return;
}
float64 load_reg;
read_virtual_qword(i->seg(), RMAddr(i), &load_reg);
float64 load_reg = read_virtual_qword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -1098,8 +1078,7 @@ void BX_CPU_C::FIDIV_WORD_INTEGER(bxInstruction_c *i)
return;
}
Bit16s load_reg;
read_virtual_word(i->seg(), RMAddr(i), (Bit16u*)(&load_reg));
Bit16s load_reg = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
floatx80 a = BX_READ_FPU_REG(0);
floatx80 b = int32_to_floatx80((Bit32s)(load_reg));
@ -1131,8 +1110,7 @@ void BX_CPU_C::FIDIVR_WORD_INTEGER(bxInstruction_c *i)
return;
}
Bit16s load_reg;
read_virtual_word(i->seg(), RMAddr(i), (Bit16u*)(&load_reg));
Bit16s load_reg = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
floatx80 a = int32_to_floatx80((Bit32s)(load_reg));
floatx80 b = BX_READ_FPU_REG(0);
@ -1164,8 +1142,7 @@ void BX_CPU_C::FIDIV_DWORD_INTEGER(bxInstruction_c *i)
return;
}
Bit32s load_reg;
read_virtual_dword(i->seg(), RMAddr(i), (Bit32u*)(&load_reg));
Bit32s load_reg = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
floatx80 a = BX_READ_FPU_REG(0);
floatx80 b = int32_to_floatx80(load_reg);
@ -1197,8 +1174,7 @@ void BX_CPU_C::FIDIVR_DWORD_INTEGER(bxInstruction_c *i)
return;
}
Bit32s load_reg;
read_virtual_dword(i->seg(), RMAddr(i), (Bit32u*)(&load_reg));
Bit32s load_reg = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
floatx80 a = int32_to_floatx80(load_reg);
floatx80 b = BX_READ_FPU_REG(0);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fpu_compare.cc,v 1.10 2007-04-02 10:46:57 sshwarts Exp $
// $Id: fpu_compare.cc,v 1.11 2007-12-20 20:58:38 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
@ -261,8 +261,7 @@ void BX_CPU_C::FCOM_SINGLE_REAL(bxInstruction_c *i)
return;
}
float32 load_reg;
read_virtual_dword(i->seg(), RMAddr(i), &load_reg);
float32 load_reg = read_virtual_dword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -305,8 +304,7 @@ void BX_CPU_C::FCOM_DOUBLE_REAL(bxInstruction_c *i)
return;
}
float64 load_reg;
read_virtual_qword(i->seg(), RMAddr(i), &load_reg);
float64 load_reg = read_virtual_qword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -349,8 +347,7 @@ void BX_CPU_C::FICOM_WORD_INTEGER(bxInstruction_c *i)
return;
}
Bit16s load_reg;
read_virtual_word(i->seg(), RMAddr(i), (Bit16u*)(&load_reg));
Bit16s load_reg = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -393,8 +390,7 @@ void BX_CPU_C::FICOM_DWORD_INTEGER(bxInstruction_c *i)
return;
}
Bit32s load_reg;
read_virtual_dword(i->seg(), RMAddr(i), (Bit32u*)(&load_reg));
Bit32s load_reg = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fpu_load_store.cc,v 1.13 2007-12-20 18:29:42 sshwarts Exp $
// $Id: fpu_load_store.cc,v 1.14 2007-12-20 20:58:38 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003 Stanislav Shwartsman
@ -72,8 +72,7 @@ void BX_CPU_C::FLD_SINGLE_REAL(bxInstruction_c *i)
return;
}
float32 load_reg;
read_virtual_dword(i->seg(), RMAddr(i), &load_reg);
float32 load_reg = read_virtual_dword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -104,8 +103,7 @@ void BX_CPU_C::FLD_DOUBLE_REAL(bxInstruction_c *i)
return;
}
float64 load_reg;
read_virtual_qword(i->seg(), RMAddr(i), &load_reg);
float64 load_reg = read_virtual_qword(i->seg(), RMAddr(i));
float_status_t status =
FPU_pre_exception_handling(BX_CPU_THIS_PTR the_i387.get_control_word());
@ -160,8 +158,7 @@ void BX_CPU_C::FILD_WORD_INTEGER(bxInstruction_c *i)
return;
}
Bit16s load_reg;
read_virtual_word(i->seg(), RMAddr(i), (Bit16u*)(&load_reg));
Bit16s load_reg = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
floatx80 result = int32_to_floatx80((Bit32s) load_reg);
BX_CPU_THIS_PTR the_i387.FPU_push();
@ -185,8 +182,7 @@ void BX_CPU_C::FILD_DWORD_INTEGER(bxInstruction_c *i)
return;
}
Bit32s load_reg;
read_virtual_dword(i->seg(), RMAddr(i), (Bit32u*)(&load_reg));
Bit32s load_reg = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
floatx80 result = int32_to_floatx80(load_reg);
BX_CPU_THIS_PTR the_i387.FPU_push();
@ -210,8 +206,7 @@ void BX_CPU_C::FILD_QWORD_INTEGER(bxInstruction_c *i)
return;
}
Bit64s load_reg;
read_virtual_qword(i->seg(), RMAddr(i), (Bit64u*)(&load_reg));
Bit64s load_reg = (Bit64s) read_virtual_qword(i->seg(), RMAddr(i));
floatx80 result = int64_to_floatx80(load_reg);
BX_CPU_THIS_PTR the_i387.FPU_push();
@ -235,12 +230,9 @@ void BX_CPU_C::FBLD_PACKED_BCD(bxInstruction_c *i)
return;
}
Bit16u hi2;
Bit64u lo8;
// read packed bcd from memory
read_virtual_qword(i->seg(), RMAddr(i), &lo8);
read_virtual_word (i->seg(), RMAddr(i) + 8, &hi2);
Bit16u lo8 = read_virtual_qword(i->seg(), RMAddr(i));
Bit16u hi2 = read_virtual_word (i->seg(), RMAddr(i) + 8);
Bit64s scale = 1;
Bit64s val64 = 0;