memhelpers.hh (12386:2bf5fb25a5f1) memhelpers.hh (12767:f3a612b8c10d)
1/*
2 * Copyright (c) 2013 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 107 unchanged lines hidden (view full) ---

116 if (flags & Request::MEM_SWAP || flags & Request::MEM_SWAP_COND)
117 *(MemT *)res = TheISA::gtoh(*(MemT *)res);
118 else
119 *res = TheISA::gtoh(*res);
120 }
121 return fault;
122}
123
1/*
2 * Copyright (c) 2013 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 107 unchanged lines hidden (view full) ---

116 if (flags & Request::MEM_SWAP || flags & Request::MEM_SWAP_COND)
117 *(MemT *)res = TheISA::gtoh(*(MemT *)res);
118 else
119 *res = TheISA::gtoh(*res);
120 }
121 return fault;
122}
123
124/// Do atomic read-modify-write (AMO) in atomic mode
125template <class XC, class MemT>
126Fault
127amoMemAtomic(XC *xc, Trace::InstRecord *traceData, MemT &mem, Addr addr,
128 Request::Flags flags, AtomicOpFunctor *amo_op)
129{
130 assert(amo_op);
131
132 // mem will hold the previous value at addr after the AMO completes
133 memset(&mem, 0, sizeof(mem));
134
135 Fault fault = xc->amoMem(addr, (uint8_t *)&mem, sizeof(MemT), flags,
136 amo_op);
137
138 if (fault == NoFault) {
139 mem = TheISA::gtoh(mem);
140 if (traceData)
141 traceData->setData(mem);
142 }
143 return fault;
144}
145
146/// Do atomic read-modify-wrote (AMO) in timing mode
147template <class XC, class MemT>
148Fault
149initiateMemAMO(XC *xc, Trace::InstRecord *traceData, Addr addr, MemT& mem,
150 Request::Flags flags, AtomicOpFunctor *amo_op)
151{
152 assert(amo_op);
153 return xc->initiateMemAMO(addr, sizeof(MemT), flags, amo_op);
154}
155
124#endif
156#endif