Go to the documentation of this file.
30 #ifndef __ARCH_X86_MEMHELPERS_HH__
31 #define __ARCH_X86_MEMHELPERS_HH__
69 panic(
"Unhandled size in getMem.\n");
75 template <
typename T,
size_t N>
79 std::array<T, N> real_mem = pkt->
getLE<std::array<T, N> >();
80 for (
int i = 0;
i < N;
i++)
91 getPackedMem<uint32_t, N>(pkt,
mem, dataSize);
94 getPackedMem<uint64_t, N>(pkt,
mem, dataSize);
97 panic(
"Unhandled element size in getMem.\n");
108 memset(&
mem, 0,
sizeof(
mem));
121 template <
typename T,
size_t N>
126 std::array<T, N> real_mem;
128 sizeof(T) * N, flags);
130 real_mem =
letoh(real_mem);
131 for (
int i = 0;
i < N;
i++)
132 mem[
i] = real_mem[
i];
140 std::array<uint64_t, N> &
mem,
unsigned dataSize,
147 fault = readPackedMemAtomic<uint32_t, N>(xc,
addr,
mem, flags);
150 fault = readPackedMemAtomic<uint64_t, N>(xc,
addr,
mem, flags);
153 panic(
"Unhandled element size in readMemAtomic\n");
155 if (fault ==
NoFault && traceData)
160 template <
typename T,
size_t N>
163 unsigned flags, uint64_t *res)
165 std::array<T, N> real_mem;
166 for (
int i = 0;
i < N;
i++)
167 real_mem[
i] =
mem[
i];
168 real_mem =
htole(real_mem);
169 return xc->
writeMem((uint8_t *)&real_mem,
sizeof(T) * N,
187 std::array<uint64_t, N> &
mem,
unsigned dataSize,
188 Addr addr,
unsigned flags, uint64_t *res)
195 return writePackedMem<uint32_t, N>(xc,
mem,
addr, flags, res);
197 return writePackedMem<uint64_t, N>(xc,
mem,
addr, flags, res);
199 panic(
"Unhandled element size in writeMemTiming.\n");
212 xc->
writeMem((uint8_t *)&host_mem, dataSize,
addr, flags, res);
221 std::array<uint64_t, N> &
mem,
unsigned dataSize,
222 Addr addr,
unsigned flags, uint64_t *res)
230 fault = writePackedMem<uint32_t, N>(xc,
mem,
addr, flags, res);
233 fault = writePackedMem<uint64_t, N>(xc,
mem,
addr, flags, res);
236 panic(
"Unhandled element size in writeMemAtomic.\n");
virtual Fault initiateMemRead(Addr addr, unsigned int size, Request::Flags flags, const std::vector< bool > &byte_enable=std::vector< bool >())
Initiate a timing memory read operation.
static Fault writeMemAtomic(ExecContext *xc, Trace::InstRecord *traceData, uint64_t mem, unsigned dataSize, Addr addr, Request::Flags flags, uint64_t *res)
virtual Fault writeMem(uint8_t *data, unsigned int size, Addr addr, Request::Flags flags, uint64_t *res, const std::vector< bool > &byte_enable=std::vector< bool >())=0
For atomic-mode contexts, perform an atomic memory write operation.
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.
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 readMem(Addr addr, uint8_t *data, unsigned int size, Request::Flags flags, const std::vector< bool > &byte_enable=std::vector< bool >())
Perform an atomic memory read operation.
#define panic(...)
This implements a cprintf based panic() function.
Generated on Wed Sep 30 2020 14:02:07 for gem5 by doxygen 1.8.17