summaryrefslogtreecommitdiff
path: root/src/mem/ruby/slicc_interface
diff options
context:
space:
mode:
authorDaniel R. Carvalho <odanrc@yahoo.com.br>2018-10-15 12:25:25 +0200
committerDaniel Carvalho <odanrc@yahoo.com.br>2018-11-07 19:34:55 +0000
commit75035f5674df3e497d69404a9093b852d2ccf7aa (patch)
tree5d2d82558ca6be524a2bc8c198f72b72c3b2f251 /src/mem/ruby/slicc_interface
parentcbbdbcbd6850fa7da83f0def9b6f113ec41da0c0 (diff)
downloadgem5-75035f5674df3e497d69404a9093b852d2ccf7aa.tar.xz
mem-ruby: 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. Change-Id: Iae3fba1351330916ee1d4103809c71e151b1639e Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/13915 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/mem/ruby/slicc_interface')
-rw-r--r--src/mem/ruby/slicc_interface/AbstractController.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/mem/ruby/slicc_interface/AbstractController.cc b/src/mem/ruby/slicc_interface/AbstractController.cc
index de7e03dd7..101a4ce7f 100644
--- a/src/mem/ruby/slicc_interface/AbstractController.cc
+++ b/src/mem/ruby/slicc_interface/AbstractController.cc
@@ -268,10 +268,8 @@ AbstractController::queueMemoryWrite(const MachineID &id, Addr addr,
addr, RubySystem::getBlockSizeBytes(), 0, m_masterId);
PacketPtr pkt = Packet::createWrite(req);
- uint8_t *newData = new uint8_t[RubySystem::getBlockSizeBytes()];
- pkt->dataDynamic(newData);
- memcpy(newData, block.getData(0, RubySystem::getBlockSizeBytes()),
- RubySystem::getBlockSizeBytes());
+ pkt->allocate();
+ pkt->setData(block.getData(0, RubySystem::getBlockSizeBytes()));
SenderState *s = new SenderState(id);
pkt->pushSenderState(s);
@@ -295,9 +293,8 @@ AbstractController::queueMemoryWritePartial(const MachineID &id, Addr addr,
RequestPtr req = std::make_shared<Request>(addr, size, 0, m_masterId);
PacketPtr pkt = Packet::createWrite(req);
- uint8_t *newData = new uint8_t[size];
- pkt->dataDynamic(newData);
- memcpy(newData, block.getData(getOffset(addr), size), size);
+ pkt->allocate();
+ pkt->setData(block.getData(getOffset(addr), size));
SenderState *s = new SenderState(id);
pkt->pushSenderState(s);