diff options
author | Giacomo Gabrielli <Giacomo.Gabrielli@arm.com> | 2014-01-24 15:29:30 -0600 |
---|---|---|
committer | Giacomo Gabrielli <Giacomo.Gabrielli@arm.com> | 2014-01-24 15:29:30 -0600 |
commit | aefe9cc624902fe26535028f86ba3a45f555bcf0 (patch) | |
tree | 4d775f34b34eeafc0c596b95aa071cc52fb94283 /src/mem/cache/tags/lru.cc | |
parent | 7f835a59f1c342eb1c170973ad53c493cc38e978 (diff) | |
download | gem5-aefe9cc624902fe26535028f86ba3a45f555bcf0.tar.xz |
mem: Add support for a security bit in the memory system
This patch adds the basic building blocks required to support e.g. ARM
TrustZone by discerning secure and non-secure memory accesses.
Diffstat (limited to 'src/mem/cache/tags/lru.cc')
-rw-r--r-- | src/mem/cache/tags/lru.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mem/cache/tags/lru.cc b/src/mem/cache/tags/lru.cc index 58f3f0977..ff0596987 100644 --- a/src/mem/cache/tags/lru.cc +++ b/src/mem/cache/tags/lru.cc @@ -127,11 +127,11 @@ LRU::~LRU() } LRU::BlkType* -LRU::accessBlock(Addr addr, Cycles &lat, int master_id) +LRU::accessBlock(Addr addr, bool is_secure, Cycles &lat, int master_id) { Addr tag = extractTag(addr); unsigned set = extractSet(addr); - BlkType *blk = sets[set].findBlk(tag); + BlkType *blk = sets[set].findBlk(tag, is_secure); lat = hitLatency; // Access all tags in parallel, hence one in each way. The data side @@ -149,8 +149,8 @@ LRU::accessBlock(Addr addr, Cycles &lat, int master_id) if (blk != NULL) { // move this block to head of the MRU list sets[set].moveToHead(blk); - DPRINTF(CacheRepl, "set %x: moving blk %x to MRU\n", - set, regenerateBlkAddr(tag, set)); + DPRINTF(CacheRepl, "set %x: moving blk %x (%s) to MRU\n", + set, regenerateBlkAddr(tag, set), is_secure ? "s" : "ns"); if (blk->whenReady > curTick() && cache->ticksToCycles(blk->whenReady - curTick()) > hitLatency) { lat = cache->ticksToCycles(blk->whenReady - curTick()); @@ -163,11 +163,11 @@ LRU::accessBlock(Addr addr, Cycles &lat, int master_id) LRU::BlkType* -LRU::findBlock(Addr addr) const +LRU::findBlock(Addr addr, bool is_secure) const { Addr tag = extractTag(addr); unsigned set = extractSet(addr); - BlkType *blk = sets[set].findBlk(tag); + BlkType *blk = sets[set].findBlk(tag, is_secure); return blk; } @@ -191,6 +191,7 @@ LRU::insertBlock(PacketPtr pkt, BlkType *blk) Addr addr = pkt->getAddr(); MasterID master_id = pkt->req->masterId(); uint32_t task_id = pkt->req->taskId(); + bool is_secure = pkt->isSecure(); if (!blk->isTouched) { tagsInUse++; blk->isTouched = true; @@ -220,6 +221,8 @@ LRU::insertBlock(PacketPtr pkt, BlkType *blk) blk->isTouched = true; // Set tag for new block. Caller is responsible for setting status. blk->tag = extractTag(addr); + if (is_secure) + blk->status |= BlkSecure; // deal with what we are bringing in assert(master_id < cache->system->maxMasters()); |