Introduce new icache hash function suggested by Darek Mihocka

My studies show that in average new hash function of paddr + paddr>>4
suffers 5-10% less from aliasing in direct map cache array.
This commit is contained in:
Stanislav Shwartsman 2007-12-21 12:38:57 +00:00
parent 43e356fb60
commit 62c098f627

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: icache.h,v 1.21 2007-12-09 18:36:05 sshwarts Exp $
// $Id: icache.h,v 1.22 2007-12-21 12:38:57 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -142,7 +142,7 @@ public:
BX_CPP_INLINE unsigned hash(bx_phy_address pAddr) const
{
// A pretty dumb hash function for now.
return pAddr & (BxICacheEntries-1);
return (pAddr + (pAddr>>4)) & (BxICacheEntries-1);
}
BX_CPP_INLINE void purgeICacheEntries(void);