diff options
author | Brad Beckmann <Brad.Beckmann@amd.com> | 2010-08-20 11:46:13 -0700 |
---|---|---|
committer | Brad Beckmann <Brad.Beckmann@amd.com> | 2010-08-20 11:46:13 -0700 |
commit | 593ae7457e0bd1150a08535ee6c79d52a0dfd175 (patch) | |
tree | 7df284f825f945eb445ee5741faff41a3419b24a /src/mem | |
parent | ac5bb214e3dd8ba91feebd9c50ae7d3d9028668c (diff) | |
download | gem5-593ae7457e0bd1150a08535ee6c79d52a0dfd175.tar.xz |
ruby: fixed DirectoryMemory's numa_high_bit configuration
This fix includes the off-by-one bit selection bug for numa mapping.
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& |