Go to the documentation of this file.
41 #ifndef __ARCH_GENERIC_MEMHELPERS_HH__
42 #define __ARCH_GENERIC_MEMHELPERS_HH__
53 template <
class XC,
class MemT>
58 return xc->initiateMemRead(
addr,
sizeof(MemT), flags);
62 template <ByteOrder Order,
class MemT>
66 mem = pkt->
get<MemT>(Order);
75 getMem<ByteOrder::little>(pkt,
mem, traceData);
82 getMem<ByteOrder::big>(pkt,
mem, traceData);
86 template <ByteOrder Order,
class XC,
class MemT>
91 memset(&
mem, 0,
sizeof(
mem));
92 Fault fault = xc->readMem(
addr, (uint8_t *)&
mem,
sizeof(MemT), flags);
101 template <
class XC,
class MemT>
106 return readMemAtomic<ByteOrder::little>(
107 xc, traceData,
addr,
mem, flags);
110 template <
class XC,
class MemT>
115 return readMemAtomic<ByteOrder::big>(xc, traceData,
addr,
mem, flags);
119 template <ByteOrder Order,
class XC,
class MemT>
128 return xc->writeMem((uint8_t *)&
mem,
sizeof(MemT),
addr, flags, res);
131 template <
class XC,
class MemT>
136 return writeMemTiming<ByteOrder::little>(
137 xc, traceData,
mem,
addr, flags, res);
140 template <
class XC,
class MemT>
145 return writeMemTiming<ByteOrder::big>(
146 xc, traceData,
mem,
addr, flags, res);
150 template <ByteOrder Order,
class XC,
class MemT>
158 MemT host_mem =
htog(
mem, Order);
160 xc->writeMem((uint8_t *)&host_mem,
sizeof(MemT),
addr, flags, res);
161 if (fault ==
NoFault && res != NULL) {
163 *(MemT *)res =
gtoh(*(MemT *)res, Order);
165 *res =
gtoh(*res, Order);
170 template <
class XC,
class MemT>
175 return writeMemAtomic<ByteOrder::little>(
176 xc, traceData,
mem,
addr, flags, res);
179 template <
class XC,
class MemT>
184 return writeMemAtomic<ByteOrder::big>(
185 xc, traceData,
mem,
addr, flags, res);
189 template <ByteOrder Order,
class XC,
class MemT>
197 memset(&
mem, 0,
sizeof(
mem));
200 Fault fault = xc->amoMem(
addr, (uint8_t *)&
mem,
sizeof(MemT), flags,
211 template <
class XC,
class MemT>
216 return amoMemAtomic<ByteOrder::little>(
217 xc, traceData,
mem,
addr, flags, _amo_op);
220 template <
class XC,
class MemT>
225 return amoMemAtomic<ByteOrder::big>(
226 xc, traceData,
mem,
addr, flags, _amo_op);
230 template <
class XC,
class MemT>
237 return xc->initiateMemAMO(
addr,
sizeof(MemT), flags, std::move(amo_op));
void getMem(PacketPtr pkt, MemT &mem, Trace::InstRecord *traceData)
Extract the data returned from a timing mode read.
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
Fault writeMemAtomicBE(XC *xc, Trace::InstRecord *traceData, const MemT &mem, Addr addr, Request::Flags flags, uint64_t *res)
Fault initiateMemRead(XC *xc, Trace::InstRecord *traceData, Addr addr, MemT &mem, Request::Flags flags)
Initiate a read from memory in timing mode.
Fault amoMemAtomicLE(XC *xc, Trace::InstRecord *traceData, MemT &mem, Addr addr, Request::Flags flags, AtomicOpFunctor *_amo_op)
std::shared_ptr< FaultBase > Fault
T htog(T value, ByteOrder guest_byte_order)
Fault writeMemAtomic(XC *xc, Trace::InstRecord *traceData, const MemT &mem, Addr addr, Request::Flags flags, uint64_t *res)
Write to memory in atomic mode.
Fault amoMemAtomicBE(XC *xc, Trace::InstRecord *traceData, MemT &mem, Addr addr, Request::Flags flags, AtomicOpFunctor *_amo_op)
Fault initiateMemAMO(XC *xc, Trace::InstRecord *traceData, Addr addr, MemT &mem, Request::Flags flags, AtomicOpFunctor *_amo_op)
Do atomic read-modify-wrote (AMO) in timing mode.
@ MEM_SWAP
This request is for a memory swap.
Fault writeMemTimingLE(XC *xc, Trace::InstRecord *traceData, MemT mem, Addr addr, Request::Flags flags, uint64_t *res)
void setData(std::array< T, N > d)
constexpr decltype(nullptr) NoFault
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Fault writeMemTiming(XC *xc, Trace::InstRecord *traceData, MemT mem, Addr addr, Request::Flags flags, uint64_t *res)
Write to memory in timing mode.
Fault readMemAtomicBE(XC *xc, Trace::InstRecord *traceData, Addr addr, MemT &mem, Request::Flags flags)
T get(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness.
void getMemLE(PacketPtr pkt, MemT &mem, Trace::InstRecord *traceData)
void getMemBE(PacketPtr pkt, MemT &mem, Trace::InstRecord *traceData)
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Fault writeMemTimingBE(XC *xc, Trace::InstRecord *traceData, MemT mem, Addr addr, Request::Flags flags, uint64_t *res)
T gtoh(T value, ByteOrder guest_byte_order)
Fault amoMemAtomic(XC *xc, Trace::InstRecord *traceData, MemT &mem, Addr addr, Request::Flags flags, AtomicOpFunctor *_amo_op)
Do atomic read-modify-write (AMO) in atomic mode.
Fault readMemAtomicLE(XC *xc, Trace::InstRecord *traceData, Addr addr, MemT &mem, Request::Flags flags)
Fault writeMemAtomicLE(XC *xc, Trace::InstRecord *traceData, const MemT &mem, Addr addr, Request::Flags flags, uint64_t *res)
Fault readMemAtomic(XC *xc, Trace::InstRecord *traceData, Addr addr, MemT &mem, Request::Flags flags)
Read from memory in atomic mode.
Generated on Wed Sep 30 2020 14:02:07 for gem5 by doxygen 1.8.17