From d658b6e1cc22de852fef611e28f448257acc298a Mon Sep 17 00:00:00 2001 From: Tony Gutierrez Date: Tue, 19 Jan 2016 13:57:50 -0500 Subject: * * * mem: support for gpu-style RMWs in ruby This patch adds support for GPU-style read-modify-write (RMW) operations in ruby. Such atomic operations are traditionally executed at the memory controller (instead of through an L1 cache using cache-line locking). Currently, this patch works by propogating operation functors through the memory system. --- src/base/types.hh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/base') diff --git a/src/base/types.hh b/src/base/types.hh index bc5c715ce..7b115901a 100644 --- a/src/base/types.hh +++ b/src/base/types.hh @@ -200,6 +200,19 @@ typedef std::shared_ptr Fault; constexpr decltype(nullptr) NoFault = nullptr; #endif +struct AtomicOpFunctor +{ + virtual void operator()(uint8_t *p) = 0; + virtual ~AtomicOpFunctor() {} +}; + +template +struct TypedAtomicOpFunctor : public AtomicOpFunctor +{ + void operator()(uint8_t *p) { execute((T *)p); } + virtual void execute(T * p) = 0; +}; + enum ByteOrder { BigEndianByteOrder, LittleEndianByteOrder -- cgit v1.2.3