summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-02-29 04:47:51 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2012-02-29 04:47:51 -0500
commite5ac647fc96bae316cdea628e49de2a5e3918b78 (patch)
tree65da3ed1ddd9ca6c3af74e73570a379eba4f7e0d
parent88abdc0fad3f7670a112ade487c1a8cb848d56bc (diff)
downloadgem5-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.
-rw-r--r--src/mem/fs_translating_port_proxy.cc6
-rw-r--r--src/mem/fs_translating_port_proxy.hh6
-rw-r--r--src/mem/port_proxy.cc4
-rw-r--r--src/mem/port_proxy.hh24
-rw-r--r--src/mem/se_translating_port_proxy.cc20
-rw-r--r--src/mem/se_translating_port_proxy.hh20
6 files changed, 40 insertions, 40 deletions
diff --git a/src/mem/fs_translating_port_proxy.cc b/src/mem/fs_translating_port_proxy.cc
index 7a028bdcb..2e9a0fa00 100644
--- a/src/mem/fs_translating_port_proxy.cc
+++ b/src/mem/fs_translating_port_proxy.cc
@@ -68,7 +68,7 @@ FSTranslatingPortProxy::~FSTranslatingPortProxy()
}
void
-FSTranslatingPortProxy::readBlob(Addr addr, uint8_t *p, int size)
+FSTranslatingPortProxy::readBlob(Addr addr, uint8_t *p, int size) const
{
Addr paddr;
for (ChunkGenerator gen(addr, size, TheISA::PageBytes); !gen.done();
@@ -85,7 +85,7 @@ FSTranslatingPortProxy::readBlob(Addr addr, uint8_t *p, int size)
}
void
-FSTranslatingPortProxy::writeBlob(Addr addr, uint8_t *p, int size)
+FSTranslatingPortProxy::writeBlob(Addr addr, uint8_t *p, int size) const
{
Addr paddr;
for (ChunkGenerator gen(addr, size, TheISA::PageBytes); !gen.done();
@@ -102,7 +102,7 @@ FSTranslatingPortProxy::writeBlob(Addr addr, uint8_t *p, int size)
}
void
-FSTranslatingPortProxy::memsetBlob(Addr address, uint8_t v, int size)
+FSTranslatingPortProxy::memsetBlob(Addr address, uint8_t v, int size) const
{
Addr paddr;
for (ChunkGenerator gen(address, size, TheISA::PageBytes); !gen.done();
diff --git a/src/mem/fs_translating_port_proxy.hh b/src/mem/fs_translating_port_proxy.hh
index 826def902..2217a46aa 100644
--- a/src/mem/fs_translating_port_proxy.hh
+++ b/src/mem/fs_translating_port_proxy.hh
@@ -84,16 +84,16 @@ class FSTranslatingPortProxy : public PortProxy
/** Version of readblob that translates virt->phys and deals
* with page boundries. */
- virtual void readBlob(Addr addr, uint8_t *p, int size);
+ virtual void readBlob(Addr addr, uint8_t *p, int size) const;
/** Version of writeBlob that translates virt->phys and deals
* with page boundries. */
- virtual void writeBlob(Addr addr, uint8_t *p, int size);
+ virtual void writeBlob(Addr addr, uint8_t *p, int size) const;
/**
* Fill size bytes starting at addr with byte value val.
*/
- virtual void memsetBlob(Addr address, uint8_t v, int size);
+ virtual void memsetBlob(Addr address, uint8_t v, int size) const;
};
void CopyOut(ThreadContext *tc, void *dest, Addr src, size_t cplen);
diff --git a/src/mem/port_proxy.cc b/src/mem/port_proxy.cc
index ac6ec2465..c1fd41d3c 100644
--- a/src/mem/port_proxy.cc
+++ b/src/mem/port_proxy.cc
@@ -41,7 +41,7 @@
#include "mem/port_proxy.hh"
void
-PortProxy::blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd)
+PortProxy::blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd) const
{
Request req;
@@ -56,7 +56,7 @@ PortProxy::blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd)
}
void
-PortProxy::memsetBlob(Addr addr, uint8_t v, int size)
+PortProxy::memsetBlob(Addr addr, uint8_t v, int size) const
{
// quick and dirty...
uint8_t *buf = new uint8_t[size];
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));
diff --git a/src/mem/se_translating_port_proxy.cc b/src/mem/se_translating_port_proxy.cc
index 0f7ecb491..2ab130744 100644
--- a/src/mem/se_translating_port_proxy.cc
+++ b/src/mem/se_translating_port_proxy.cc
@@ -63,7 +63,7 @@ SETranslatingPortProxy::~SETranslatingPortProxy()
{ }
bool
-SETranslatingPortProxy::tryReadBlob(Addr addr, uint8_t *p, int size)
+SETranslatingPortProxy::tryReadBlob(Addr addr, uint8_t *p, int size) const
{
int prevSize = 0;
@@ -81,7 +81,7 @@ SETranslatingPortProxy::tryReadBlob(Addr addr, uint8_t *p, int size)
}
void
-SETranslatingPortProxy::readBlob(Addr addr, uint8_t *p, int size)
+SETranslatingPortProxy::readBlob(Addr addr, uint8_t *p, int size) const
{
if (!tryReadBlob(addr, p, size))
fatal("readBlob(0x%x, ...) failed", addr);
@@ -89,7 +89,7 @@ SETranslatingPortProxy::readBlob(Addr addr, uint8_t *p, int size)
bool
-SETranslatingPortProxy::tryWriteBlob(Addr addr, uint8_t *p, int size)
+SETranslatingPortProxy::tryWriteBlob(Addr addr, uint8_t *p, int size) const
{
int prevSize = 0;
@@ -120,14 +120,14 @@ SETranslatingPortProxy::tryWriteBlob(Addr addr, uint8_t *p, int size)
void
-SETranslatingPortProxy::writeBlob(Addr addr, uint8_t *p, int size)
+SETranslatingPortProxy::writeBlob(Addr addr, uint8_t *p, int size) const
{
if (!tryWriteBlob(addr, p, size))
fatal("writeBlob(0x%x, ...) failed", addr);
}
bool
-SETranslatingPortProxy::tryMemsetBlob(Addr addr, uint8_t val, int size)
+SETranslatingPortProxy::tryMemsetBlob(Addr addr, uint8_t val, int size) const
{
for (ChunkGenerator gen(addr, size, VMPageSize); !gen.done(); gen.next()) {
Addr paddr;
@@ -149,7 +149,7 @@ SETranslatingPortProxy::tryMemsetBlob(Addr addr, uint8_t val, int size)
}
void
-SETranslatingPortProxy::memsetBlob(Addr addr, uint8_t val, int size)
+SETranslatingPortProxy::memsetBlob(Addr addr, uint8_t val, int size) const
{
if (!tryMemsetBlob(addr, val, size))
fatal("memsetBlob(0x%x, ...) failed", addr);
@@ -157,7 +157,7 @@ SETranslatingPortProxy::memsetBlob(Addr addr, uint8_t val, int size)
bool
-SETranslatingPortProxy::tryWriteString(Addr addr, const char *str)
+SETranslatingPortProxy::tryWriteString(Addr addr, const char *str) const
{
uint8_t c;
@@ -177,14 +177,14 @@ SETranslatingPortProxy::tryWriteString(Addr addr, const char *str)
}
void
-SETranslatingPortProxy::writeString(Addr addr, const char *str)
+SETranslatingPortProxy::writeString(Addr addr, const char *str) const
{
if (!tryWriteString(addr, str))
fatal("writeString(0x%x, ...) failed", addr);
}
bool
-SETranslatingPortProxy::tryReadString(std::string &str, Addr addr)
+SETranslatingPortProxy::tryReadString(std::string &str, Addr addr) const
{
uint8_t c;
@@ -204,7 +204,7 @@ SETranslatingPortProxy::tryReadString(std::string &str, Addr addr)
}
void
-SETranslatingPortProxy::readString(std::string &str, Addr addr)
+SETranslatingPortProxy::readString(std::string &str, Addr addr) const
{
if (!tryReadString(str, addr))
fatal("readString(0x%x, ...) failed", addr);
diff --git a/src/mem/se_translating_port_proxy.hh b/src/mem/se_translating_port_proxy.hh
index 105122850..31874e6b8 100644
--- a/src/mem/se_translating_port_proxy.hh
+++ b/src/mem/se_translating_port_proxy.hh
@@ -83,18 +83,18 @@ class SETranslatingPortProxy : public PortProxy
SETranslatingPortProxy(Port& port, Process* p, AllocType alloc);
virtual ~SETranslatingPortProxy();
- bool tryReadBlob(Addr addr, uint8_t *p, int size);
- bool tryWriteBlob(Addr addr, uint8_t *p, int size);
- bool tryMemsetBlob(Addr addr, uint8_t val, int size);
- bool tryWriteString(Addr addr, const char *str);
- bool tryReadString(std::string &str, Addr addr);
+ bool tryReadBlob(Addr addr, uint8_t *p, int size) const;
+ bool tryWriteBlob(Addr addr, uint8_t *p, int size) const;
+ bool tryMemsetBlob(Addr addr, uint8_t val, int size) const;
+ bool tryWriteString(Addr addr, const char *str) const;
+ bool tryReadString(std::string &str, Addr addr) const;
- virtual void readBlob(Addr addr, uint8_t *p, int size);
- virtual void writeBlob(Addr addr, uint8_t *p, int size);
- virtual void memsetBlob(Addr addr, uint8_t val, int size);
+ virtual void readBlob(Addr addr, uint8_t *p, int size) const;
+ virtual void writeBlob(Addr addr, uint8_t *p, int size) const;
+ virtual void memsetBlob(Addr addr, uint8_t val, int size) const;
- void writeString(Addr addr, const char *str);
- void readString(std::string &str, Addr addr);
+ void writeString(Addr addr, const char *str) const;
+ void readString(std::string &str, Addr addr) const;
};
#endif // __MEM_SE_TRANSLATING_PORT_PROXY_HH__