diff options
author | Gabe Black <gabeblack@google.com> | 2019-04-24 17:19:23 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2019-04-28 03:09:09 +0000 |
commit | fce9c7a26f8c8a29d51c319c876a7bf0a32404a7 (patch) | |
tree | 61cf66e892473fafab9e0e7726750542a0be92b0 /src/mem | |
parent | cdcc55a6a8fe9b4625b316a8d8845366ccfa71c9 (diff) | |
download | gem5-fce9c7a26f8c8a29d51c319c876a7bf0a32404a7.tar.xz |
mem: Remove the ISA specialized versions of port proxy's read/write.
These selected their behavior based on ifdefs and had to be disabled
when on the NULL ISA. The versions which take an explicit endianness
have been renamed to just read/write instead of readGtoH and writeHtoG
since the direction of the translation is obvious from context.
Change-Id: I6cfbfda6c4481962d442d3370534e50532d41814
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18372
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/mem')
-rw-r--r-- | src/mem/port_proxy.hh | 67 |
1 files changed, 17 insertions, 50 deletions
diff --git a/src/mem/port_proxy.hh b/src/mem/port_proxy.hh index fe87bf517..e48942e35 100644 --- a/src/mem/port_proxy.hh +++ b/src/mem/port_proxy.hh @@ -59,11 +59,6 @@ #ifndef __MEM_PORT_PROXY_HH__ #define __MEM_PORT_PROXY_HH__ -#include "config/the_isa.hh" -#if THE_ISA != NULL_ISA - #include "arch/isa_traits.hh" -#endif - #include "mem/port.hh" #include "sim/byteswap.hh" @@ -93,27 +88,34 @@ class PortProxy public: PortProxy(MasterPort &port, unsigned int cacheLineSize) : - _port(port), _cacheLineSize(cacheLineSize) { } + _port(port), _cacheLineSize(cacheLineSize) + {} virtual ~PortProxy() { } /** * Read size bytes memory at address and store in p. */ - virtual void readBlob(Addr addr, uint8_t* p, int size) const { + virtual void + readBlob(Addr addr, uint8_t* p, int size) const + { readBlobPhys(addr, 0, p, size); } /** * Write size bytes from p to address. */ - virtual void writeBlob(Addr addr, const uint8_t* p, int size) const { + virtual void + writeBlob(Addr addr, const uint8_t* p, int size) const + { writeBlobPhys(addr, 0, p, size); } /** * Fill size bytes starting at addr with byte value val. */ - virtual void memsetBlob(Addr addr, uint8_t v, int size) const { + virtual void + memsetBlob(Addr addr, uint8_t v, int size) const + { memsetBlobPhys(addr, 0, v, size); } @@ -149,33 +151,17 @@ class PortProxy /** * Read sizeof(T) bytes from address and return as object T. - * Performs selected endianness transform. - */ - template <typename T> - T readGtoH(Addr address, ByteOrder guest_byte_order) const; - - /** - * Write object T to address. Writes sizeof(T) bytes. - * Performs selected endianness transform. - */ - template <typename T> - void writeHtoG(Addr address, T data, ByteOrder guest_byte_order) const; - -#if THE_ISA != NULL_ISA - /** - * Read sizeof(T) bytes from address and return as object T. - * Performs Guest to Host endianness transform. + * Performs endianness conversion from the selected guest to host order. */ template <typename T> - T readGtoH(Addr address) const; + T read(Addr address, ByteOrder guest_byte_order) const; /** * Write object T to address. Writes sizeof(T) bytes. - * Performs Host to Guest endianness transform. + * Performs endianness conversion from host to the selected guest order. */ template <typename T> - void writeHtoG(Addr address, T data) const; -#endif + void write(Addr address, T data, ByteOrder guest_byte_order) const; }; @@ -214,7 +200,7 @@ PortProxy::write(Addr address, T data) const template <typename T> T -PortProxy::readGtoH(Addr address, ByteOrder byte_order) const +PortProxy::read(Addr address, ByteOrder byte_order) const { T data; readBlob(address, (uint8_t*)&data, sizeof(T)); @@ -223,29 +209,10 @@ PortProxy::readGtoH(Addr address, ByteOrder byte_order) const template <typename T> void -PortProxy::writeHtoG(Addr address, T data, ByteOrder byte_order) const +PortProxy::write(Addr address, T data, ByteOrder byte_order) const { data = htog(data, byte_order); writeBlob(address, (uint8_t*)&data, sizeof(T)); } -#if THE_ISA != NULL_ISA -template <typename T> -T -PortProxy::readGtoH(Addr address) const -{ - T data; - readBlob(address, (uint8_t*)&data, sizeof(T)); - return TheISA::gtoh(data); -} - -template <typename T> -void -PortProxy::writeHtoG(Addr address, T data) const -{ - data = TheISA::htog(data); - writeBlob(address, (uint8_t*)&data, sizeof(T)); -} -#endif - #endif // __MEM_PORT_PROXY_HH__ |