summaryrefslogtreecommitdiff
path: root/src/cpu/inorder
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/cpu/inorder
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/cpu/inorder')
-rw-r--r--src/cpu/inorder/resources/cache_unit.cc12
-rw-r--r--src/cpu/inorder/resources/fetch_unit.cc2
2 files changed, 7 insertions, 7 deletions
diff --git a/src/cpu/inorder/resources/cache_unit.cc b/src/cpu/inorder/resources/cache_unit.cc
index 251369e01..3a44986e2 100644
--- a/src/cpu/inorder/resources/cache_unit.cc
+++ b/src/cpu/inorder/resources/cache_unit.cc
@@ -68,7 +68,7 @@ using namespace ThePipeline;
#if TRACING_ON
static std::string
-printMemData(uint8_t *data, unsigned size)
+printMemData(const uint8_t *data, unsigned size)
{
std::stringstream dataStr;
for (unsigned pos = 0; pos < size; pos++) {
@@ -855,7 +855,7 @@ CacheUnit::doCacheAccess(DynInstPtr inst, uint64_t *write_res,
DPRINTF(InOrderCachePort,
"[tid:%u]: [sn:%i]: Storing data: %s\n",
tid, inst->seqNum,
- printMemData(cache_req->dataPkt->getPtr<uint8_t>(),
+ printMemData(cache_req->dataPkt->getConstPtr<uint8_t>(),
cache_req->dataPkt->getSize()));
if (mem_req->isCondSwap()) {
@@ -1061,9 +1061,9 @@ CacheUnit::processCacheCompletion(PacketPtr pkt)
DPRINTF(InOrderCachePort,
"[tid:%u]: [sn:%i]: Bytes loaded were: %s\n",
tid, inst->seqNum,
- (split_pkt) ? printMemData(split_pkt->getPtr<uint8_t>(),
+ (split_pkt) ? printMemData(split_pkt->getConstPtr<uint8_t>(),
split_pkt->getSize()) :
- printMemData(cache_pkt->getPtr<uint8_t>(),
+ printMemData(cache_pkt->getConstPtr<uint8_t>(),
cache_pkt->getSize()));
} else if(inst->isStore()) {
assert(cache_pkt->isWrite());
@@ -1071,9 +1071,9 @@ CacheUnit::processCacheCompletion(PacketPtr pkt)
DPRINTF(InOrderCachePort,
"[tid:%u]: [sn:%i]: Bytes stored were: %s\n",
tid, inst->seqNum,
- (split_pkt) ? printMemData(split_pkt->getPtr<uint8_t>(),
+ (split_pkt) ? printMemData(split_pkt->getConstPtr<uint8_t>(),
split_pkt->getSize()) :
- printMemData(cache_pkt->getPtr<uint8_t>(),
+ printMemData(cache_pkt->getConstPtr<uint8_t>(),
cache_pkt->getSize()));
}
diff --git a/src/cpu/inorder/resources/fetch_unit.cc b/src/cpu/inorder/resources/fetch_unit.cc
index 6892688b2..13864e589 100644
--- a/src/cpu/inorder/resources/fetch_unit.cc
+++ b/src/cpu/inorder/resources/fetch_unit.cc
@@ -503,7 +503,7 @@ FetchUnit::processCacheCompletion(PacketPtr pkt)
// Copy Data to pendingFetch queue...
(*pend_it)->block = new uint8_t[cacheBlkSize];
- memcpy((*pend_it)->block, cache_pkt->getPtr<uint8_t>(), cacheBlkSize);
+ memcpy((*pend_it)->block, cache_pkt->getConstPtr<uint8_t>(), cacheBlkSize);
(*pend_it)->valid = true;
cache_req->setMemAccPending(false);