ruby: fixed DirectoryMemory's numa_high_bit configuration

This fix includes the off-by-one bit selection bug for numa mapping.
This commit is contained in:
Brad Beckmann
2010-08-20 11:46:13 -07:00
parent ac5bb214e3
commit 593ae7457e
3 changed files with 33 additions and 8 deletions

View File

@@ -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);
}
}

View File

@@ -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&