diff options
Diffstat (limited to 'src/mem/port_proxy.cc')
-rw-r--r-- | src/mem/port_proxy.cc | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/mem/port_proxy.cc b/src/mem/port_proxy.cc index ea6dd0fc2..cce8f6ff4 100644 --- a/src/mem/port_proxy.cc +++ b/src/mem/port_proxy.cc @@ -41,14 +41,14 @@ #include "mem/port_proxy.hh" void -PortProxy::blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd) const +PortProxy::readBlob(Addr addr, uint8_t *p, int size) const { Request req; - for (ChunkGenerator gen(addr, size, _cacheLineSize); - !gen.done(); gen.next()) { + for (ChunkGenerator gen(addr, size, _cacheLineSize); !gen.done(); + gen.next()) { req.setPhys(gen.addr(), gen.size(), 0, Request::funcMasterId); - Packet pkt(&req, cmd); + Packet pkt(&req, MemCmd::ReadReq); pkt.dataStatic(p); _port.sendFunctional(&pkt); p += gen.size(); @@ -56,13 +56,28 @@ PortProxy::blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd) const } void +PortProxy::writeBlob(Addr addr, const uint8_t *p, int size) const +{ + Request req; + + for (ChunkGenerator gen(addr, size, _cacheLineSize); !gen.done(); + gen.next()) { + req.setPhys(gen.addr(), gen.size(), 0, Request::funcMasterId); + Packet pkt(&req, MemCmd::WriteReq); + pkt.dataStaticConst(p); + _port.sendFunctional(&pkt); + p += gen.size(); + } +} + +void PortProxy::memsetBlob(Addr addr, uint8_t v, int size) const { // quick and dirty... uint8_t *buf = new uint8_t[size]; std::memset(buf, v, size); - blobHelper(addr, buf, size, MemCmd::WriteReq); + PortProxy::writeBlob(addr, buf, size); delete [] buf; } |