diff options
author | Andreas Sandberg <Andreas.Sandberg@arm.com> | 2012-11-02 11:32:02 -0500 |
---|---|---|
committer | Andreas Sandberg <Andreas.Sandberg@arm.com> | 2012-11-02 11:32:02 -0500 |
commit | ddd6af414cdd4939f4ff382f0e83e7dfa695781d (patch) | |
tree | 5149831ec4714dea40a550665ba87e1299d4485a /src/mem/cache/cache.hh | |
parent | 050f24c7964cbe65633261e431e1105d1d5e8070 (diff) | |
download | gem5-ddd6af414cdd4939f4ff382f0e83e7dfa695781d.tar.xz |
mem: Add support for writing back and flushing caches
This patch adds support for the following optional drain methods in
the classical memory system's cache model:
memWriteback() - Write back all dirty cache lines to memory using
functional accesses.
memInvalidate() - Invalidate all cache lines. Dirty cache lines
are lost unless a writeback is requested.
Since memWriteback() is called when checkpointing systems, this patch
adds support for checkpointing systems with caches. The serialization
code now checks whether there are any dirty lines in the cache. If
there are dirty lines in the cache, the checkpoint is flagged as bad
and a warning is printed.
Diffstat (limited to 'src/mem/cache/cache.hh')
-rw-r--r-- | src/mem/cache/cache.hh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mem/cache/cache.hh b/src/mem/cache/cache.hh index be81736aa..5df725683 100644 --- a/src/mem/cache/cache.hh +++ b/src/mem/cache/cache.hh @@ -76,6 +76,7 @@ class Cache : public BaseCache typedef typename TagStore::BlkList BlkList; protected: + typedef CacheBlkVisitorWrapper<Cache<TagStore>, BlkType> WrappedBlkVisitor; /** * The CPU-side port extends the base cache slave port with access @@ -256,6 +257,27 @@ class Cache : public BaseCache */ PacketPtr writebackBlk(BlkType *blk); + + void memWriteback(); + void memInvalidate(); + bool isDirty() const; + + /** + * Cache block visitor that writes back dirty cache blocks using + * functional writes. + * + * \return Always returns true. + */ + bool writebackVisitor(BlkType &blk); + /** + * Cache block visitor that invalidates all blocks in the cache. + * + * @warn Dirty cache lines will not be written back to memory. + * + * \return Always returns true. + */ + bool invalidateVisitor(BlkType &blk); + public: /** Instantiates a basic cache object. */ Cache(const Params *p, TagStore *tags); |