}
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();
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();
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;
}
/** 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.
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()) {
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()) {
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();
}
}
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;
* 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.
* 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;
* 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;
* 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);
* 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);
PortProxy::read(Addr address) const
{
T data;
- readBlob(address, (uint8_t*)&data, sizeof(T));
+ readBlob(address, &data, sizeof(T));
return data;
}
void
PortProxy::write(Addr address, T data) const
{
- writeBlob(address, (uint8_t*)&data, sizeof(T));
+ writeBlob(address, &data, sizeof(T));
}
template <typename 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);
}
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__
{ }
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;
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();
}
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;
pTable->translate(gen.addr(), paddr);
}
- PortProxy::writeBlobPhys(paddr, 0, p + prevSize, gen.size());
+ PortProxy::writeBlobPhys(paddr, 0, bytes + prevSize, gen.size());
prevSize += gen.size();
}
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;
};
#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;
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;
};