summaryrefslogtreecommitdiff
path: root/src/mem/abstract_mem.cc
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/abstract_mem.cc
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/abstract_mem.cc')
-rw-r--r--src/mem/abstract_mem.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mem/abstract_mem.cc b/src/mem/abstract_mem.cc
index c819ce2fc..dca0403fb 100644
--- a/src/mem/abstract_mem.cc
+++ b/src/mem/abstract_mem.cc
@@ -309,7 +309,7 @@ AbstractMemory::checkLockedAddrList(PacketPtr pkt)
A, system()->getMasterName(pkt->req->masterId()), \
pkt->getSize(), pkt->getAddr(), \
pkt->req->isUncacheable() ? 'U' : 'C'); \
- DDUMP(MemoryAccess, pkt->getPtr<uint8_t>(), pkt->getSize()); \
+ DDUMP(MemoryAccess, pkt->getConstPtr<uint8_t>(), pkt->getSize()); \
} \
} while (0)
@@ -344,7 +344,8 @@ AbstractMemory::access(PacketPtr pkt)
bool overwrite_mem = true;
// keep a copy of our possible write value, and copy what is at the
// memory address into the packet
- std::memcpy(&overwrite_val[0], pkt->getPtr<uint8_t>(), pkt->getSize());
+ std::memcpy(&overwrite_val[0], pkt->getConstPtr<uint8_t>(),
+ pkt->getSize());
std::memcpy(pkt->getPtr<uint8_t>(), hostAddr, pkt->getSize());
if (pkt->req->isCondSwap()) {
@@ -381,7 +382,7 @@ AbstractMemory::access(PacketPtr pkt)
} else if (pkt->isWrite()) {
if (writeOK(pkt)) {
if (pmemAddr) {
- memcpy(hostAddr, pkt->getPtr<uint8_t>(), pkt->getSize());
+ memcpy(hostAddr, pkt->getConstPtr<uint8_t>(), pkt->getSize());
DPRINTF(MemoryAccess, "%s wrote %x bytes to address %x\n",
__func__, pkt->getSize(), pkt->getAddr());
}
@@ -416,7 +417,7 @@ AbstractMemory::functionalAccess(PacketPtr pkt)
pkt->makeResponse();
} else if (pkt->isWrite()) {
if (pmemAddr)
- memcpy(hostAddr, pkt->getPtr<uint8_t>(), pkt->getSize());
+ memcpy(hostAddr, pkt->getConstPtr<uint8_t>(), pkt->getSize());
TRACE_PACKET("Write");
pkt->makeResponse();
} else if (pkt->isPrint()) {