summaryrefslogtreecommitdiff
path: root/src/mem/ruby
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2014-12-02 06:07:36 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2014-12-02 06:07:36 -0500
commit9779ba2e37a753df407b976fc4b299d936ea62b8 (patch)
treee25e0cf44834427975767e88bf3dcfc6359ed4a8 /src/mem/ruby
parent25bfc249998b26403d50587eb66e6ee5e6de5b58 (diff)
downloadgem5-9779ba2e37a753df407b976fc4b299d936ea62b8.tar.xz
mem: Add const getters for write packet data
This patch takes a first step in tightening up how we use the data pointer in write packets. A const getter is added for the pointer itself (getConstPtr), and a number of member functions are also made const accordingly. In a range of places throughout the memory system the new member is used. The patch also removes the unused isReadWrite function.
Diffstat (limited to 'src/mem/ruby')
-rw-r--r--src/mem/ruby/common/DataBlock.cc2
-rw-r--r--src/mem/ruby/common/DataBlock.hh2
-rw-r--r--src/mem/ruby/slicc_interface/RubyRequest.cc2
-rw-r--r--src/mem/ruby/slicc_interface/RubySlicc_Util.hh2
-rw-r--r--src/mem/ruby/system/Sequencer.cc4
5 files changed, 6 insertions, 6 deletions
diff --git a/src/mem/ruby/common/DataBlock.cc b/src/mem/ruby/common/DataBlock.cc
index c71449dd0..2a292444a 100644
--- a/src/mem/ruby/common/DataBlock.cc
+++ b/src/mem/ruby/common/DataBlock.cc
@@ -78,7 +78,7 @@ DataBlock::getData(int offset, int len) const
}
void
-DataBlock::setData(uint8_t *data, int offset, int len)
+DataBlock::setData(const uint8_t *data, int offset, int len)
{
assert(offset + len <= RubySystem::getBlockSizeBytes());
memcpy(&m_data[offset], data, len);
diff --git a/src/mem/ruby/common/DataBlock.hh b/src/mem/ruby/common/DataBlock.hh
index 56320523b..ac08fac82 100644
--- a/src/mem/ruby/common/DataBlock.hh
+++ b/src/mem/ruby/common/DataBlock.hh
@@ -59,7 +59,7 @@ class DataBlock
uint8_t getByte(int whichByte) const;
const uint8_t *getData(int offset, int len) const;
void setByte(int whichByte, uint8_t data);
- void setData(uint8_t *data, int offset, int len);
+ void setData(const uint8_t *data, int offset, int len);
void copyPartial(const DataBlock & dblk, int offset, int len);
bool equal(const DataBlock& obj) const;
void print(std::ostream& out) const;
diff --git a/src/mem/ruby/slicc_interface/RubyRequest.cc b/src/mem/ruby/slicc_interface/RubyRequest.cc
index ff90e415e..e2f275006 100644
--- a/src/mem/ruby/slicc_interface/RubyRequest.cc
+++ b/src/mem/ruby/slicc_interface/RubyRequest.cc
@@ -72,7 +72,7 @@ RubyRequest::functionalWrite(Packet *pkt)
Addr mBase = m_PhysicalAddress.getAddress();
Addr mTail = mBase + m_Size;
- uint8_t * pktData = pkt->getPtr<uint8_t>();
+ const uint8_t * pktData = pkt->getConstPtr<uint8_t>();
Addr cBase = std::max(wBase, mBase);
Addr cTail = std::min(wTail, mTail);
diff --git a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh
index 8e2a1c5b1..dd9a1f2a4 100644
--- a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh
+++ b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh
@@ -135,7 +135,7 @@ testAndWrite(Address addr, DataBlock& blk, Packet *pkt)
lineAddr.makeLineAddress();
if (pktLineAddr == lineAddr) {
- uint8_t *data = pkt->getPtr<uint8_t>();
+ const uint8_t *data = pkt->getConstPtr<uint8_t>();
unsigned int size_in_bytes = pkt->getSize();
unsigned startByte = pkt->getAddr() - lineAddr.getAddress();
diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc
index 281ea22be..ef1b9676b 100644
--- a/src/mem/ruby/system/Sequencer.cc
+++ b/src/mem/ruby/system/Sequencer.cc
@@ -526,7 +526,7 @@ Sequencer::hitCallback(SequencerRequest* srequest, DataBlock& data,
// update the data unless it is a non-data-carrying flush
if (g_system_ptr->m_warmup_enabled) {
- data.setData(pkt->getPtr<uint8_t>(),
+ data.setData(pkt->getConstPtr<uint8_t>(),
request_address.getOffset(), pkt->getSize());
} else if (!pkt->isFlush()) {
if ((type == RubyRequestType_LD) ||
@@ -538,7 +538,7 @@ Sequencer::hitCallback(SequencerRequest* srequest, DataBlock& data,
data.getData(request_address.getOffset(), pkt->getSize()),
pkt->getSize());
} else {
- data.setData(pkt->getPtr<uint8_t>(),
+ data.setData(pkt->getConstPtr<uint8_t>(),
request_address.getOffset(), pkt->getSize());
}
}