small cleanup
This commit is contained in:
parent
d54d537f81
commit
d739cca282
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: paging.cc,v 1.95 2007-12-03 20:49:24 sshwarts Exp $
|
||||
// $Id: paging.cc,v 1.96 2007-12-06 18:35:33 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -761,9 +761,8 @@ bx_phy_address BX_CPU_C::translate_linear(bx_address laddr, unsigned pl, unsigne
|
||||
ppf = (pde & BX_CONST64(0x000fffffffe00000)) | (laddr & 0x001ff000);
|
||||
|
||||
#if BX_SUPPORT_GLOBAL_PAGES
|
||||
if (BX_CPU_THIS_PTR cr4.get_PGE()) {
|
||||
combined_access |= (pde & TLB_GlobalPage); // G
|
||||
}
|
||||
if (BX_CPU_THIS_PTR cr4.get_PGE())
|
||||
combined_access |= (pde & TLB_GlobalPage); // G
|
||||
#endif
|
||||
|
||||
priv_index =
|
||||
@ -827,9 +826,8 @@ bx_phy_address BX_CPU_C::translate_linear(bx_address laddr, unsigned pl, unsigne
|
||||
ppf = pte & BX_CONST64(0x000ffffffffff000);
|
||||
|
||||
#if BX_SUPPORT_GLOBAL_PAGES
|
||||
if (BX_CPU_THIS_PTR cr4.get_PGE()) {
|
||||
combined_access |= (pte & TLB_GlobalPage); // G
|
||||
}
|
||||
if (BX_CPU_THIS_PTR cr4.get_PGE())
|
||||
combined_access |= (pte & TLB_GlobalPage); // G
|
||||
#endif
|
||||
|
||||
priv_index =
|
||||
@ -889,9 +887,8 @@ bx_phy_address BX_CPU_C::translate_linear(bx_address laddr, unsigned pl, unsigne
|
||||
ppf = (pde & 0xffc00000) | (laddr & 0x003ff000);
|
||||
|
||||
#if BX_SUPPORT_GLOBAL_PAGES
|
||||
if (BX_CPU_THIS_PTR cr4.get_PGE()) {
|
||||
combined_access |= pde & TLB_GlobalPage; // {G}
|
||||
}
|
||||
if (BX_CPU_THIS_PTR cr4.get_PGE())
|
||||
combined_access |= pde & TLB_GlobalPage; // {G}
|
||||
#endif
|
||||
|
||||
priv_index =
|
||||
@ -914,12 +911,6 @@ bx_phy_address BX_CPU_C::translate_linear(bx_address laddr, unsigned pl, unsigne
|
||||
else // else normal 4K page...
|
||||
#endif
|
||||
{
|
||||
// Update PDE A bit if needed.
|
||||
if (!(pde & 0x20)) {
|
||||
pde |= 0x20;
|
||||
BX_CPU_THIS_PTR mem->writePhysicalPage(BX_CPU_THIS, pde_addr, 4, &pde);
|
||||
}
|
||||
|
||||
// Get page table entry
|
||||
bx_phy_address pte_addr = (pde & 0xfffff000) | ((laddr & 0x003ff000) >> 10);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: shift16.cc,v 1.36 2007-12-06 16:57:59 sshwarts Exp $
|
||||
// $Id: shift16.cc,v 1.37 2007-12-06 18:35:33 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -141,10 +141,11 @@ void BX_CPU_C::ROL_Ew(bxInstruction_c *i)
|
||||
{
|
||||
Bit16u op1_16, result_16;
|
||||
unsigned count;
|
||||
unsigned bit0, bit15;
|
||||
|
||||
if ( i->b1() == 0xc1 )
|
||||
if (i->b1() == 0xc1)
|
||||
count = i->Ib();
|
||||
else if ( i->b1() == 0xd1 )
|
||||
else if (i->b1() == 0xd1)
|
||||
count = 1;
|
||||
else // 0xd3
|
||||
count = CL;
|
||||
@ -158,14 +159,16 @@ void BX_CPU_C::ROL_Ew(bxInstruction_c *i)
|
||||
read_RMW_virtual_word(i->seg(), RMAddr(i), &op1_16);
|
||||
}
|
||||
|
||||
if ( (count & 0x0f) == 0 ) {
|
||||
if ( count & 0x10 ) {
|
||||
unsigned bit0 = op1_16 & 1;
|
||||
set_CF(bit0);
|
||||
set_OF(bit0 ^ (op1_16 >> 15));
|
||||
if ((count & 0x0f) == 0) {
|
||||
if (count & 0x10) {
|
||||
bit0 = (op1_16 & 0x1);
|
||||
bit15 = (op1_16 >> 15);
|
||||
|
||||
SET_FLAGS_OxxxxC(bit0 ^ bit15, bit0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
count &= 0x0f; // only use bottom 4 bits
|
||||
|
||||
result_16 = (op1_16 << count) | (op1_16 >> (16 - count));
|
||||
@ -181,20 +184,21 @@ void BX_CPU_C::ROL_Ew(bxInstruction_c *i)
|
||||
/* set eflags:
|
||||
* ROL count affects the following flags: C, O
|
||||
*/
|
||||
bx_bool temp_CF = (result_16 & 0x01);
|
||||
bit0 = (result_16 & 0x1);
|
||||
bit15 = (result_16 >> 15);
|
||||
|
||||
set_CF(temp_CF);
|
||||
set_OF(temp_CF ^ (result_16 >> 15));
|
||||
SET_FLAGS_OxxxxC(bit0 ^ bit15, bit0);
|
||||
}
|
||||
|
||||
void BX_CPU_C::ROR_Ew(bxInstruction_c *i)
|
||||
{
|
||||
Bit16u op1_16, result_16;
|
||||
unsigned count;
|
||||
unsigned bit14, bit15;
|
||||
|
||||
if ( i->b1() == 0xc1 )
|
||||
if (i->b1() == 0xc1)
|
||||
count = i->Ib();
|
||||
else if ( i->b1() == 0xd1 )
|
||||
else if (i->b1() == 0xd1)
|
||||
count = 1;
|
||||
else // 0xd3
|
||||
count = CL;
|
||||
@ -210,13 +214,14 @@ void BX_CPU_C::ROR_Ew(bxInstruction_c *i)
|
||||
|
||||
if ( (count & 0x0f) == 0 ) {
|
||||
if ( count & 0x10 ) {
|
||||
unsigned bit14 = (op1_16 >> 14) & 1;
|
||||
unsigned bit15 = (op1_16 >> 15);
|
||||
set_CF(bit15);
|
||||
set_OF(bit15 ^ bit14);
|
||||
bit14 = (op1_16 >> 14) & 1;
|
||||
bit15 = (op1_16 >> 15) & 1;
|
||||
|
||||
SET_FLAGS_OxxxxC(bit14 ^ bit15, bit15);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
count &= 0x0f; // use only 4 LSB's
|
||||
|
||||
result_16 = (op1_16 >> count) | (op1_16 << (16 - count));
|
||||
@ -232,11 +237,10 @@ void BX_CPU_C::ROR_Ew(bxInstruction_c *i)
|
||||
/* set eflags:
|
||||
* ROR count affects the following flags: C, O
|
||||
*/
|
||||
bx_bool result_b15 = (result_16 & 0x8000) != 0;
|
||||
bx_bool result_b14 = (result_16 & 0x4000) != 0;
|
||||
bit14 = (result_16 >> 14) & 1;
|
||||
bit15 = (result_16 >> 15) & 1;
|
||||
|
||||
set_CF(result_b15);
|
||||
set_OF(result_b15 ^ result_b14);
|
||||
SET_FLAGS_OxxxxC(bit14 ^ bit15, bit15);
|
||||
}
|
||||
|
||||
void BX_CPU_C::RCL_Ew(bxInstruction_c *i)
|
||||
@ -297,9 +301,9 @@ void BX_CPU_C::RCR_Ew(bxInstruction_c *i)
|
||||
Bit16u op1_16, result_16;
|
||||
unsigned count;
|
||||
|
||||
if ( i->b1() == 0xc1 )
|
||||
if (i->b1() == 0xc1)
|
||||
count = i->Ib();
|
||||
else if ( i->b1() == 0xd1 )
|
||||
else if (i->b1() == 0xd1)
|
||||
count = 1;
|
||||
else // 0xd3
|
||||
count = CL;
|
||||
@ -317,9 +321,8 @@ void BX_CPU_C::RCR_Ew(bxInstruction_c *i)
|
||||
|
||||
if (! count) return;
|
||||
|
||||
result_16 = (op1_16 >> count) |
|
||||
(getB_CF() << (16 - count)) |
|
||||
(op1_16 << (17 - count));
|
||||
result_16 = (op1_16 >> count) | (getB_CF() << (16 - count)) |
|
||||
(op1_16 << (17 - count));
|
||||
|
||||
/* now write result back to destination */
|
||||
if (i->modC0()) {
|
||||
@ -342,9 +345,9 @@ void BX_CPU_C::SHL_Ew(bxInstruction_c *i)
|
||||
Bit16u op1_16, result_16;
|
||||
unsigned count;
|
||||
|
||||
if ( i->b1() == 0xc1 )
|
||||
if (i->b1() == 0xc1)
|
||||
count = i->Ib();
|
||||
else if ( i->b1() == 0xd1 )
|
||||
else if (i->b1() == 0xd1)
|
||||
count = 1;
|
||||
else // 0xd3
|
||||
count = CL;
|
||||
@ -380,9 +383,9 @@ void BX_CPU_C::SHR_Ew(bxInstruction_c *i)
|
||||
Bit16u op1_16, result_16;
|
||||
unsigned count;
|
||||
|
||||
if ( i->b1() == 0xc1 )
|
||||
if (i->b1() == 0xc1)
|
||||
count = i->Ib();
|
||||
else if ( i->b1() == 0xd1 )
|
||||
else if (i->b1() == 0xd1)
|
||||
count = 1;
|
||||
else // 0xd3
|
||||
count = CL;
|
||||
@ -417,9 +420,9 @@ void BX_CPU_C::SAR_Ew(bxInstruction_c *i)
|
||||
Bit16u op1_16, result_16;
|
||||
unsigned count;
|
||||
|
||||
if ( i->b1() == 0xc1 )
|
||||
if (i->b1() == 0xc1)
|
||||
count = i->Ib();
|
||||
else if ( i->b1() == 0xd1 )
|
||||
else if (i->b1() == 0xd1)
|
||||
count = 1;
|
||||
else // 0xd3
|
||||
count = CL;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: shift64.cc,v 1.25 2007-12-06 16:57:59 sshwarts Exp $
|
||||
// $Id: shift64.cc,v 1.26 2007-12-06 18:35:33 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -384,11 +384,11 @@ void BX_CPU_C::SAR_Eq(bxInstruction_c *i)
|
||||
|
||||
/* op1 is a register or memory reference */
|
||||
if (i->modC0()) {
|
||||
op1_64 = BX_READ_64BIT_REG(i->rm());
|
||||
op1_64 = BX_READ_64BIT_REG(i->rm());
|
||||
}
|
||||
else {
|
||||
/* pointer, segment address pair */
|
||||
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
|
||||
/* pointer, segment address pair */
|
||||
read_RMW_virtual_qword(i->seg(), RMAddr(i), &op1_64);
|
||||
}
|
||||
|
||||
if (!count) return;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: shift8.cc,v 1.29 2007-12-06 16:57:59 sshwarts Exp $
|
||||
// $Id: shift8.cc,v 1.30 2007-12-06 18:35:33 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -36,6 +36,7 @@ void BX_CPU_C::ROL_Eb(bxInstruction_c *i)
|
||||
{
|
||||
Bit8u op1_8, result_8;
|
||||
unsigned count;
|
||||
unsigned bit0, bit7;
|
||||
|
||||
if (i->b1() == 0xc0)
|
||||
count = i->Ib();
|
||||
@ -53,14 +54,15 @@ void BX_CPU_C::ROL_Eb(bxInstruction_c *i)
|
||||
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
|
||||
}
|
||||
|
||||
if ( (count & 0x07) == 0 ) {
|
||||
if ( count & 0x18 ) {
|
||||
unsigned bit0 = op1_8 & 1;
|
||||
set_CF(bit0);
|
||||
set_OF(bit0 ^ (op1_8 >> 7));
|
||||
if ((count & 0x07) == 0) {
|
||||
if (count & 0x18) {
|
||||
bit0 = (op1_8 & 1);
|
||||
bit7 = (op1_8 >> 7);
|
||||
SET_FLAGS_OxxxxC(bit0 ^ bit7, bit0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
count &= 0x07; // use only lowest 3 bits
|
||||
|
||||
result_8 = (op1_8 << count) | (op1_8 >> (8 - count));
|
||||
@ -76,16 +78,18 @@ void BX_CPU_C::ROL_Eb(bxInstruction_c *i)
|
||||
/* set eflags:
|
||||
* ROL count affects the following flags: C, O
|
||||
*/
|
||||
bx_bool temp_CF = (result_8 & 0x01);
|
||||
|
||||
set_CF(temp_CF);
|
||||
set_OF(temp_CF ^ (result_8 >> 7));
|
||||
bit0 = (result_8 & 1);
|
||||
bit7 = (result_8 >> 7);
|
||||
|
||||
SET_FLAGS_OxxxxC(bit0 ^ bit7, bit0);
|
||||
}
|
||||
|
||||
void BX_CPU_C::ROR_Eb(bxInstruction_c *i)
|
||||
{
|
||||
Bit8u op1_8, result_8;
|
||||
unsigned count;
|
||||
unsigned bit6, bit7;
|
||||
|
||||
if (i->b1() == 0xc0)
|
||||
count = i->Ib();
|
||||
@ -103,12 +107,12 @@ void BX_CPU_C::ROR_Eb(bxInstruction_c *i)
|
||||
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
|
||||
}
|
||||
|
||||
if ( (count & 0x07) == 0 ) {
|
||||
if ( count & 0x18 ) {
|
||||
unsigned bit6 = (op1_8 >> 6) & 1;
|
||||
unsigned bit7 = (op1_8 >> 7);
|
||||
set_CF(bit7);
|
||||
set_OF(bit7 ^ bit6);
|
||||
if ((count & 0x07) == 0) {
|
||||
if (count & 0x18) {
|
||||
bit6 = (op1_8 >> 6) & 1;
|
||||
bit7 = (op1_8 >> 7) & 1;
|
||||
|
||||
SET_FLAGS_OxxxxC(bit6 ^ bit7, bit7);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -127,11 +131,11 @@ void BX_CPU_C::ROR_Eb(bxInstruction_c *i)
|
||||
/* set eflags:
|
||||
* ROR count affects the following flags: C, O
|
||||
*/
|
||||
bx_bool result_b7 = (result_8 & 0x80) != 0;
|
||||
bx_bool result_b6 = (result_8 & 0x40) != 0;
|
||||
|
||||
set_CF(result_b7);
|
||||
set_OF(result_b7 ^ result_b6);
|
||||
bit6 = (result_8 >> 6) & 1;
|
||||
bit7 = (result_8 >> 7) & 1;
|
||||
|
||||
SET_FLAGS_OxxxxC(bit6 ^ bit7, bit7);
|
||||
}
|
||||
|
||||
void BX_CPU_C::RCL_Eb(bxInstruction_c *i)
|
||||
@ -164,7 +168,7 @@ void BX_CPU_C::RCL_Eb(bxInstruction_c *i)
|
||||
}
|
||||
else {
|
||||
result_8 = (op1_8 << count) | (getB_CF() << (count - 1)) |
|
||||
(op1_8 >> (9 - count));
|
||||
(op1_8 >> (9 - count));
|
||||
}
|
||||
|
||||
/* now write result back to destination */
|
||||
|
Loading…
Reference in New Issue
Block a user