+2004-07-20 Dave Brolley <brolley@redhat.com>
+
+ * cacheutil.cxx (find): Make sure cache line is valid before returning
+ it.
+ * cache.cxx (write_any): Move call to addr_to_tag to a later point when
+ the result is actually needed. Make sure cache line is valid before
+ flushing it.
+ (read_any): Make sure cache line is valid before flushing it.
+
2004-07-01 Dave Brolley <brolley@redhat.com>
* cache.cxx (write_any): Allow misaligned access. Return
if (LIKELY (collect_p))
stats.writes++;
- cache_tag tag = acache.addr_to_tag (addr);
if (UNLIKELY (addr % sizeof (data) != 0))
{
if (LIKELY (collect_p))
if (UNLIKELY (addr % line_size + sizeof (data) > line_size))
return bus::misaligned;
+ cache_tag tag = acache.addr_to_tag (addr);
cache_line* line = acache.find (tag);
if (LIKELY (line))
{
if (! write_through_p)
{
- if (expelled_line->dirty_p ())
+ if (expelled_line->valid_p () && expelled_line->dirty_p ())
{
// flush a dirty line being replaced
if ((st = write_line (*expelled_line)) != bus::ok)
cache_line *expelled_line = acache.expell_line (tag);
assert (expelled_line);
- if (expelled_line->dirty_p ())
+ if (expelled_line->valid_p () && expelled_line->dirty_p ())
{
// flush a dirty line being replaced
if ((st = write_line (*expelled_line)) != bus::ok)
// order of associativity will be small.
for (const_iterator_t it = lines.begin (); it != lines.end (); it++)
- if (tag == *(*it))
+ if (tag == *(*it) && (*it)->valid_p ())
{
replacer.update (*this, *(*it));
return *it;