diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2012-02-29 04:47:51 -0500 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2012-02-29 04:47:51 -0500 |
commit | e5ac647fc96bae316cdea628e49de2a5e3918b78 (patch) | |
tree | 65da3ed1ddd9ca6c3af74e73570a379eba4f7e0d /src/mem/port_proxy.hh | |
parent | 88abdc0fad3f7670a112ade487c1a8cb848d56bc (diff) | |
download | gem5-e5ac647fc96bae316cdea628e49de2a5e3918b78.tar.xz |
MEM: Make all the port proxy members const
This is a trivial patch that merely makes all the member functions of
the port proxies const. There is no good reason why they should not
be, and this change only serves to make it explicit that they are not
modified through their use.
Diffstat (limited to 'src/mem/port_proxy.hh')
-rw-r--r-- | src/mem/port_proxy.hh | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/mem/port_proxy.hh b/src/mem/port_proxy.hh index d6ff4d68d..b2b27312e 100644 --- a/src/mem/port_proxy.hh +++ b/src/mem/port_proxy.hh @@ -88,7 +88,7 @@ class PortProxy /** The actual physical port used by this proxy. */ Port &_port; - void blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd); + void blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd) const; public: PortProxy(Port &port) : _port(port) { } @@ -97,31 +97,31 @@ class PortProxy /** * Read size bytes memory at address and store in p. */ - virtual void readBlob(Addr addr, uint8_t* p, int size) + virtual void readBlob(Addr addr, uint8_t* p, int size) const { blobHelper(addr, p, size, MemCmd::ReadReq); } /** * Write size bytes from p to address. */ - virtual void writeBlob(Addr addr, uint8_t* p, int size) + virtual void writeBlob(Addr addr, uint8_t* p, int size) const { blobHelper(addr, p, size, MemCmd::WriteReq); } /** * Fill size bytes starting at addr with byte value val. */ - virtual void memsetBlob(Addr addr, uint8_t v, int size); + virtual void memsetBlob(Addr addr, uint8_t v, int size) const; /** * Read sizeof(T) bytes from address and return as object T. */ template <typename T> - T read(Addr address); + T read(Addr address) const; /** * Write object T to address. Writes sizeof(T) bytes. */ template <typename T> - void write(Addr address, T data); + void write(Addr address, T data) const; #if THE_ISA != NO_ISA /** @@ -129,21 +129,21 @@ class PortProxy * Performs Guest to Host endianness transform. */ template <typename T> - T readGtoH(Addr address); + T readGtoH(Addr address) const; /** * Write object T to address. Writes sizeof(T) bytes. * Performs Host to Guest endianness transform. */ template <typename T> - void writeHtoG(Addr address, T data); + void writeHtoG(Addr address, T data) const; #endif }; template <typename T> T -PortProxy::read(Addr address) +PortProxy::read(Addr address) const { T data; readBlob(address, (uint8_t*)&data, sizeof(T)); @@ -152,7 +152,7 @@ PortProxy::read(Addr address) template <typename T> void -PortProxy::write(Addr address, T data) +PortProxy::write(Addr address, T data) const { writeBlob(address, (uint8_t*)&data, sizeof(T)); } @@ -160,7 +160,7 @@ PortProxy::write(Addr address, T data) #if THE_ISA != NO_ISA template <typename T> T -PortProxy::readGtoH(Addr address) +PortProxy::readGtoH(Addr address) const { T data; readBlob(address, (uint8_t*)&data, sizeof(T)); @@ -169,7 +169,7 @@ PortProxy::readGtoH(Addr address) template <typename T> void -PortProxy::writeHtoG(Addr address, T data) +PortProxy::writeHtoG(Addr address, T data) const { data = TheISA::htog(data); writeBlob(address, (uint8_t*)&data, sizeof(T)); |