summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mem/fs_translating_port_proxy.cc8
-rw-r--r--src/mem/fs_translating_port_proxy.hh4
-rw-r--r--src/mem/port_proxy.cc14
-rw-r--r--src/mem/port_proxy.hh20
-rw-r--r--src/mem/se_translating_port_proxy.cc11
-rw-r--r--src/mem/se_translating_port_proxy.hh4
-rw-r--r--src/mem/secure_port_proxy.cc4
-rw-r--r--src/mem/secure_port_proxy.hh4
8 files changed, 35 insertions, 34 deletions
diff --git a/src/mem/fs_translating_port_proxy.cc b/src/mem/fs_translating_port_proxy.cc
index a21d3283a..2e17cbf63 100644
--- a/src/mem/fs_translating_port_proxy.cc
+++ b/src/mem/fs_translating_port_proxy.cc
@@ -67,7 +67,7 @@ FSTranslatingPortProxy::FSTranslatingPortProxy(MasterPort &port,
}
bool
-FSTranslatingPortProxy::tryReadBlob(Addr addr, uint8_t *p, int size) const
+FSTranslatingPortProxy::tryReadBlob(Addr addr, void *p, int size) const
{
Addr paddr;
for (ChunkGenerator gen(addr, size, TheISA::PageBytes); !gen.done();
@@ -79,14 +79,14 @@ FSTranslatingPortProxy::tryReadBlob(Addr addr, uint8_t *p, int size) const
paddr = TheISA::vtophys(gen.addr());
PortProxy::readBlobPhys(paddr, 0, p, gen.size());
- p += gen.size();
+ p = static_cast<uint8_t *>(p) + gen.size();
}
return true;
}
bool
FSTranslatingPortProxy::tryWriteBlob(
- Addr addr, const uint8_t *p, int size) const
+ Addr addr, const void *p, int size) const
{
Addr paddr;
for (ChunkGenerator gen(addr, size, TheISA::PageBytes); !gen.done();
@@ -98,7 +98,7 @@ FSTranslatingPortProxy::tryWriteBlob(
paddr = TheISA::vtophys(gen.addr());
PortProxy::writeBlobPhys(paddr, 0, p, gen.size());
- p += gen.size();
+ p = static_cast<const uint8_t *>(p) + gen.size();
}
return true;
}
diff --git a/src/mem/fs_translating_port_proxy.hh b/src/mem/fs_translating_port_proxy.hh
index 5ae87001c..78adf1ac5 100644
--- a/src/mem/fs_translating_port_proxy.hh
+++ b/src/mem/fs_translating_port_proxy.hh
@@ -85,11 +85,11 @@ class FSTranslatingPortProxy : public PortProxy
/** Version of tryReadblob that translates virt->phys and deals
* with page boundries. */
- bool tryReadBlob(Addr addr, uint8_t *p, int size) const override;
+ bool tryReadBlob(Addr addr, void *p, int size) const override;
/** Version of tryWriteBlob that translates virt->phys and deals
* with page boundries. */
- bool tryWriteBlob(Addr addr, const uint8_t *p, int size) const override;
+ bool tryWriteBlob(Addr addr, const void *p, int size) const override;
/**
* Fill size bytes starting at addr with byte value val.
diff --git a/src/mem/port_proxy.cc b/src/mem/port_proxy.cc
index 97eb67eff..f56bfeb55 100644
--- a/src/mem/port_proxy.cc
+++ b/src/mem/port_proxy.cc
@@ -43,7 +43,7 @@
void
PortProxy::readBlobPhys(Addr addr, Request::Flags flags,
- uint8_t *p, int size) const
+ void *p, int size) const
{
for (ChunkGenerator gen(addr, size, _cacheLineSize); !gen.done();
gen.next()) {
@@ -52,15 +52,15 @@ PortProxy::readBlobPhys(Addr addr, Request::Flags flags,
gen.addr(), gen.size(), flags, Request::funcMasterId);
Packet pkt(req, MemCmd::ReadReq);
- pkt.dataStatic(p);
+ pkt.dataStatic(static_cast<uint8_t *>(p));
_port.sendFunctional(&pkt);
- p += gen.size();
+ p = static_cast<uint8_t *>(p) + gen.size();
}
}
void
PortProxy::writeBlobPhys(Addr addr, Request::Flags flags,
- const uint8_t *p, int size) const
+ const void *p, int size) const
{
for (ChunkGenerator gen(addr, size, _cacheLineSize); !gen.done();
gen.next()) {
@@ -69,9 +69,9 @@ PortProxy::writeBlobPhys(Addr addr, Request::Flags flags,
gen.addr(), gen.size(), flags, Request::funcMasterId);
Packet pkt(req, MemCmd::WriteReq);
- pkt.dataStaticConst(p);
+ pkt.dataStaticConst(static_cast<const uint8_t *>(p));
_port.sendFunctional(&pkt);
- p += gen.size();
+ p = static_cast<const uint8_t *>(p) + gen.size();
}
}
@@ -92,7 +92,7 @@ bool
PortProxy::tryWriteString(Addr addr, const char *str) const
{
do {
- if (!tryWriteBlob(addr++, (uint8_t *)str, 1))
+ if (!tryWriteBlob(addr++, str, 1))
return false;
} while (*str++);
return true;
diff --git a/src/mem/port_proxy.hh b/src/mem/port_proxy.hh
index dcc1905a5..096f82664 100644
--- a/src/mem/port_proxy.hh
+++ b/src/mem/port_proxy.hh
@@ -100,13 +100,13 @@ class PortProxy
* Read size bytes memory at physical address and store in p.
*/
void readBlobPhys(Addr addr, Request::Flags flags,
- uint8_t* p, int size) const;
+ void *p, int size) const;
/**
* Write size bytes from p to physical address.
*/
void writeBlobPhys(Addr addr, Request::Flags flags,
- const uint8_t* p, int size) const;
+ const void *p, int size) const;
/**
* Fill size bytes starting at physical addr with byte value val.
@@ -123,7 +123,7 @@ class PortProxy
* Returns true on success and false on failure.
*/
virtual bool
- tryReadBlob(Addr addr, uint8_t *p, int size) const
+ tryReadBlob(Addr addr, void *p, int size) const
{
readBlobPhys(addr, 0, p, size);
return true;
@@ -134,7 +134,7 @@ class PortProxy
* Returns true on success and false on failure.
*/
virtual bool
- tryWriteBlob(Addr addr, const uint8_t *p, int size) const
+ tryWriteBlob(Addr addr, const void *p, int size) const
{
writeBlobPhys(addr, 0, p, size);
return true;
@@ -159,7 +159,7 @@ class PortProxy
* Same as tryReadBlob, but insists on success.
*/
void
- readBlob(Addr addr, uint8_t* p, int size) const
+ readBlob(Addr addr, void *p, int size) const
{
if (!tryReadBlob(addr, p, size))
fatal("readBlob(%#x, ...) failed", addr);
@@ -169,7 +169,7 @@ class PortProxy
* Same as tryWriteBlob, but insists on success.
*/
void
- writeBlob(Addr addr, const uint8_t* p, int size) const
+ writeBlob(Addr addr, const void *p, int size) const
{
if (!tryWriteBlob(addr, p, size))
fatal("writeBlob(%#x, ...) failed", addr);
@@ -250,7 +250,7 @@ T
PortProxy::read(Addr address) const
{
T data;
- readBlob(address, (uint8_t*)&data, sizeof(T));
+ readBlob(address, &data, sizeof(T));
return data;
}
@@ -258,7 +258,7 @@ template <typename T>
void
PortProxy::write(Addr address, T data) const
{
- writeBlob(address, (uint8_t*)&data, sizeof(T));
+ writeBlob(address, &data, sizeof(T));
}
template <typename T>
@@ -266,7 +266,7 @@ T
PortProxy::read(Addr address, ByteOrder byte_order) const
{
T data;
- readBlob(address, (uint8_t*)&data, sizeof(T));
+ readBlob(address, &data, sizeof(T));
return gtoh(data, byte_order);
}
@@ -275,7 +275,7 @@ void
PortProxy::write(Addr address, T data, ByteOrder byte_order) const
{
data = htog(data, byte_order);
- writeBlob(address, (uint8_t*)&data, sizeof(T));
+ writeBlob(address, &data, sizeof(T));
}
#endif // __MEM_PORT_PROXY_HH__
diff --git a/src/mem/se_translating_port_proxy.cc b/src/mem/se_translating_port_proxy.cc
index de5335a05..c5f38f1cd 100644
--- a/src/mem/se_translating_port_proxy.cc
+++ b/src/mem/se_translating_port_proxy.cc
@@ -62,9 +62,10 @@ SETranslatingPortProxy::SETranslatingPortProxy(MasterPort& port, Process *p,
{ }
bool
-SETranslatingPortProxy::tryReadBlob(Addr addr, uint8_t *p, int size) const
+SETranslatingPortProxy::tryReadBlob(Addr addr, void *p, int size) const
{
int prevSize = 0;
+ auto *bytes = static_cast<uint8_t *>(p);
for (ChunkGenerator gen(addr, size, PageBytes); !gen.done(); gen.next()) {
Addr paddr;
@@ -72,7 +73,7 @@ SETranslatingPortProxy::tryReadBlob(Addr addr, uint8_t *p, int size) const
if (!pTable->translate(gen.addr(),paddr))
return false;
- PortProxy::readBlobPhys(paddr, 0, p + prevSize, gen.size());
+ PortProxy::readBlobPhys(paddr, 0, bytes + prevSize, gen.size());
prevSize += gen.size();
}
@@ -81,10 +82,10 @@ SETranslatingPortProxy::tryReadBlob(Addr addr, uint8_t *p, int size) const
bool
-SETranslatingPortProxy::tryWriteBlob(Addr addr, const uint8_t *p,
- int size) const
+SETranslatingPortProxy::tryWriteBlob(Addr addr, const void *p, int size) const
{
int prevSize = 0;
+ auto *bytes = static_cast<const uint8_t *>(p);
for (ChunkGenerator gen(addr, size, PageBytes); !gen.done(); gen.next()) {
Addr paddr;
@@ -104,7 +105,7 @@ SETranslatingPortProxy::tryWriteBlob(Addr addr, const uint8_t *p,
pTable->translate(gen.addr(), paddr);
}
- PortProxy::writeBlobPhys(paddr, 0, p + prevSize, gen.size());
+ PortProxy::writeBlobPhys(paddr, 0, bytes + prevSize, gen.size());
prevSize += gen.size();
}
diff --git a/src/mem/se_translating_port_proxy.hh b/src/mem/se_translating_port_proxy.hh
index 1c8828bbf..718e44a57 100644
--- a/src/mem/se_translating_port_proxy.hh
+++ b/src/mem/se_translating_port_proxy.hh
@@ -85,8 +85,8 @@ class SETranslatingPortProxy : public PortProxy
void setPageTable(EmulationPageTable *p) { pTable = p; }
void setProcess(Process *p) { process = p; }
- bool tryReadBlob(Addr addr, uint8_t *p, int size) const override;
- bool tryWriteBlob(Addr addr, const uint8_t *p, int size) const override;
+ bool tryReadBlob(Addr addr, void *p, int size) const override;
+ bool tryWriteBlob(Addr addr, const void *p, int size) const override;
bool tryMemsetBlob(Addr addr, uint8_t val, int size) const override;
};
diff --git a/src/mem/secure_port_proxy.cc b/src/mem/secure_port_proxy.cc
index 645baa948..01195f4b9 100644
--- a/src/mem/secure_port_proxy.cc
+++ b/src/mem/secure_port_proxy.cc
@@ -40,14 +40,14 @@
#include "mem/secure_port_proxy.hh"
bool
-SecurePortProxy::tryReadBlob(Addr addr, uint8_t *p, int size) const
+SecurePortProxy::tryReadBlob(Addr addr, void *p, int size) const
{
readBlobPhys(addr, Request::SECURE, p, size);
return true;
}
bool
-SecurePortProxy::tryWriteBlob(Addr addr, const uint8_t *p, int size) const
+SecurePortProxy::tryWriteBlob(Addr addr, const void *p, int size) const
{
writeBlobPhys(addr, Request::SECURE, p, size);
return true;
diff --git a/src/mem/secure_port_proxy.hh b/src/mem/secure_port_proxy.hh
index 032331210..9a2200c9e 100644
--- a/src/mem/secure_port_proxy.hh
+++ b/src/mem/secure_port_proxy.hh
@@ -73,8 +73,8 @@ class SecurePortProxy : public PortProxy
SecurePortProxy(MasterPort &port, unsigned int cache_line_size)
: PortProxy(port, cache_line_size) {}
- bool tryReadBlob(Addr addr, uint8_t *p, int size) const override;
- bool tryWriteBlob(Addr addr, const uint8_t *p, int size) const override;
+ bool tryReadBlob(Addr addr, void *p, int size) const override;
+ bool tryWriteBlob(Addr addr, const void *p, int size) const override;
bool tryMemsetBlob(Addr addr, uint8_t val, int size) const override;
};