diff options
Diffstat (limited to 'src/mem')
-rw-r--r-- | src/mem/ruby/common/Address.hh | 2 | ||||
-rw-r--r-- | src/mem/ruby/system/DirectoryMemory.cc | 17 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/mem/ruby/common/Address.hh b/src/mem/ruby/common/Address.hh index dc58d012f..23b683d69 100644 --- a/src/mem/ruby/common/Address.hh +++ b/src/mem/ruby/common/Address.hh @@ -187,7 +187,7 @@ Address::bitRemove(int small, int big) const physical_address_t higher_bits = m_address & mask; // Shift the valid high bits over the removed section - higher_bits = higher_bits >> (big - small); + higher_bits = higher_bits >> (big - small + 1); return (higher_bits | lower_bits); } } diff --git a/src/mem/ruby/system/DirectoryMemory.cc b/src/mem/ruby/system/DirectoryMemory.cc index 65b61c935..fbb48d7f5 100644 --- a/src/mem/ruby/system/DirectoryMemory.cc +++ b/src/mem/ruby/system/DirectoryMemory.cc @@ -71,7 +71,7 @@ DirectoryMemory::init() m_total_size_bytes += m_size_bytes; if (m_numa_high_bit == 0) { - m_numa_high_bit = RubySystem::getMemorySizeBits(); + m_numa_high_bit = RubySystem::getMemorySizeBits() - 1; } assert(m_numa_high_bit != 0); } @@ -125,7 +125,7 @@ DirectoryMemory::mapAddressToDirectoryVersion(PhysAddress address) if (m_num_directories_bits == 0) return 0; - uint64 ret = address.bitSelect(m_numa_high_bit - m_num_directories_bits, + uint64 ret = address.bitSelect(m_numa_high_bit - m_num_directories_bits + 1, m_numa_high_bit); return ret; } @@ -140,10 +140,15 @@ DirectoryMemory::isPresent(PhysAddress address) uint64 DirectoryMemory::mapAddressToLocalIdx(PhysAddress address) { - uint64 ret = address.bitRemove(m_numa_high_bit - m_num_directories_bits, - m_numa_high_bit) - >> (RubySystem::getBlockSizeBits()); - return ret; + uint64 ret; + if (m_num_directories_bits > 0) { + ret = address.bitRemove(m_numa_high_bit - m_num_directories_bits + 1, + m_numa_high_bit); + } else { + ret = address.getAddress(); + } + + return ret >> (RubySystem::getBlockSizeBits()); } Directory_Entry& |