Go to the documentation of this file.
30 #ifndef __ARCH_X86_MEMHELPERS_HH__
31 #define __ARCH_X86_MEMHELPERS_HH__
70 panic(
"Unhandled size in getMem.\n");
76 template <
typename T,
size_t N>
80 std::array<T, N> real_mem = pkt->
getLE<std::array<T, N> >();
81 for (
int i = 0;
i < N;
i++)
92 getPackedMem<uint32_t, N>(pkt,
mem, dataSize);
95 getPackedMem<uint64_t, N>(pkt,
mem, dataSize);
98 panic(
"Unhandled element size in getMem.\n");
109 memset(&
mem, 0,
sizeof(
mem));
124 template <
typename T,
size_t N>
129 std::array<T, N> real_mem;
131 constexpr
auto size =
sizeof(T) * N;
134 size, flags, byte_enable);
136 real_mem =
letoh(real_mem);
137 for (
int i = 0;
i < N;
i++)
138 mem[
i] = real_mem[
i];
146 std::array<uint64_t, N> &
mem,
unsigned dataSize,
153 fault = readPackedMemAtomic<uint32_t, N>(xc,
addr,
mem, flags);
156 fault = readPackedMemAtomic<uint64_t, N>(xc,
addr,
mem, flags);
159 panic(
"Unhandled element size in readMemAtomic\n");
161 if (fault ==
NoFault && traceData)
166 template <
typename T,
size_t N>
169 unsigned flags, uint64_t *res)
171 std::array<T, N> real_mem;
172 for (
int i = 0;
i < N;
i++)
173 real_mem[
i] =
mem[
i];
174 real_mem =
htole(real_mem);
176 constexpr
auto size =
sizeof(T) * N;
178 return xc->
writeMem((uint8_t *)&real_mem, size,
179 addr, flags, res, byte_enable);
198 std::array<uint64_t, N> &
mem,
unsigned dataSize,
199 Addr addr,
unsigned flags, uint64_t *res)
206 return writePackedMem<uint32_t, N>(xc,
mem,
addr, flags, res);
208 return writePackedMem<uint64_t, N>(xc,
mem,
addr, flags, res);
210 panic(
"Unhandled element size in writeMemTiming.\n");
224 flags, res, byte_enable);
233 std::array<uint64_t, N> &
mem,
unsigned dataSize,
234 Addr addr,
unsigned flags, uint64_t *res)
242 fault = writePackedMem<uint32_t, N>(xc,
mem,
addr, flags, res);
245 fault = writePackedMem<uint64_t, N>(xc,
mem,
addr, flags, res);
248 panic(
"Unhandled element size in writeMemAtomic.\n");
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 Fault writeMemAtomic(ExecContext *xc, Trace::InstRecord *traceData, uint64_t mem, unsigned dataSize, Addr addr, Request::Flags 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 void getPackedMem(PacketPtr pkt, std::array< uint64_t, N > &mem, unsigned dataSize)
static void getMem(PacketPtr pkt, uint64_t &mem, unsigned dataSize, Trace::InstRecord *traceData)
static Fault writeMemTiming(ExecContext *xc, Trace::InstRecord *traceData, uint64_t mem, unsigned dataSize, Addr addr, Request::Flags flags, uint64_t *res)
std::shared_ptr< FaultBase > Fault
static Fault readPackedMemAtomic(ExecContext *xc, Addr addr, std::array< uint64_t, N > &mem, unsigned flags)
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
void setData(std::array< T, N > d)
constexpr decltype(nullptr) NoFault
This is exposed globally, independent of the ISA.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
static Fault writePackedMem(ExecContext *xc, std::array< uint64_t, N > &mem, Addr addr, unsigned flags, uint64_t *res)
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
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.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
static Fault readMemAtomic(ExecContext *xc, Trace::InstRecord *traceData, Addr addr, uint64_t &mem, unsigned dataSize, Request::Flags flags)
virtual Fault initiateMemRead(Addr addr, unsigned int size, Request::Flags flags, const std::vector< bool > &byte_enable)
Initiate a timing memory read operation.
#define panic(...)
This implements a cprintf based panic() function.
Generated on Tue Mar 23 2021 19:41:23 for gem5 by doxygen 1.8.17