gem5  v22.1.0.0
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_v< T, uint64_t >, T > gem5::swap_byte (T x)
 
template<typename T >
std::enable_if_t< sizeof(T)==4 &&std::is_convertible_v< T, uint32_t >, T > gem5::swap_byte (T x)
 
template<typename T >
std::enable_if_t< sizeof(T)==2 &&std::is_convertible_v< T, uint16_t >, T > gem5::swap_byte (T x)
 
template<typename T >
std::enable_if_t< sizeof(T)==1 &&std::is_convertible_v< T, uint8_t >, 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_v< T, vring_used_elem >, T > gem5::swap_byte (T v)
 
template<typename T >
std::enable_if_t< std::is_same_v< T, vring_desc >, T > gem5::swap_byte (T v)
 

Variables

const ByteOrder gem5::HostByteOrder = ByteOrder::big
 

Generated on Wed Dec 21 2022 10:22:58 for gem5 by doxygen 1.9.1