[gem5-dev] Change in gem5/gem5[master]: mem, arm: Replace the pointer type in PortProxy with void *.
Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/18571 ) Change subject: mem, arm: Replace the pointer type in PortProxy with void *. .. mem, arm: Replace the pointer type in PortProxy with void *. The void * type is for pointers which point to an unknown type. We should use that when handling anonymous buffers in the PortProxy functions, instead of uint8_t * which points to bytes. Importantly, C/C++ doesn't require you to do any casting to turn an arbitrary pointer type into a void *. This will get rid of lots of tedious, verbose casting throughout the code base. Change-Id: Id1adecc283c866d8e24524efd64f37b079088bd9 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18571 Tested-by: kokoro Reviewed-by: Andreas Sandberg Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- M src/mem/fs_translating_port_proxy.cc M src/mem/fs_translating_port_proxy.hh M src/mem/port_proxy.cc M src/mem/port_proxy.hh M src/mem/se_translating_port_proxy.cc M src/mem/se_translating_port_proxy.hh M src/mem/secure_port_proxy.cc M src/mem/secure_port_proxy.hh 8 files changed, 35 insertions(+), 34 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved Andreas Sandberg: Looks good to me, approved kokoro: Regressions pass diff --git a/src/mem/fs_translating_port_proxy.cc b/src/mem/fs_translating_port_proxy.cc index a21d328..2e17cbf 100644 --- a/src/mem/fs_translating_port_proxy.cc +++ b/src/mem/fs_translating_port_proxy.cc @@ -67,7 +67,7 @@ } 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 @@ paddr = TheISA::vtophys(gen.addr()); PortProxy::readBlobPhys(paddr, 0, p, gen.size()); -p += gen.size(); +p = static_cast(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 @@ paddr = TheISA::vtophys(gen.addr()); PortProxy::writeBlobPhys(paddr, 0, p, gen.size()); -p += gen.size(); +p = static_cast(p) + gen.size(); } return true; } diff --git a/src/mem/fs_translating_port_proxy.hh b/src/mem/fs_translating_port_proxy.hh index 5ae8700..78adf1a 100644 --- a/src/mem/fs_translating_port_proxy.hh +++ b/src/mem/fs_translating_port_proxy.hh @@ -85,11 +85,11 @@ /** 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 97eb67e..f56bfeb 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 @@ gen.addr(), gen.size(), flags, Request::funcMasterId); Packet pkt(req, MemCmd::ReadReq); -pkt.dataStatic(p); +pkt.dataStatic(static_cast(p)); _port.sendFunctional(); -p += gen.size(); +p = static_cast(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 @@ gen.addr(), gen.size(), flags, Request::funcMasterId); Packet pkt(req, MemCmd::WriteReq); -pkt.dataStaticConst(p); +pkt.dataStaticConst(static_cast(p)); _port.sendFunctional(); -p += gen.size(); +p = static_cast(p) + gen.size(); } } @@ -92,7 +92,7 @@ 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++);
[gem5-dev] Change in gem5/gem5[master]: mem, arm: Replace the pointer type in PortProxy with void *.
Hello Andreas Sandberg, Brandon Potter, kokoro, Daniel Carvalho, Anthony Gutierrez, Jason Lowe-Power, Nikos Nikoleris, I'd like you to reexamine a change. Please visit https://gem5-review.googlesource.com/c/public/gem5/+/18571 to look at the new patch set (#3). Change subject: mem, arm: Replace the pointer type in PortProxy with void *. .. mem, arm: Replace the pointer type in PortProxy with void *. The void * type is for pointers which point to an unknown type. We should use that when handling anonymous buffers in the PortProxy functions, instead of uint8_t * which points to bytes. Importantly, C/C++ doesn't require you to do any casting to turn an arbitrary pointer type into a void *. This will get rid of lots of tedious, verbose casting throughout the code base. Change-Id: Id1adecc283c866d8e24524efd64f37b079088bd9 --- M src/mem/fs_translating_port_proxy.cc M src/mem/fs_translating_port_proxy.hh M src/mem/port_proxy.cc M src/mem/port_proxy.hh M src/mem/se_translating_port_proxy.cc M src/mem/se_translating_port_proxy.hh M src/mem/secure_port_proxy.cc M src/mem/secure_port_proxy.hh 8 files changed, 35 insertions(+), 34 deletions(-) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/18571 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: master Gerrit-Change-Id: Id1adecc283c866d8e24524efd64f37b079088bd9 Gerrit-Change-Number: 18571 Gerrit-PatchSet: 3 Gerrit-Owner: Gabe Black Gerrit-Reviewer: Andreas Sandberg Gerrit-Reviewer: Anthony Gutierrez Gerrit-Reviewer: Brandon Potter Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Nikos Nikoleris Gerrit-Reviewer: kokoro Gerrit-MessageType: newpatchset ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Change in gem5/gem5[master]: mem, arm: Replace the pointer type in PortProxy with void *.
Hello Andreas Sandberg, Brandon Potter, kokoro, Daniel Carvalho, Anthony Gutierrez, Jason Lowe-Power, Nikos Nikoleris, I'd like you to reexamine a change. Please visit https://gem5-review.googlesource.com/c/public/gem5/+/18571 to look at the new patch set (#2). Change subject: mem, arm: Replace the pointer type in PortProxy with void *. .. mem, arm: Replace the pointer type in PortProxy with void *. The void * type is for pointers which point to an unknown type. We should use that when handling anonymous buffers in the PortProxy functions, instead of uint8_t * which points to bytes. Importantly, C/C++ doesn't require you to do any casting to turn an arbitrary pointer type into a void *. This will get rid of lots of tedious, verbose casting throughout the code base. Change-Id: Id1adecc283c866d8e24524efd64f37b079088bd9 --- M src/mem/fs_translating_port_proxy.cc M src/mem/fs_translating_port_proxy.hh M src/mem/port_proxy.cc M src/mem/port_proxy.hh M src/mem/se_translating_port_proxy.cc M src/mem/se_translating_port_proxy.hh M src/mem/secure_port_proxy.cc M src/mem/secure_port_proxy.hh 8 files changed, 35 insertions(+), 34 deletions(-) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/18571 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: master Gerrit-Change-Id: Id1adecc283c866d8e24524efd64f37b079088bd9 Gerrit-Change-Number: 18571 Gerrit-PatchSet: 2 Gerrit-Owner: Gabe Black Gerrit-Reviewer: Andreas Sandberg Gerrit-Reviewer: Anthony Gutierrez Gerrit-Reviewer: Brandon Potter Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Nikos Nikoleris Gerrit-Reviewer: kokoro Gerrit-MessageType: newpatchset ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Change in gem5/gem5[master]: mem, arm: Replace the pointer type in PortProxy with void *.
Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/18571 Change subject: mem, arm: Replace the pointer type in PortProxy with void *. .. mem, arm: Replace the pointer type in PortProxy with void *. The void * type is for pointers which point to an unknown type. We should use that when handling anonymous buffers in the PortProxy functions, instead of uint8_t * which points to bytes. Importantly, C/C++ doesn't require you to do any casting to turn an arbitrary pointer type into a void *. This will get rid of lots of tedious, verbose casting throughout the code base. Change-Id: Id1adecc283c866d8e24524efd64f37b079088bd9 --- M src/arch/arm/secure_port_proxy.cc M src/arch/arm/secure_port_proxy.hh M src/mem/fs_translating_port_proxy.cc M src/mem/fs_translating_port_proxy.hh M src/mem/port_proxy.cc M src/mem/port_proxy.hh M src/mem/se_translating_port_proxy.cc M src/mem/se_translating_port_proxy.hh 8 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/arch/arm/secure_port_proxy.cc b/src/arch/arm/secure_port_proxy.cc index 319d1f1..e697b96 100644 --- a/src/arch/arm/secure_port_proxy.cc +++ b/src/arch/arm/secure_port_proxy.cc @@ -40,14 +40,14 @@ #include "arch/arm/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/arch/arm/secure_port_proxy.hh b/src/arch/arm/secure_port_proxy.hh index a3e50be..566b918 100644 --- a/src/arch/arm/secure_port_proxy.hh +++ b/src/arch/arm/secure_port_proxy.hh @@ -73,8 +73,8 @@ SecurePortProxy(MasterPort , 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; }; diff --git a/src/mem/fs_translating_port_proxy.cc b/src/mem/fs_translating_port_proxy.cc index a21d328..2e17cbf 100644 --- a/src/mem/fs_translating_port_proxy.cc +++ b/src/mem/fs_translating_port_proxy.cc @@ -67,7 +67,7 @@ } 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 @@ paddr = TheISA::vtophys(gen.addr()); PortProxy::readBlobPhys(paddr, 0, p, gen.size()); -p += gen.size(); +p = static_cast(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 @@ paddr = TheISA::vtophys(gen.addr()); PortProxy::writeBlobPhys(paddr, 0, p, gen.size()); -p += gen.size(); +p = static_cast(p) + gen.size(); } return true; } diff --git a/src/mem/fs_translating_port_proxy.hh b/src/mem/fs_translating_port_proxy.hh index 5ae8700..78adf1a 100644 --- a/src/mem/fs_translating_port_proxy.hh +++ b/src/mem/fs_translating_port_proxy.hh @@ -85,11 +85,11 @@ /** 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 97eb67e..f56bfeb 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 @@ gen.addr(), gen.size(), flags, Request::funcMasterId);