cleanup and small optimization for non-paging mode
This commit is contained in:
parent
493f99d9b7
commit
5c75e54d45
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: paging.cc,v 1.138 2008-05-30 12:14:00 sshwarts Exp $
|
||||
// $Id: paging.cc,v 1.139 2008-05-30 16:58:47 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -1282,27 +1282,23 @@ void BX_CPU_C::access_write_linear(bx_address laddr, unsigned len, unsigned curr
|
||||
bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex];
|
||||
bx_address lpf = LPFOf(laddr);
|
||||
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
BX_MEM(0)->writePhysicalPage(BX_CPU_THIS, (bx_phy_address) laddr, len, data);
|
||||
return;
|
||||
}
|
||||
// We haven't seen this page, or it's been bumped before.
|
||||
if (tlbEntry->lpf != lpf) {
|
||||
// We haven't seen this page, or it's been bumped before.
|
||||
|
||||
tlbEntry->lpf = lpf;
|
||||
tlbEntry->ppf = (bx_phy_address) lpf;
|
||||
// TLB.entry[tlbIndex].ppf field not used for PG==0.
|
||||
// Request a direct write pointer so we can do either R or W.
|
||||
tlbEntry->hostPageAddr = (bx_hostpageaddr_t)
|
||||
// Request a direct write pointer so we can do either R or W.
|
||||
bx_hostpageaddr_t hostPageAddr = (bx_hostpageaddr_t)
|
||||
BX_MEM(0)->getHostMemAddr(BX_CPU_THIS, A20ADDR(lpf), BX_WRITE, DATA_ACCESS);
|
||||
|
||||
if (tlbEntry->hostPageAddr) {
|
||||
// Got direct write pointer OK. Mark for any operation to succeed.
|
||||
tlbEntry->accessBits = (TLB_ReadSysOK | TLB_ReadUserOK | TLB_WriteSysOK | TLB_WriteUserOK |
|
||||
TLB_ReadSysPtrOK | TLB_ReadUserPtrOK | TLB_WriteSysPtrOK | TLB_WriteUserPtrOK);
|
||||
if (hostPageAddr) {
|
||||
tlbEntry->lpf = lpf;
|
||||
tlbEntry->ppf = (bx_phy_address) lpf;
|
||||
tlbEntry->hostPageAddr = hostPageAddr;
|
||||
// Got direct write pointer OK. Mark for any operation to succeed.
|
||||
tlbEntry->accessBits = (TLB_ReadSysOK | TLB_ReadUserOK | TLB_WriteSysOK | TLB_WriteUserOK |
|
||||
TLB_ReadSysPtrOK | TLB_ReadUserPtrOK | TLB_WriteSysPtrOK | TLB_WriteUserPtrOK);
|
||||
}
|
||||
}
|
||||
else
|
||||
tlbEntry->accessBits = 0;
|
||||
#endif // BX_SupportGuest2HostTLB
|
||||
#endif
|
||||
|
||||
BX_MEM(0)->writePhysicalPage(BX_CPU_THIS, (bx_phy_address) laddr, len, data);
|
||||
}
|
||||
@ -1450,37 +1446,36 @@ void BX_CPU_C::access_read_linear(bx_address laddr, unsigned len, unsigned curr_
|
||||
bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR TLB.entry[tlbIndex];
|
||||
bx_address lpf = LPFOf(laddr);
|
||||
|
||||
if (tlbEntry->lpf == lpf) {
|
||||
BX_MEM(0)->readPhysicalPage(BX_CPU_THIS, (bx_phy_address) laddr, len, data);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr, (bx_phy_address) laddr, len,
|
||||
curr_pl, BX_READ, (Bit8u*) data);
|
||||
return;
|
||||
}
|
||||
// We haven't seen this page, or it's been bumped before.
|
||||
if (tlbEntry->lpf != lpf) {
|
||||
// We haven't seen this page, or it's been bumped before.
|
||||
|
||||
tlbEntry->lpf = lpf;
|
||||
tlbEntry->ppf = (bx_phy_address) lpf;
|
||||
// Request a direct write pointer so we can do either R or W.
|
||||
tlbEntry->hostPageAddr = (bx_hostpageaddr_t)
|
||||
// Request a direct write pointer so we can do either R or W.
|
||||
bx_hostpageaddr_t hostPageAddr = (bx_hostpageaddr_t)
|
||||
BX_MEM(0)->getHostMemAddr(BX_CPU_THIS, A20ADDR(lpf), BX_WRITE, DATA_ACCESS);
|
||||
if (! tlbEntry->hostPageAddr) {
|
||||
// Direct write vetoed. Try requesting only direct reads.
|
||||
tlbEntry->hostPageAddr = (bx_hostpageaddr_t)
|
||||
BX_MEM(0)->getHostMemAddr(BX_CPU_THIS, A20ADDR(lpf), BX_READ, DATA_ACCESS);
|
||||
if (tlbEntry->hostPageAddr) {
|
||||
// Got direct read pointer OK.
|
||||
tlbEntry->accessBits =
|
||||
(TLB_ReadSysOK | TLB_ReadUserOK | TLB_ReadSysPtrOK | TLB_ReadUserPtrOK);
|
||||
|
||||
if (hostPageAddr) {
|
||||
tlbEntry->lpf = lpf;
|
||||
tlbEntry->ppf = (bx_phy_address) lpf;
|
||||
tlbEntry->hostPageAddr = hostPageAddr;
|
||||
// Got direct write pointer OK. Mark for any operation to succeed.
|
||||
tlbEntry->accessBits = (TLB_ReadSysOK | TLB_ReadUserOK | TLB_WriteSysOK | TLB_WriteUserOK |
|
||||
TLB_ReadSysPtrOK | TLB_ReadUserPtrOK | TLB_WriteSysPtrOK | TLB_WriteUserPtrOK);
|
||||
}
|
||||
else {
|
||||
// Direct write vetoed. Try requesting only direct reads.
|
||||
hostPageAddr = (bx_hostpageaddr_t) BX_MEM(0)->getHostMemAddr(BX_CPU_THIS,
|
||||
A20ADDR(lpf), BX_READ, DATA_ACCESS);
|
||||
|
||||
if (hostPageAddr) {
|
||||
tlbEntry->lpf = lpf;
|
||||
tlbEntry->ppf = (bx_phy_address) lpf;
|
||||
tlbEntry->hostPageAddr = hostPageAddr;
|
||||
// Got direct write pointer OK. Mark for any operation to succeed.
|
||||
tlbEntry->accessBits = (TLB_ReadSysOK | TLB_ReadUserOK | TLB_ReadSysPtrOK | TLB_ReadUserPtrOK);
|
||||
}
|
||||
}
|
||||
else
|
||||
tlbEntry->accessBits = 0;
|
||||
}
|
||||
else {
|
||||
// Got direct write pointer OK. Mark for any operation to succeed.
|
||||
tlbEntry->accessBits = (TLB_ReadSysOK | TLB_ReadUserOK | TLB_WriteSysOK | TLB_WriteUserOK |
|
||||
TLB_ReadSysPtrOK | TLB_ReadUserPtrOK | TLB_WriteSysPtrOK | TLB_WriteUserPtrOK);
|
||||
}
|
||||
#endif // BX_SupportGuest2HostTLB
|
||||
#endif
|
||||
|
||||
BX_MEM(0)->readPhysicalPage(BX_CPU_THIS, (bx_phy_address) laddr, len, data);
|
||||
BX_DBG_LIN_MEMORY_ACCESS(BX_CPU_ID, laddr, (bx_phy_address) laddr, len,
|
||||
|
Loading…
x
Reference in New Issue
Block a user