From 9779ba2e37a753df407b976fc4b299d936ea62b8 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Tue, 2 Dec 2014 06:07:36 -0500 Subject: 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. --- src/cpu/inorder/resources/cache_unit.cc | 12 ++++++------ src/cpu/inorder/resources/fetch_unit.cc | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/cpu/inorder/resources') 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(), + printMemData(cache_req->dataPkt->getConstPtr(), 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(), + (split_pkt) ? printMemData(split_pkt->getConstPtr(), split_pkt->getSize()) : - printMemData(cache_pkt->getPtr(), + printMemData(cache_pkt->getConstPtr(), 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(), + (split_pkt) ? printMemData(split_pkt->getConstPtr(), split_pkt->getSize()) : - printMemData(cache_pkt->getPtr(), + printMemData(cache_pkt->getConstPtr(), 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(), cacheBlkSize); + memcpy((*pend_it)->block, cache_pkt->getConstPtr(), cacheBlkSize); (*pend_it)->valid = true; cache_req->setMemAccPending(false); -- cgit v1.2.3