summaryrefslogtreecommitdiff
path: root/src/mem/cache
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/cache
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/cache')
-rw-r--r--src/mem/cache/cache.hh2
-rw-r--r--src/mem/cache/cache_impl.hh12
2 files changed, 7 insertions, 7 deletions
diff --git a/src/mem/cache/cache.hh b/src/mem/cache/cache.hh
index b9a9a7823..e0bd29752 100644
--- a/src/mem/cache/cache.hh
+++ b/src/mem/cache/cache.hh
@@ -287,7 +287,7 @@ class Cache : public BaseCache
bool pending_downgrade = false);
bool satisfyMSHR(MSHR *mshr, PacketPtr pkt, BlkType *blk);
- void doTimingSupplyResponse(PacketPtr req_pkt, uint8_t *blk_data,
+ void doTimingSupplyResponse(PacketPtr req_pkt, const uint8_t *blk_data,
bool already_copied, bool pending_inval);
/**
diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh
index 66abf6eff..f4099c0ef 100644
--- a/src/mem/cache/cache_impl.hh
+++ b/src/mem/cache/cache_impl.hh
@@ -357,7 +357,7 @@ Cache<TagStore>::access(PacketPtr pkt, BlkType *&blk,
blk->status &= ~BlkWritable;
++fastWrites;
}
- std::memcpy(blk->data, pkt->getPtr<uint8_t>(), blkSize);
+ std::memcpy(blk->data, pkt->getConstPtr<uint8_t>(), blkSize);
DPRINTF(Cache, "%s new state is %s\n", __func__, blk->print());
incHitCount(pkt);
return true;
@@ -1211,7 +1211,7 @@ Cache<TagStore>::recvTimingResp(PacketPtr pkt)
completion_time = clockEdge(responseLatency) +
pkt->lastWordDelay;
if (pkt->isRead() && !is_error) {
- target->pkt->setData(pkt->getPtr<uint8_t>());
+ target->pkt->setData(pkt->getConstPtr<uint8_t>());
}
}
target->pkt->makeTimingResponse();
@@ -1535,7 +1535,7 @@ Cache<TagStore>::handleFill(PacketPtr pkt, BlkType *blk,
// if we got new data, copy it in
if (pkt->isRead()) {
- std::memcpy(blk->data, pkt->getPtr<uint8_t>(), blkSize);
+ std::memcpy(blk->data, pkt->getConstPtr<uint8_t>(), blkSize);
}
blk->whenReady = clockEdge() + responseLatency * clockPeriod() +
@@ -1554,7 +1554,7 @@ Cache<TagStore>::handleFill(PacketPtr pkt, BlkType *blk,
template<class TagStore>
void
Cache<TagStore>::
-doTimingSupplyResponse(PacketPtr req_pkt, uint8_t *blk_data,
+doTimingSupplyResponse(PacketPtr req_pkt, const uint8_t *blk_data,
bool already_copied, bool pending_inval)
{
// sanity check
@@ -1810,7 +1810,7 @@ Cache<TagStore>::recvTimingSnoopReq(PacketPtr pkt)
// the packet's invalidate flag is set...
assert(pkt->isInvalidate());
}
- doTimingSupplyResponse(pkt, wb_pkt->getPtr<uint8_t>(),
+ doTimingSupplyResponse(pkt, wb_pkt->getConstPtr<uint8_t>(),
false, false);
if (pkt->isInvalidate()) {
@@ -2020,7 +2020,7 @@ Cache<TagStore>::getTimingPacket()
pkt = new Packet(tgt_pkt);
pkt->allocate();
if (pkt->isWrite()) {
- pkt->setData(tgt_pkt->getPtr<uint8_t>());
+ pkt->setData(tgt_pkt->getConstPtr<uint8_t>());
}
}
}