1 /* 2 * Distributed under the Boost Software License, Version 1.0. 3 * (See accompanying file LICENSE_1_0.txt or copy at 4 * http://www.boost.org/LICENSE_1_0.txt) 5 * 6 * Copyright (c) 2009, 2011 Helge Bahmann 7 * Copyright (c) 2009 Phil Endecott 8 * Copyright (c) 2013 Tim Blechmann 9 * Linux-specific code by Phil Endecott 10 * Copyright (c) 2014 Andrey Semashev 11 */ 12 /*! 13 * \file atomic/detail/fence_ops_linux_arm.hpp 14 * 15 * This header contains implementation of the \c fence_operations struct. 16 */ 17 18 #ifndef BOOST_ATOMIC_DETAIL_FENCE_OPS_LINUX_ARM_HPP_INCLUDED_ 19 #define BOOST_ATOMIC_DETAIL_FENCE_OPS_LINUX_ARM_HPP_INCLUDED_ 20 21 #include <boost/memory_order.hpp> 22 #include <boost/atomic/detail/config.hpp> 23 #include <boost/atomic/detail/header.hpp> 24 25 #ifdef BOOST_HAS_PRAGMA_ONCE 26 #pragma once 27 #endif 28 29 namespace boost { 30 namespace atomics { 31 namespace detail { 32 33 //! Fence operations based on Linux-specific system routines 34 struct fence_operations_linux_arm 35 { thread_fenceboost::atomics::detail::fence_operations_linux_arm36 static BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT 37 { 38 if (order != memory_order_relaxed) 39 hardware_full_fence(); 40 } 41 signal_fenceboost::atomics::detail::fence_operations_linux_arm42 static BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT 43 { 44 if (order != memory_order_relaxed) 45 __asm__ __volatile__ ("" ::: "memory"); 46 } 47 hardware_full_fenceboost::atomics::detail::fence_operations_linux_arm48 static BOOST_FORCEINLINE void hardware_full_fence() BOOST_NOEXCEPT 49 { 50 // See the comment in core_ops_linux_arm.hpp regarding the function pointer below 51 typedef void (*kernel_dmb_t)(void); 52 ((kernel_dmb_t)0xffff0fa0)(); 53 } 54 }; 55 56 typedef fence_operations_linux_arm fence_operations; 57 58 } // namespace detail 59 } // namespace atomics 60 } // namespace boost 61 62 #include <boost/atomic/detail/footer.hpp> 63 64 #endif // BOOST_ATOMIC_DETAIL_FENCE_OPS_LINUX_ARM_HPP_INCLUDED_ 65