INVD/WBINVD should flush caches and TLB
This commit is contained in:
parent
f1f2647819
commit
64ba97210b
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.cc,v 1.111 2005-08-28 17:37:36 sshwarts Exp $
|
||||
// $Id: cpu.cc,v 1.112 2005-10-18 18:07:52 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -69,7 +69,7 @@ BOCHSAPI BX_MEM_C *bx_mem_array[BX_ADDRESS_SPACES];
|
||||
|
||||
bxPageWriteStampTable pageWriteStampTable;
|
||||
|
||||
void purgeICache(void)
|
||||
void purgeICaches(void)
|
||||
{
|
||||
#if BX_SMP_PROCESSORS == 1
|
||||
BX_CPU(0)->iCache.purgeICacheEntries();
|
||||
@ -81,6 +81,18 @@ void purgeICache(void)
|
||||
pageWriteStampTable.resetWriteStamps();
|
||||
}
|
||||
|
||||
void flushICaches(void)
|
||||
{
|
||||
#if BX_SMP_PROCESSORS == 1
|
||||
BX_CPU(0)->iCache.flushICacheEntries();
|
||||
#else
|
||||
for (unsigned i=0; i<BX_SMP_PROCESSORS; i++)
|
||||
BX_CPU(i)->iCache.flushICacheEntries();
|
||||
#endif
|
||||
|
||||
pageWriteStampTable.resetWriteStamps();
|
||||
}
|
||||
|
||||
#define InstrumentICACHE 0
|
||||
|
||||
#if InstrumentICACHE
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: icache.h,v 1.8 2005-08-10 18:18:57 sshwarts Exp $
|
||||
// $Id: icache.h,v 1.9 2005-10-18 18:07:52 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -139,8 +139,16 @@ public:
|
||||
}
|
||||
|
||||
BX_CPP_INLINE void purgeICacheEntries(void);
|
||||
BX_CPP_INLINE void flushICacheEntries(void);
|
||||
};
|
||||
|
||||
BX_CPP_INLINE void bxICache_c::flushICacheEntries(void)
|
||||
{
|
||||
for (unsigned i=0; i<BxICacheEntries; i++) {
|
||||
entry[i].writeStamp = ICacheWriteStampInvalid;
|
||||
}
|
||||
}
|
||||
|
||||
BX_CPP_INLINE void bxICache_c::purgeICacheEntries(void)
|
||||
{
|
||||
// Since the write stamps may overflow if we always simply decrese them,
|
||||
@ -157,6 +165,7 @@ BX_CPP_INLINE void bxICache_c::purgeICacheEntries(void)
|
||||
}
|
||||
}
|
||||
|
||||
extern void purgeICache(void);
|
||||
extern void purgeICaches(void);
|
||||
extern void flushICaches(void);
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: proc_ctrl.cc,v 1.119 2005-10-17 13:06:09 sshwarts Exp $
|
||||
// $Id: proc_ctrl.cc,v 1.120 2005-10-18 18:07:52 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -108,10 +108,6 @@ void BX_CPU_C::CLTS(bxInstruction_c *i)
|
||||
|
||||
void BX_CPU_C::INVD(bxInstruction_c *i)
|
||||
{
|
||||
BX_INFO(("---------------"));
|
||||
BX_INFO(("- INVD called -"));
|
||||
BX_INFO(("---------------"));
|
||||
|
||||
#if BX_CPU_LEVEL >= 4
|
||||
invalidate_prefetch_q();
|
||||
|
||||
@ -122,8 +118,16 @@ void BX_CPU_C::INVD(bxInstruction_c *i)
|
||||
exception(BX_GP_EXCEPTION, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
BX_INFO(("INVD: Flush caches and TLB !"));
|
||||
BX_INSTR_CACHE_CNTRL(BX_CPU_ID, BX_INSTR_INVD);
|
||||
TLB_flush(1); // 1 = Flush Global entries too
|
||||
#if BX_SUPPORT_ICACHE
|
||||
flushICaches();
|
||||
#endif
|
||||
|
||||
#else
|
||||
BX_INFO(("INVD: required 486 support, use --enable-cpu-level=4 option"));
|
||||
UndefinedOpcode(i);
|
||||
#endif
|
||||
}
|
||||
@ -139,8 +143,16 @@ void BX_CPU_C::WBINVD(bxInstruction_c *i)
|
||||
exception(BX_GP_EXCEPTION, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
BX_INFO(("WBINVD: Flush caches and TLB !"));
|
||||
BX_INSTR_CACHE_CNTRL(BX_CPU_ID, BX_INSTR_WBINVD);
|
||||
TLB_flush(1); // 1 = Flush Global entries too
|
||||
#if BX_SUPPORT_ICACHE
|
||||
flushICaches();
|
||||
#endif
|
||||
|
||||
#else
|
||||
BX_INFO(("WBINVD: required 486 support, use --enable-cpu-level=4 option"));
|
||||
UndefinedOpcode(i);
|
||||
#endif
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pc_system.cc,v 1.43 2005-07-04 18:02:37 sshwarts Exp $
|
||||
// $Id: pc_system.cc,v 1.44 2005-10-18 18:07:51 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -394,7 +394,7 @@ void bx_pc_system_c::nullTimer(void* this_ptr)
|
||||
#endif
|
||||
|
||||
#if BX_SUPPORT_ICACHE
|
||||
purgeICache();
|
||||
purgeICaches();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user