Go to the documentation of this file.
30 #ifndef __ARCH_X86_MEMHELPERS_HH__
31 #define __ARCH_X86_MEMHELPERS_HH__
73 panic(
"Unhandled size in getMem.\n");
79 template <
typename T,
size_t N>
83 std::array<T, N> real_mem = pkt->
getLE<std::array<T, N> >();
84 for (
int i = 0;
i < N;
i++)
95 getPackedMem<uint32_t, N>(pkt,
mem, dataSize);
98 getPackedMem<uint64_t, N>(pkt,
mem, dataSize);
101 panic(
"Unhandled element size in getMem.\n");
112 memset(&
mem, 0,
sizeof(
mem));
127 template <
typename T,
size_t N>
132 std::array<T, N> real_mem;
134 constexpr
auto size =
sizeof(T) * N;
137 size,
flags, byte_enable);
139 real_mem =
letoh(real_mem);
140 for (
int i = 0;
i < N;
i++)
141 mem[
i] = real_mem[
i];
149 std::array<uint64_t, N> &
mem,
unsigned dataSize,
156 fault = readPackedMemAtomic<uint32_t, N>(xc,
addr,
mem,
flags);
159 fault = readPackedMemAtomic<uint64_t, N>(xc,
addr,
mem,
flags);
162 panic(
"Unhandled element size in readMemAtomic\n");
164 if (fault ==
NoFault && traceData)
169 template <
typename T,
size_t N>
172 unsigned flags, uint64_t *res)
174 std::array<T, N> real_mem;
175 for (
int i = 0;
i < N;
i++)
176 real_mem[
i] =
mem[
i];
177 real_mem =
htole(real_mem);
179 constexpr
auto size =
sizeof(T) * N;
181 return xc->
writeMem((uint8_t *)&real_mem, size,
201 std::array<uint64_t, N> &
mem,
unsigned dataSize,
209 return writePackedMem<uint32_t, N>(xc,
mem,
addr,
flags, res);
211 return writePackedMem<uint64_t, N>(xc,
mem,
addr,
flags, res);
213 panic(
"Unhandled element size in writeMemTiming.\n");
227 flags, res, byte_enable);
236 std::array<uint64_t, N> &
mem,
unsigned dataSize,
245 fault = writePackedMem<uint32_t, N>(xc,
mem,
addr,
flags, res);
248 fault = writePackedMem<uint64_t, N>(xc,
mem,
addr,
flags, res);
251 panic(
"Unhandled element size in writeMemAtomic.\n");
constexpr decltype(nullptr) NoFault
static Fault writePackedMem(ExecContext *xc, std::array< uint64_t, N > &mem, Addr addr, unsigned flags, uint64_t *res)
static Fault initiateMemRead(ExecContext *xc, trace::InstRecord *traceData, Addr addr, unsigned dataSize, Request::Flags flags)
Initiate a read from memory in timing mode.
static Fault writeMemTiming(ExecContext *xc, trace::InstRecord *traceData, uint64_t mem, unsigned dataSize, Addr addr, Request::Flags flags, uint64_t *res)
void setData(std::array< T, N > d)
std::shared_ptr< FaultBase > Fault
static void getMem(PacketPtr pkt, uint64_t &mem, unsigned dataSize, trace::InstRecord *traceData)
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
virtual Fault writeMem(uint8_t *data, unsigned int size, Addr addr, Request::Flags flags, uint64_t *res, const std::vector< bool > &byte_enable)=0
For atomic-mode contexts, perform an atomic memory write operation.
virtual Fault initiateMemRead(Addr addr, unsigned int size, Request::Flags flags, const std::vector< bool > &byte_enable)
Initiate a timing memory read operation.
static Fault readMemAtomic(ExecContext *xc, trace::InstRecord *traceData, Addr addr, uint64_t &mem, unsigned dataSize, Request::Flags flags)
static Fault readPackedMemAtomic(ExecContext *xc, Addr addr, std::array< uint64_t, N > &mem, unsigned flags)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual Fault readMem(Addr addr, uint8_t *data, unsigned int size, Request::Flags flags, const std::vector< bool > &byte_enable)
Perform an atomic memory read operation.
static void getPackedMem(PacketPtr pkt, std::array< uint64_t, N > &mem, unsigned dataSize)
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
static Fault writeMemAtomic(ExecContext *xc, trace::InstRecord *traceData, uint64_t mem, unsigned dataSize, Addr addr, Request::Flags flags, uint64_t *res)
#define panic(...)
This implements a cprintf based panic() function.
Generated on Sun Jul 30 2023 01:56:50 for gem5 by doxygen 1.8.17