30#ifndef __ARCH_X86_MEMHELPERS_HH__
31#define __ARCH_X86_MEMHELPERS_HH__
73 panic(
"Unhandled size in getMem.\n");
79template <
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++)
101 panic(
"Unhandled element size in getMem.\n");
112 memset(&
mem, 0,
sizeof(
mem));
127template <
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,
162 panic(
"Unhandled element size in readMemAtomic\n");
164 if (fault ==
NoFault && traceData)
169template <
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,
213 panic(
"Unhandled element size in writeMemTiming.\n");
227 flags, res, byte_enable);
236 std::array<uint64_t, N> &
mem,
unsigned dataSize,
251 panic(
"Unhandled element size in writeMemAtomic.\n");
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
virtual Fault initiateMemRead(Addr addr, unsigned int size, Request::Flags flags, const std::vector< bool > &byte_enable)
Initiate a timing memory read operation.
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.
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....
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
void setData(std::array< T, N > d)
#define panic(...)
This implements a cprintf based panic() function.
static void getMem(PacketPtr pkt, uint64_t &mem, unsigned dataSize, trace::InstRecord *traceData)
static Fault writePackedMem(ExecContext *xc, std::array< uint64_t, N > &mem, Addr addr, unsigned flags, uint64_t *res)
static Fault writeMemAtomic(ExecContext *xc, trace::InstRecord *traceData, uint64_t mem, unsigned dataSize, Addr addr, Request::Flags flags, uint64_t *res)
static Fault readPackedMemAtomic(ExecContext *xc, Addr addr, std::array< uint64_t, N > &mem, unsigned flags)
static void getPackedMem(PacketPtr pkt, std::array< uint64_t, N > &mem, unsigned dataSize)
static Fault readMemAtomic(ExecContext *xc, trace::InstRecord *traceData, Addr addr, uint64_t &mem, unsigned dataSize, Request::Flags flags)
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)
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::shared_ptr< FaultBase > Fault
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
constexpr decltype(nullptr) NoFault