From adde4c91f99fa99abbdd23cf97c45de020429d2d Mon Sep 17 00:00:00 2001 From: "Daniel R. Carvalho" Date: Mon, 15 Oct 2018 11:48:32 +0200 Subject: mem: Use Packet writing functions instead of memcpy Classes were using memcpy instead of the Packet functions created for writing to/from the packet. This allows these writes to be better checked and tracked. This also fixes a bug in MemCheckerMonitor, which was using the incorrect type for the packet pointer. Change-Id: I5bbc8a24e59464e8219bb6d54af8209e6d4ee1af Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/13695 Reviewed-by: Nikos Nikoleris Maintainer: Nikos Nikoleris --- src/mem/mem_checker_monitor.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mem/mem_checker_monitor.cc') diff --git a/src/mem/mem_checker_monitor.cc b/src/mem/mem_checker_monitor.cc index c58ac54fa..ee7eb3fcc 100644 --- a/src/mem/mem_checker_monitor.cc +++ b/src/mem/mem_checker_monitor.cc @@ -164,7 +164,7 @@ MemCheckerMonitor::recvTimingReq(PacketPtr pkt) // write. For reads, we have no data yet, so it doesn't make sense to // allocate. pkt_data.reset(new uint8_t[size]); - memcpy(pkt_data.get(), pkt->getConstPtr(), size); + pkt->writeData(pkt_data.get()); } // If a cache miss is served by a cache, a monitor near the memory @@ -253,7 +253,7 @@ MemCheckerMonitor::recvTimingResp(PacketPtr pkt) // a read. For writes, we have already given the MemChecker the data on // the request, so it doesn't make sense to allocate on write. pkt_data.reset(new uint8_t[size]); - memcpy(pkt_data.get(), pkt->getConstPtr(), size); + pkt->writeData(pkt_data.get()); } if (is_read || is_write) { -- cgit v1.2.3