Deleted Added
sdiff udiff text old ( 13234:dea0fbed3f19 ) new ( 14297:b4519e586f5e )
full compact
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

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

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 AtomicOpFunctorPtr amo_op = AtomicOpFunctorPtr(_amo_op);
136 Fault fault = xc->amoMem(addr, (uint8_t *)&mem, sizeof(MemT), flags,
137 std::move(amo_op));
138
139 if (fault == NoFault) {
140 mem = TheISA::gtoh(mem);
141 if (traceData)
142 traceData->setData(mem);
143 }
144 return fault;
145}
146
147/// Do atomic read-modify-wrote (AMO) in timing mode
148template <class XC, class MemT>
149Fault
150initiateMemAMO(XC *xc, Trace::InstRecord *traceData, Addr addr, MemT& mem,
151 Request::Flags flags, AtomicOpFunctor *_amo_op)
152{
153 assert(_amo_op);
154 AtomicOpFunctorPtr amo_op = AtomicOpFunctorPtr(_amo_op);
155 return xc->initiateMemAMO(addr, sizeof(MemT), flags, std::move(amo_op));
156}
157
158#endif