Optimize pageWriteStamp checking
This commit is contained in:
parent
c9e44fb695
commit
b192b2af9b
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.cc,v 1.106 2005-08-05 18:23:36 sshwarts Exp $
|
||||
// $Id: cpu.cc,v 1.107 2005-08-10 18:18:57 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -222,7 +222,7 @@ void BX_CPU_C::cpu_loop(Bit32s max_instr_count)
|
||||
bxICacheEntry_c *cache_entry = &(BX_CPU_THIS_PTR iCache.entry[iCacheHash]);
|
||||
i = &(cache_entry->i);
|
||||
|
||||
Bit32u pageWriteStamp = pageWriteStampTable.getPageWriteStamp(pAddr);
|
||||
Bit32u pageWriteStamp = *(BX_CPU_THIS_PTR currPageWriteStampPtr);
|
||||
|
||||
#if BX_SUPPORT_ICACHE
|
||||
InstrICache_Increment(iCacheLookups);
|
||||
@ -768,6 +768,8 @@ void BX_CPU_C::prefetch(void)
|
||||
BX_CPU_THIS_PTR pAddrA20Page = pAddr & 0xfffff000;
|
||||
BX_CPU_THIS_PTR eipFetchPtr =
|
||||
BX_CPU_THIS_PTR mem->getHostMemAddr(BX_CPU_THIS, BX_CPU_THIS_PTR pAddrA20Page, BX_READ);
|
||||
BX_CPU_THIS_PTR currPageWriteStampPtr =
|
||||
pageWriteStampTable.getPageWriteStampPtr(pAddr);
|
||||
|
||||
// Sanity checks
|
||||
if ( !BX_CPU_THIS_PTR eipFetchPtr ) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.h,v 1.235 2005-08-08 19:56:03 sshwarts Exp $
|
||||
// $Id: cpu.h,v 1.236 2005-08-10 18:18:57 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -1217,6 +1217,7 @@ public: // for now...
|
||||
Bit8u *eipFetchPtr;
|
||||
Bit32u pAddrA20Page; // Guest physical address of current instruction
|
||||
// page with A20() already applied.
|
||||
const Bit32u *currPageWriteStampPtr;
|
||||
unsigned cpu_mode;
|
||||
|
||||
#if BX_DEBUGGER
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: icache.h,v 1.7 2005-06-16 20:28:26 sshwarts Exp $
|
||||
// $Id: icache.h,v 1.8 2005-08-10 18:18:57 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -31,11 +31,11 @@
|
||||
// bit31: 1=CS is 32/64-bit, 0=CS is 16-bit.
|
||||
// bit30: 1=Long Mode, 0=not Long Mode.
|
||||
// bit29: 1=iCache page, 0=Data.
|
||||
#define ICacheWriteStampInvalid 0x1fffffff
|
||||
#define ICacheWriteStampMax 0x1fffffff // Decrements from here.
|
||||
#define ICacheWriteStampMask 0x1fffffff
|
||||
#define ICacheFetchModeMask (~ICacheWriteStampMask)
|
||||
#define iCachePageDataMask 0x20000000
|
||||
const Bit32u ICacheWriteStampInvalid = 0x1fffffff;
|
||||
const Bit32u ICacheWriteStampMax = 0x1fffffff;
|
||||
const Bit32u ICacheWriteStampMask = 0x1fffffff;
|
||||
const Bit32u ICacheFetchModeMask = ~ICacheWriteStampMask;
|
||||
const Bit32u iCachePageDataMask = 0x20000000;
|
||||
|
||||
class bxPageWriteStampTable
|
||||
{
|
||||
@ -67,6 +67,14 @@ public:
|
||||
return ICacheWriteStampInvalid;
|
||||
}
|
||||
|
||||
BX_CPP_INLINE const Bit32u *getPageWriteStampPtr(Bit32u pAddr) const
|
||||
{
|
||||
if (pAddr < memSizeInBytes)
|
||||
return &pageWriteStampTable[pAddr>>12];
|
||||
else
|
||||
return &ICacheWriteStampInvalid;
|
||||
}
|
||||
|
||||
BX_CPP_INLINE void setPageWriteStamp(Bit32u pAddr, Bit32u pageWriteStamp)
|
||||
{
|
||||
if (pAddr < memSizeInBytes)
|
||||
|
Loading…
Reference in New Issue
Block a user