summaryrefslogtreecommitdiff
path: root/src/mem/ruby/system
diff options
context:
space:
mode:
authorBlake Hechtman ext:(%2C%20Nilay%20Vaish%20%3Cnilay%40cs.wisc.edu%3E) <bah13@duke.edu>2013-03-02 23:12:55 -0600
committerBlake Hechtman ext:(%2C%20Nilay%20Vaish%20%3Cnilay%40cs.wisc.edu%3E) <bah13@duke.edu>2013-03-02 23:12:55 -0600
commitaf8eb67fb44f7ab1831d6651ea4a079f2ebc99ff (patch)
treebe47b181058c782c9bfc654aac034b2f243fcb6d /src/mem/ruby/system
parenta4e8512afa8fa5b09ee9f34ba256254eb012d628 (diff)
downloadgem5-af8eb67fb44f7ab1831d6651ea4a079f2ebc99ff.tar.xz
ruby: fixes functional writes to RubyRequest
The functional write code was assuming that all writes are block sized, which may not be true for Ruby Requests. This bug can lead to a buffer overflow. Committed by: Nilay Vaish <nilay@cs.wisc.edu>
Diffstat (limited to 'src/mem/ruby/system')
-rw-r--r--src/mem/ruby/system/System.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc
index f1a6a91b8..0e52df2ec 100644
--- a/src/mem/ruby/system/System.cc
+++ b/src/mem/ruby/system/System.cc
@@ -536,13 +536,18 @@ RubySystem::functionalWrite(PacketPtr pkt)
unsigned int size_in_bytes = pkt->getSize();
unsigned startByte = addr.getAddress() - line_addr.getAddress();
+ uint32_t M5_VAR_USED num_functional_writes = 0;
+
for (unsigned int i = 0; i < num_controllers;++i) {
- m_abs_cntrl_vec[i]->functionalWriteBuffers(pkt);
+ num_functional_writes +=
+ m_abs_cntrl_vec[i]->functionalWriteBuffers(pkt);
access_perm = m_abs_cntrl_vec[i]->getAccessPermission(line_addr);
if (access_perm != AccessPermission_Invalid &&
access_perm != AccessPermission_NotPresent) {
+ num_functional_writes++;
+
DataBlock& block = m_abs_cntrl_vec[i]->getDataBlock(line_addr);
DPRINTF(RubySystem, "%s\n",block);
for (unsigned j = 0; j < size_in_bytes; ++j) {
@@ -552,7 +557,6 @@ RubySystem::functionalWrite(PacketPtr pkt)
}
}
- uint32_t M5_VAR_USED num_functional_writes = 0;
for (unsigned int i = 0; i < m_memory_controller_vec.size() ;++i) {
num_functional_writes +=
m_memory_controller_vec[i]->functionalWriteBuffers(pkt);