From Msim

Jump to: navigation, search

This refers to the fixes made to handle a problem with the initialization value of cache_t::last_tagset.

The Problem

It was possible for the value generated by CACHE_TAGSET(this, addr) to equal the initialization value of last_tagset (when it was 0). This would cause cache_t::last_blk to be used when it was NULL - leading to a segmentation fault.


Change the initialization value of last_tagset to -1.
Old code in cache.c:

last_tagset(0), last_blk(NULL),

New code:

last_tagset(-1), last_blk(NULL),

Other Notes

Consider the removal of cache_t::last_tagset and cache_t::last_blk. If using FIFO or LRU, the block will be looked at first when searching for hits so we really don't save anything there (a valid bit check, tag check). The Random policy does get a performance (simulator performance only) from using this.

Personal tools