32 #ifndef __ARCH_X86_MEMHELPERS_HH__
33 #define __ARCH_X86_MEMHELPERS_HH__
50 return xc->initiateMemRead(addr, dataSize, flags);
59 mem = pkt->
get<uint8_t>();
62 mem = pkt->
get<uint16_t>();
65 mem = pkt->
get<uint32_t>();
68 mem = pkt->
get<uint64_t>();
71 panic(
"Unhandled size in getMem.\n");
83 assert(dataSize >= 8);
84 assert((dataSize % 8) == 0);
86 int num_words = dataSize / 8;
87 assert(num_words <= N);
90 for (
int i = 0;
i < num_words; ++
i)
91 mem[
i] =
gtoh(pkt_data[
i]);
105 memset(&mem, 0,
sizeof(mem));
106 Fault fault = xc->readMem(addr, (uint8_t *)&mem, dataSize, flags);
118 template <
class XC,
size_t N>
121 std::array<uint64_t, N> &mem,
unsigned dataSize,
124 assert(dataSize >= 8);
125 assert((dataSize % 8) == 0);
127 Fault fault = xc->readMem(addr, (uint8_t *)&mem, dataSize, flags);
130 int num_words = dataSize / 8;
131 assert(num_words <= N);
133 for (
int i = 0;
i < num_words; ++
i)
152 return xc->writeMem((uint8_t *)&mem, dataSize, addr, flags, res);
155 template <
class XC,
size_t N>
158 std::array<uint64_t, N> &mem,
unsigned dataSize,
159 Addr addr,
unsigned flags, uint64_t *res)
161 assert(dataSize >= 8);
162 assert((dataSize % 8) == 0);
168 int num_words = dataSize / 8;
169 assert(num_words <= N);
171 for (
int i = 0;
i < num_words; ++
i)
174 return xc->writeMem((uint8_t *)&mem, dataSize, addr, flags, res);
188 xc->writeMem((uint8_t *)&host_mem, dataSize, addr, flags, res);
189 if (fault ==
NoFault && res != NULL) {
195 template <
class XC,
size_t N>
198 std::array<uint64_t, N> &mem,
unsigned dataSize,
199 Addr addr,
unsigned flags, uint64_t *res)
205 int num_words = dataSize / 8;
206 assert(num_words <= N);
208 for (
int i = 0;
i < num_words; ++
i)
211 Fault fault = xc->writeMem((uint8_t *)&mem, dataSize, addr, flags, res);
213 if (fault ==
NoFault && res != NULL) {
decltype(nullptr) constexpr NoFault
Fault readMemAtomic(XC *xc, Trace::InstRecord *traceData, Addr addr, uint64_t &mem, unsigned dataSize, Request::Flags flags)
T get(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness.
Fault writeMemTiming(XC *xc, Trace::InstRecord *traceData, uint64_t mem, unsigned dataSize, Addr addr, Request::Flags flags, uint64_t *res)
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
static void getMem(PacketPtr pkt, uint64_t &mem, unsigned dataSize, Trace::InstRecord *traceData)
const T * getConstPtr() const
Fault writeMemAtomic(XC *xc, Trace::InstRecord *traceData, uint64_t mem, unsigned dataSize, Addr addr, Request::Flags flags, uint64_t *res)
std::shared_ptr< FaultBase > Fault
Fault initiateMemRead(XC *xc, Trace::InstRecord *traceData, Addr addr, unsigned dataSize, Request::Flags flags)
Initiate a read from memory in timing mode.