mem-ruby: Add deallocate to DirectoryMemory
Change-Id: Ib261ec8b302b55e539d8e13064957170412b752c Signed-off-by: Tiago Mück <tiago.muck@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/21920 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -197,6 +197,7 @@ structure(AbstractCacheEntry, primitive="yes", external = "yes") {
|
||||
structure (DirectoryMemory, external = "yes") {
|
||||
AbstractCacheEntry allocate(Addr, AbstractCacheEntry);
|
||||
AbstractCacheEntry lookup(Addr);
|
||||
void deallocate(Addr);
|
||||
bool isPresent(Addr);
|
||||
void invalidateBlock(Addr);
|
||||
void recordRequestType(DirectoryRequestType);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
* Copyright (c) 2017,2019 ARM Limited
|
||||
* All rights reserved.
|
||||
*
|
||||
* The license below extends only to copyright in the software and shall
|
||||
@@ -127,12 +127,27 @@ DirectoryMemory::allocate(Addr address, AbstractCacheEntry *entry)
|
||||
|
||||
idx = mapAddressToLocalIdx(address);
|
||||
assert(idx < m_num_entries);
|
||||
assert(m_entries[idx] == NULL);
|
||||
entry->changePermission(AccessPermission_Read_Only);
|
||||
m_entries[idx] = entry;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
void
|
||||
DirectoryMemory::deallocate(Addr address)
|
||||
{
|
||||
assert(isPresent(address));
|
||||
uint64_t idx;
|
||||
DPRINTF(RubyCache, "Removing entry for address: %#x\n", address);
|
||||
|
||||
idx = mapAddressToLocalIdx(address);
|
||||
assert(idx < m_num_entries);
|
||||
assert(m_entries[idx] != NULL);
|
||||
delete m_entries[idx];
|
||||
m_entries[idx] = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
DirectoryMemory::print(ostream& out) const
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
* Copyright (c) 2017,2019 ARM Limited
|
||||
* All rights reserved.
|
||||
*
|
||||
* The license below extends only to copyright in the software and shall
|
||||
@@ -79,6 +79,9 @@ class DirectoryMemory : public SimObject
|
||||
AbstractCacheEntry *lookup(Addr address);
|
||||
AbstractCacheEntry *allocate(Addr address, AbstractCacheEntry* new_entry);
|
||||
|
||||
// Explicitly free up this address
|
||||
void deallocate(Addr address);
|
||||
|
||||
void print(std::ostream& out) const;
|
||||
void recordRequestType(DirectoryRequestType requestType);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user