gem5  v21.1.0.2
Namespaces | Functions | Variables
byteswap.hh File Reference
#include <machine/endian.h>
#include <type_traits>
#include "base/types.hh"
#include "enums/ByteOrder.hh"

Go to the source code of this file.

Namespaces

 gem5
 Reference material can be found at the JEDEC website: UFS standard http://www.jedec.org/standards-documents/results/jesd220 UFS HCI specification http://www.jedec.org/standards-documents/results/jesd223.
 

Functions

uint64_t gem5::swap_byte64 (uint64_t x)
 
uint32_t gem5::swap_byte32 (uint32_t x)
 
uint16_t gem5::swap_byte16 (uint16_t x)
 
template<typename T >
std::enable_if_t< sizeof(T)==8 &&std::is_convertible< T, uint64_t >::value, T > gem5::swap_byte (T x)
 
template<typename T >
std::enable_if_t< sizeof(T)==4 &&std::is_convertible< T, uint32_t >::value, T > gem5::swap_byte (T x)
 
template<typename T >
std::enable_if_t< sizeof(T)==2 &&std::is_convertible< T, uint16_t >::value, T > gem5::swap_byte (T x)
 
template<typename T >
std::enable_if_t< sizeof(T)==1 &&std::is_convertible< T, uint8_t >::value, T > gem5::swap_byte (T x)
 
template<typename T , size_t N>
std::array< T, N > gem5::swap_byte (std::array< T, N > a)
 
template<typename T >
gem5::betole (T value)
 
template<typename T >
gem5::letobe (T value)
 
template<typename T >
gem5::htole (T value)
 
template<typename T >
gem5::letoh (T value)
 
template<typename T >
gem5::htobe (T value)
 
template<typename T >
gem5::betoh (T value)
 
template<typename T >
gem5::htog (T value, ByteOrder guest_byte_order)
 
template<typename T >
gem5::gtoh (T value, ByteOrder guest_byte_order)
 
VirtIO endian conversion helpers

VirtIO prior to version 1.0 (legacy versions) normally send values to the host in the guest systems native byte order. This is going to change in version 1.0 which mandates little endian. We currently only support the legacy version of VirtIO (the new and shiny standard is still in a draft state and not implemented by the kernel). Once we support the new standard, we should negotiate the VirtIO version with the guest and automatically use the right type of byte swapping.

template<typename T >
std::enable_if_t< std::is_same< T, vring_used_elem >::value, T > gem5::swap_byte (T v)
 
template<typename T >
std::enable_if_t< std::is_same< T, vring_desc >::value, T > gem5::swap_byte (T v)
 
VirtIO endian conversion helpers

VirtIO prior to version 1.0 (legacy versions) normally send values to the host in the guest systems native byte order. This is going to change in version 1.0 which mandates little endian. We currently only support the legacy version of VirtIO (the new and shiny standard is still in a draft state and not implemented by the kernel). Once we support the new standard, we should negotiate the VirtIO version with the guest and automatically use the right type of byte swapping.

template<typename T >
std::enable_if_t< std::is_same< T, vring_used_elem >::value, T > gem5::swap_byte (T v)
 
template<typename T >
std::enable_if_t< std::is_same< T, vring_desc >::value, T > gem5::swap_byte (T v)
 
VirtIO endian conversion helpers

VirtIO prior to version 1.0 (legacy versions) normally send values to the host in the guest systems native byte order. This is going to change in version 1.0 which mandates little endian. We currently only support the legacy version of VirtIO (the new and shiny standard is still in a draft state and not implemented by the kernel). Once we support the new standard, we should negotiate the VirtIO version with the guest and automatically use the right type of byte swapping.

template<typename T >
std::enable_if_t< std::is_same< T, vring_used_elem >::value, T > gem5::swap_byte (T v)
 
template<typename T >
std::enable_if_t< std::is_same< T, vring_desc >::value, T > gem5::swap_byte (T v)
 

Variables

const ByteOrder gem5::HostByteOrder = ByteOrder::big
 

Generated on Tue Sep 21 2021 12:26:44 for gem5 by doxygen 1.8.17