more optimizations after fetchdecode
This commit is contained in:
parent
d6562492a9
commit
db664c4012
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: access32.cc,v 1.16 2008-09-08 20:47:33 sshwarts Exp $
|
||||
// $Id: access32.cc,v 1.17 2008-09-16 20:57:15 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2008 Stanislav Shwartsman
|
||||
@ -406,9 +406,9 @@ accessOK:
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_READ);
|
||||
Bit8u *hostAddr = (Bit8u*) (hostPageAddr | pageOffset);
|
||||
data = *hostAddr;
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 1, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
@ -457,9 +457,9 @@ accessOK:
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_READ);
|
||||
Bit16u *hostAddr = (Bit16u*) (hostPageAddr | pageOffset);
|
||||
ReadHostWordFromLittleEndian(hostAddr, data);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 2, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
@ -518,9 +518,9 @@ accessOK:
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_READ);
|
||||
Bit32u *hostAddr = (Bit32u*) (hostPageAddr | pageOffset);
|
||||
ReadHostDWordFromLittleEndian(hostAddr, data);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 4, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
@ -579,9 +579,9 @@ accessOK:
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_READ);
|
||||
Bit64u *hostAddr = (Bit64u*) (hostPageAddr | pageOffset);
|
||||
ReadHostQWordFromLittleEndian(hostAddr, data);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 8, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
@ -639,10 +639,10 @@ accessOK:
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_READ);
|
||||
Bit64u *hostAddr = (Bit64u*) (hostPageAddr | pageOffset);
|
||||
ReadHostQWordFromLittleEndian(hostAddr, data->xmm64u(0));
|
||||
ReadHostQWordFromLittleEndian(hostAddr+1, data->xmm64u(1));
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 16, CPL, BX_READ, (Bit8u*) data);
|
||||
return;
|
||||
@ -696,10 +696,10 @@ accessOK:
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_READ);
|
||||
Bit64u *hostAddr = (Bit64u*) (hostPageAddr | pageOffset);
|
||||
ReadHostQWordFromLittleEndian(hostAddr, data->xmm64u(0));
|
||||
ReadHostQWordFromLittleEndian(hostAddr+1, data->xmm64u(1));
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 16, CPL, BX_READ, (Bit8u*) data);
|
||||
return;
|
||||
@ -753,13 +753,13 @@ accessOK:
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_RW);
|
||||
Bit8u *hostAddr = (Bit8u*) (hostPageAddr | pageOffset);
|
||||
#if BX_SUPPORT_ICACHE
|
||||
pageWriteStampTable.decWriteStamp(tlbEntry->ppf);
|
||||
#endif
|
||||
data = *hostAddr;
|
||||
BX_CPU_THIS_PTR address_xlation.pages = (bx_ptr_equiv_t) hostAddr;
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_RW);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 1, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
@ -808,13 +808,13 @@ accessOK:
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_RW);
|
||||
Bit16u *hostAddr = (Bit16u*) (hostPageAddr | pageOffset);
|
||||
#if BX_SUPPORT_ICACHE
|
||||
pageWriteStampTable.decWriteStamp(tlbEntry->ppf);
|
||||
#endif
|
||||
ReadHostWordFromLittleEndian(hostAddr, data);
|
||||
BX_CPU_THIS_PTR address_xlation.pages = (bx_ptr_equiv_t) hostAddr;
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_RW);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 2, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
@ -873,13 +873,13 @@ accessOK:
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_RW);
|
||||
Bit32u *hostAddr = (Bit32u*) (hostPageAddr | pageOffset);
|
||||
#if BX_SUPPORT_ICACHE
|
||||
pageWriteStampTable.decWriteStamp(tlbEntry->ppf);
|
||||
#endif
|
||||
ReadHostDWordFromLittleEndian(hostAddr, data);
|
||||
BX_CPU_THIS_PTR address_xlation.pages = (bx_ptr_equiv_t) hostAddr;
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_RW);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 4, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
@ -938,13 +938,13 @@ accessOK:
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_RW);
|
||||
Bit64u *hostAddr = (Bit64u*) (hostPageAddr | pageOffset);
|
||||
#if BX_SUPPORT_ICACHE
|
||||
pageWriteStampTable.decWriteStamp(tlbEntry->ppf);
|
||||
#endif
|
||||
ReadHostQWordFromLittleEndian(hostAddr, data);
|
||||
BX_CPU_THIS_PTR address_xlation.pages = (bx_ptr_equiv_t) hostAddr;
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_RW);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 8, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: access64.cc,v 1.18 2008-09-08 15:45:56 sshwarts Exp $
|
||||
// $Id: access64.cc,v 1.19 2008-09-16 20:57:15 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2008 Stanislav Shwartsman
|
||||
@ -339,9 +339,9 @@ BX_CPU_C::read_virtual_byte_64(unsigned s, Bit64u offset)
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_READ);
|
||||
Bit8u *hostAddr = (Bit8u*) (hostPageAddr | pageOffset);
|
||||
data = *hostAddr;
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 1, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
@ -380,9 +380,9 @@ BX_CPU_C::read_virtual_word_64(unsigned s, Bit64u offset)
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_READ);
|
||||
Bit16u *hostAddr = (Bit16u*) (hostPageAddr | pageOffset);
|
||||
ReadHostWordFromLittleEndian(hostAddr, data);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 2, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
@ -430,9 +430,9 @@ BX_CPU_C::read_virtual_dword_64(unsigned s, Bit64u offset)
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_READ);
|
||||
Bit32u *hostAddr = (Bit32u*) (hostPageAddr | pageOffset);
|
||||
ReadHostDWordFromLittleEndian(hostAddr, data);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 4, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
@ -480,9 +480,9 @@ BX_CPU_C::read_virtual_qword_64(unsigned s, Bit64u offset)
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_READ);
|
||||
Bit64u *hostAddr = (Bit64u*) (hostPageAddr | pageOffset);
|
||||
ReadHostQWordFromLittleEndian(hostAddr, data);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 8, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
@ -528,12 +528,12 @@ BX_CPU_C::read_virtual_dqword_64(unsigned s, Bit64u offset, BxPackedXmmRegister
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_READ);
|
||||
Bit64u *hostAddr = (Bit64u*) (hostPageAddr | pageOffset);
|
||||
ReadHostQWordFromLittleEndian(hostAddr, data->xmm64u(0));
|
||||
ReadHostQWordFromLittleEndian(hostAddr+1, data->xmm64u(1));
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 16, CPL, BX_READ, (Bit8u*) data);
|
||||
ReadHostQWordFromLittleEndian(hostAddr, data->xmm64u(0));
|
||||
ReadHostQWordFromLittleEndian(hostAddr+1, data->xmm64u(1));
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 16, CPL, BX_READ, (Bit8u*) data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -572,12 +572,12 @@ BX_CPU_C::read_virtual_dqword_aligned_64(unsigned s, Bit64u offset, BxPackedXmmR
|
||||
if (! (tlbEntry->accessBits & USER_PL)) { // Read this pl OK.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_READ);
|
||||
Bit64u *hostAddr = (Bit64u*) (hostPageAddr | pageOffset);
|
||||
ReadHostQWordFromLittleEndian(hostAddr, data->xmm64u(0));
|
||||
ReadHostQWordFromLittleEndian(hostAddr+1, data->xmm64u(1));
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 16, CPL, BX_READ, (Bit8u*) data);
|
||||
ReadHostQWordFromLittleEndian(hostAddr, data->xmm64u(0));
|
||||
ReadHostQWordFromLittleEndian(hostAddr+1, data->xmm64u(1));
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 16, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 16, CPL, BX_READ, (Bit8u*) data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -619,13 +619,13 @@ BX_CPU_C::read_RMW_virtual_byte_64(unsigned s, Bit64u offset)
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_RW);
|
||||
Bit8u *hostAddr = (Bit8u*) (hostPageAddr | pageOffset);
|
||||
#if BX_SUPPORT_ICACHE
|
||||
pageWriteStampTable.decWriteStamp(tlbEntry->ppf);
|
||||
#endif
|
||||
data = *hostAddr;
|
||||
BX_CPU_THIS_PTR address_xlation.pages = (bx_ptr_equiv_t) hostAddr;
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_RW);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 1, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
@ -664,13 +664,13 @@ BX_CPU_C::read_RMW_virtual_word_64(unsigned s, Bit64u offset)
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_RW);
|
||||
Bit16u *hostAddr = (Bit16u*) (hostPageAddr | pageOffset);
|
||||
#if BX_SUPPORT_ICACHE
|
||||
pageWriteStampTable.decWriteStamp(tlbEntry->ppf);
|
||||
#endif
|
||||
ReadHostWordFromLittleEndian(hostAddr, data);
|
||||
BX_CPU_THIS_PTR address_xlation.pages = (bx_ptr_equiv_t) hostAddr;
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_RW);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 2, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
@ -718,13 +718,13 @@ BX_CPU_C::read_RMW_virtual_dword_64(unsigned s, Bit64u offset)
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_RW);
|
||||
Bit32u *hostAddr = (Bit32u*) (hostPageAddr | pageOffset);
|
||||
#if BX_SUPPORT_ICACHE
|
||||
pageWriteStampTable.decWriteStamp(tlbEntry->ppf);
|
||||
#endif
|
||||
ReadHostDWordFromLittleEndian(hostAddr, data);
|
||||
BX_CPU_THIS_PTR address_xlation.pages = (bx_ptr_equiv_t) hostAddr;
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_RW);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 4, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
@ -772,13 +772,13 @@ BX_CPU_C::read_RMW_virtual_qword_64(unsigned s, Bit64u offset)
|
||||
if (! (tlbEntry->accessBits & (0x2 | USER_PL))) {
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_RW);
|
||||
Bit64u *hostAddr = (Bit64u*) (hostPageAddr | pageOffset);
|
||||
#if BX_SUPPORT_ICACHE
|
||||
pageWriteStampTable.decWriteStamp(tlbEntry->ppf);
|
||||
#endif
|
||||
ReadHostQWordFromLittleEndian(hostAddr, data);
|
||||
BX_CPU_THIS_PTR address_xlation.pages = (bx_ptr_equiv_t) hostAddr;
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 8, BX_RW);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 8, CPL, BX_READ, (Bit8u*) &data);
|
||||
return data;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.h,v 1.526 2008-09-16 19:20:02 sshwarts Exp $
|
||||
// $Id: cpu.h,v 1.527 2008-09-16 20:57:15 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -1683,6 +1683,9 @@ public: // for now...
|
||||
BX_SMF void LOAD_Eb_Resolve32BaseIndex(bxInstruction_c *) BX_CPP_AttrRegparmN(1);
|
||||
|
||||
BX_SMF void LOAD_Ew(bxInstruction_c *) BX_CPP_AttrRegparmN(1);
|
||||
BX_SMF void LOAD_Ew_Resolve16BaseIndex(bxInstruction_c *) BX_CPP_AttrRegparmN(1);
|
||||
BX_SMF void LOAD_Ew_Resolve32Base(bxInstruction_c *) BX_CPP_AttrRegparmN(1);
|
||||
BX_SMF void LOAD_Ew_Resolve32BaseIndex(bxInstruction_c *) BX_CPP_AttrRegparmN(1);
|
||||
|
||||
BX_SMF void LOAD_Ed(bxInstruction_c *) BX_CPP_AttrRegparmN(1);
|
||||
BX_SMF void LOAD_Ed_Resolve16BaseIndex(bxInstruction_c *) BX_CPP_AttrRegparmN(1);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: fetchdecode.cc,v 1.215 2008-09-16 19:22:13 sshwarts Exp $
|
||||
// $Id: fetchdecode.cc,v 1.216 2008-09-16 20:57:16 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -2987,9 +2987,9 @@ void BX_CPP_AttrRegparmN(2) BX_CPU_C::optimize32(bxInstruction_c *i, unsigned re
|
||||
};
|
||||
|
||||
static const BxExecutePtr_tR BxTableLoad32_Ew[3] = {
|
||||
&BX_CPU_C::LOAD_Ew,
|
||||
&BX_CPU_C::LOAD_Ew,
|
||||
&BX_CPU_C::LOAD_Ew
|
||||
&BX_CPU_C::LOAD_Ew_Resolve16BaseIndex,
|
||||
&BX_CPU_C::LOAD_Ew_Resolve32Base,
|
||||
&BX_CPU_C::LOAD_Ew_Resolve32BaseIndex
|
||||
};
|
||||
|
||||
static const BxExecutePtr_tR BxTableLoad32_Ed[3] = {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: load32.cc,v 1.1 2008-09-16 19:20:02 sshwarts Exp $
|
||||
// $Id: load32.cc,v 1.2 2008-09-16 20:57:16 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2008 Stanislav Shwartsman
|
||||
@ -57,9 +57,9 @@ accessOK:
|
||||
// from this CPL.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_READ);
|
||||
Bit8u *hostAddr = (Bit8u*) (hostPageAddr | pageOffset);
|
||||
TMP8L = *hostAddr;
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 1, CPL, BX_READ, (Bit8u*) &TMP8L);
|
||||
}
|
||||
@ -107,9 +107,9 @@ accessOK:
|
||||
// from this CPL.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_READ);
|
||||
Bit8u *hostAddr = (Bit8u*) (hostPageAddr | pageOffset);
|
||||
TMP8L = *hostAddr;
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 1, CPL, BX_READ, (Bit8u*) &TMP8L);
|
||||
}
|
||||
@ -157,9 +157,9 @@ accessOK:
|
||||
// from this CPL.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_READ);
|
||||
Bit8u *hostAddr = (Bit8u*) (hostPageAddr | pageOffset);
|
||||
TMP8L = *hostAddr;
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 1, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 1, CPL, BX_READ, (Bit8u*) &TMP8L);
|
||||
}
|
||||
@ -190,6 +190,156 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ew(bxInstruction_c *i)
|
||||
BX_CPU_CALL_METHOD(i->execute2, (i));
|
||||
}
|
||||
|
||||
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ew_Resolve16BaseIndex(bxInstruction_c *i)
|
||||
{
|
||||
Bit16u offset = BX_READ_16BIT_REG(i->sibBase()) + BX_READ_16BIT_REG(i->sibIndex()) + (Bit16s) i->displ16u();
|
||||
Bit32u laddr;
|
||||
|
||||
unsigned s = i->seg();
|
||||
bx_segment_reg_t *seg = &BX_CPU_THIS_PTR sregs[s];
|
||||
BX_INSTR_MEM_DATA_ACCESS(BX_CPU_ID, s, offset, 2, BX_READ);
|
||||
|
||||
BX_ASSERT(BX_CPU_THIS_PTR cpu_mode != BX_MODE_LONG_64);
|
||||
|
||||
if (seg->cache.valid & SegAccessROK) {
|
||||
if (offset < seg->cache.u.segment.limit_scaled) {
|
||||
accessOK:
|
||||
laddr = BX_CPU_THIS_PTR get_laddr32(s, offset);
|
||||
#if BX_SupportGuest2HostTLB
|
||||
unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 1);
|
||||
Bit32u lpf = LPFOf(laddr);
|
||||
bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex];
|
||||
if (tlbEntry->lpf == lpf && ! (tlbEntry->accessBits & USER_PL)) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
Bit16u *hostAddr = (Bit16u*) (hostPageAddr | pageOffset);
|
||||
ReadHostWordFromLittleEndian(hostAddr, TMP16);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 2, CPL, BX_READ, (Bit8u*) &TMP16);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
access_read_linear(laddr, 2, CPL, BX_READ, (void *) &TMP16);
|
||||
}
|
||||
|
||||
BX_CPU_CALL_METHOD(i->execute2, (i));
|
||||
return;
|
||||
}
|
||||
else {
|
||||
BX_ERROR(("LOAD_Ew(): segment limit violation"));
|
||||
exception(int_number(s), 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (!read_virtual_checks(seg, offset, 2))
|
||||
exception(int_number(s), 0, 0);
|
||||
goto accessOK;
|
||||
}
|
||||
|
||||
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ew_Resolve32Base(bxInstruction_c *i)
|
||||
{
|
||||
Bit32u offset = BX_READ_32BIT_REG(i->sibBase()) + (Bit32s) i->displ32u();
|
||||
Bit32u laddr;
|
||||
|
||||
unsigned s = i->seg();
|
||||
bx_segment_reg_t *seg = &BX_CPU_THIS_PTR sregs[s];
|
||||
BX_INSTR_MEM_DATA_ACCESS(BX_CPU_ID, s, offset, 2, BX_READ);
|
||||
|
||||
BX_ASSERT(BX_CPU_THIS_PTR cpu_mode != BX_MODE_LONG_64);
|
||||
|
||||
if (seg->cache.valid & SegAccessROK) {
|
||||
if (offset < seg->cache.u.segment.limit_scaled) {
|
||||
accessOK:
|
||||
laddr = BX_CPU_THIS_PTR get_laddr32(s, offset);
|
||||
#if BX_SupportGuest2HostTLB
|
||||
unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 1);
|
||||
Bit32u lpf = LPFOf(laddr);
|
||||
bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex];
|
||||
if (tlbEntry->lpf == lpf && ! (tlbEntry->accessBits & USER_PL)) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
Bit16u *hostAddr = (Bit16u*) (hostPageAddr | pageOffset);
|
||||
ReadHostWordFromLittleEndian(hostAddr, TMP16);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 2, CPL, BX_READ, (Bit8u*) &TMP16);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
access_read_linear(laddr, 2, CPL, BX_READ, (void *) &TMP16);
|
||||
}
|
||||
|
||||
BX_CPU_CALL_METHOD(i->execute2, (i));
|
||||
return;
|
||||
}
|
||||
else {
|
||||
BX_ERROR(("LOAD_Ew(): segment limit violation"));
|
||||
exception(int_number(s), 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (!read_virtual_checks(seg, offset, 2))
|
||||
exception(int_number(s), 0, 0);
|
||||
goto accessOK;
|
||||
}
|
||||
|
||||
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ew_Resolve32BaseIndex(bxInstruction_c *i)
|
||||
{
|
||||
Bit32u offset = BX_READ_32BIT_REG(i->sibBase()) + (BX_READ_32BIT_REG(i->sibIndex()) << i->sibScale()) + (Bit32s) i->displ32u();
|
||||
Bit32u laddr;
|
||||
|
||||
unsigned s = i->seg();
|
||||
bx_segment_reg_t *seg = &BX_CPU_THIS_PTR sregs[s];
|
||||
BX_INSTR_MEM_DATA_ACCESS(BX_CPU_ID, s, offset, 2, BX_READ);
|
||||
|
||||
BX_ASSERT(BX_CPU_THIS_PTR cpu_mode != BX_MODE_LONG_64);
|
||||
|
||||
if (seg->cache.valid & SegAccessROK) {
|
||||
if (offset < seg->cache.u.segment.limit_scaled) {
|
||||
accessOK:
|
||||
laddr = BX_CPU_THIS_PTR get_laddr32(s, offset);
|
||||
#if BX_SupportGuest2HostTLB
|
||||
unsigned tlbIndex = BX_TLB_INDEX_OF(laddr, 1);
|
||||
Bit32u lpf = LPFOf(laddr);
|
||||
bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex];
|
||||
if (tlbEntry->lpf == lpf && ! (tlbEntry->accessBits & USER_PL)) {
|
||||
// See if the TLB entry privilege level allows us read access
|
||||
// from this CPL.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
Bit16u *hostAddr = (Bit16u*) (hostPageAddr | pageOffset);
|
||||
ReadHostWordFromLittleEndian(hostAddr, TMP16);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 2, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 2, CPL, BX_READ, (Bit8u*) &TMP16);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
access_read_linear(laddr, 2, CPL, BX_READ, (void *) &TMP16);
|
||||
}
|
||||
|
||||
BX_CPU_CALL_METHOD(i->execute2, (i));
|
||||
return;
|
||||
}
|
||||
else {
|
||||
BX_ERROR(("LOAD_Ew(): segment limit violation"));
|
||||
exception(int_number(s), 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (!read_virtual_checks(seg, offset, 2))
|
||||
exception(int_number(s), 0, 0);
|
||||
goto accessOK;
|
||||
}
|
||||
|
||||
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ed(bxInstruction_c *i)
|
||||
{
|
||||
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
||||
@ -221,9 +371,9 @@ accessOK:
|
||||
// from this CPL.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_READ);
|
||||
Bit32u *hostAddr = (Bit32u*) (hostPageAddr | pageOffset);
|
||||
ReadHostDWordFromLittleEndian(hostAddr, TMP32);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 4, CPL, BX_READ, (Bit8u*) &TMP32);
|
||||
}
|
||||
@ -271,9 +421,9 @@ accessOK:
|
||||
// from this CPL.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_READ);
|
||||
Bit32u *hostAddr = (Bit32u*) (hostPageAddr | pageOffset);
|
||||
ReadHostDWordFromLittleEndian(hostAddr, TMP32);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 4, CPL, BX_READ, (Bit8u*) &TMP32);
|
||||
}
|
||||
@ -321,9 +471,9 @@ accessOK:
|
||||
// from this CPL.
|
||||
bx_hostpageaddr_t hostPageAddr = tlbEntry->hostPageAddr;
|
||||
Bit32u pageOffset = PAGE_OFFSET(laddr);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_READ);
|
||||
Bit32u *hostAddr = (Bit32u*) (hostPageAddr | pageOffset);
|
||||
ReadHostDWordFromLittleEndian(hostAddr, TMP32);
|
||||
BX_INSTR_LIN_ACCESS(BX_CPU_ID, laddr, tlbEntry->ppf | pageOffset, 4, BX_READ);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr,
|
||||
tlbEntry->ppf | pageOffset, 4, CPL, BX_READ, (Bit8u*) &TMP32);
|
||||
}
|
||||
@ -382,3 +532,4 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Wsd(bxInstruction_c *i)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user