diff options
author | Andreas Sandberg <andreas.sandberg@arm.com> | 2018-02-13 18:00:22 +0000 |
---|---|---|
committer | Andreas Sandberg <andreas.sandberg@arm.com> | 2018-02-19 14:24:46 +0000 |
commit | 7b96fc2456d71d0df2700384ab44c1ed01be2f03 (patch) | |
tree | 912d232864b064dfd0f4d924b56e178a0c2d0dfe /src/mem/port_proxy.cc | |
parent | 6039da55d87fb27b149ac3da0ebce41bb55a3bee (diff) | |
download | gem5-7b96fc2456d71d0df2700384ab44c1ed01be2f03.tar.xz |
mem: Refactor port proxies to support secure accesses
The current physical port proxy doesn't know how to tag memory
accesses as secure. Refactor the class slightly to create a set of
methods (readBlobPhys, writeBlobPhys, memsetBlobPhys) that always
access physical memory and take a set of Request::Flags as an
argument. The new port proxy, SecurePortProxy, uses this interface to
issue secure physical accesses.
Change-Id: I8232a4b35025be04ec8f91a00f0580266bacb338
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/8364
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/mem/port_proxy.cc')
-rw-r--r-- | src/mem/port_proxy.cc | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/mem/port_proxy.cc b/src/mem/port_proxy.cc index f40c64e2e..d454ef78d 100644 --- a/src/mem/port_proxy.cc +++ b/src/mem/port_proxy.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 ARM Limited + * Copyright (c) 2012, 2018 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -42,11 +42,12 @@ #include "base/chunk_generator.hh" void -PortProxy::readBlob(Addr addr, uint8_t *p, int size) const +PortProxy::readBlobPhys(Addr addr, Request::Flags flags, + uint8_t *p, int size) const { for (ChunkGenerator gen(addr, size, _cacheLineSize); !gen.done(); gen.next()) { - Request req(gen.addr(), gen.size(), 0, Request::funcMasterId); + Request req(gen.addr(), gen.size(), flags, Request::funcMasterId); Packet pkt(&req, MemCmd::ReadReq); pkt.dataStatic(p); _port.sendFunctional(&pkt); @@ -55,11 +56,12 @@ PortProxy::readBlob(Addr addr, uint8_t *p, int size) const } void -PortProxy::writeBlob(Addr addr, const uint8_t *p, int size) const +PortProxy::writeBlobPhys(Addr addr, Request::Flags flags, + const uint8_t *p, int size) const { for (ChunkGenerator gen(addr, size, _cacheLineSize); !gen.done(); gen.next()) { - Request req(gen.addr(), gen.size(), 0, Request::funcMasterId); + Request req(gen.addr(), gen.size(), flags, Request::funcMasterId); Packet pkt(&req, MemCmd::WriteReq); pkt.dataStaticConst(p); _port.sendFunctional(&pkt); @@ -68,13 +70,33 @@ PortProxy::writeBlob(Addr addr, const uint8_t *p, int size) const } void -PortProxy::memsetBlob(Addr addr, uint8_t v, int size) const +PortProxy::memsetBlobPhys(Addr addr, Request::Flags flags, + uint8_t v, int size) const { // quick and dirty... uint8_t *buf = new uint8_t[size]; std::memset(buf, v, size); - PortProxy::writeBlob(addr, buf, size); + PortProxy::writeBlobPhys(addr, flags, buf, size); delete [] buf; } + + +void +SecurePortProxy::readBlob(Addr addr, uint8_t *p, int size) const +{ + readBlobPhys(addr, Request::SECURE, p, size); +} + +void +SecurePortProxy::writeBlob(Addr addr, const uint8_t *p, int size) const +{ + writeBlobPhys(addr, Request::SECURE, p, size); +} + +void +SecurePortProxy::memsetBlob(Addr addr, uint8_t v, int size) const +{ + memsetBlobPhys(addr, Request::SECURE, v, size); +} |