Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:33:57

0001 /*
0002  * Distributed under the Boost Software License, Version 1.0.
0003  * (See accompanying file LICENSE_1_0.txt or copy at
0004  * http://www.boost.org/LICENSE_1_0.txt)
0005  *
0006  * Copyright (c) 2009, 2011 Helge Bahmann
0007  * Copyright (c) 2009 Phil Endecott
0008  * Copyright (c) 2013 Tim Blechmann
0009  * Linux-specific code by Phil Endecott
0010  * Copyright (c) 2014 Andrey Semashev
0011  */
0012 /*!
0013  * \file   atomic/detail/fence_ops_linux_arm.hpp
0014  *
0015  * This header contains implementation of the \c fence_operations struct.
0016  */
0017 
0018 #ifndef BOOST_ATOMIC_DETAIL_FENCE_OPS_LINUX_ARM_HPP_INCLUDED_
0019 #define BOOST_ATOMIC_DETAIL_FENCE_OPS_LINUX_ARM_HPP_INCLUDED_
0020 
0021 #include <boost/memory_order.hpp>
0022 #include <boost/atomic/detail/config.hpp>
0023 #include <boost/atomic/detail/header.hpp>
0024 
0025 #ifdef BOOST_HAS_PRAGMA_ONCE
0026 #pragma once
0027 #endif
0028 
0029 namespace boost {
0030 namespace atomics {
0031 namespace detail {
0032 
0033 //! Fence operations based on Linux-specific system routines
0034 struct fence_operations_linux_arm
0035 {
0036     static BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
0037     {
0038         if (order != memory_order_relaxed)
0039             hardware_full_fence();
0040     }
0041 
0042     static BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
0043     {
0044         if (order != memory_order_relaxed)
0045             __asm__ __volatile__ ("" ::: "memory");
0046     }
0047 
0048     static BOOST_FORCEINLINE void hardware_full_fence() BOOST_NOEXCEPT
0049     {
0050         // See the comment in core_ops_linux_arm.hpp regarding the function pointer below
0051         typedef void (*kernel_dmb_t)(void);
0052         ((kernel_dmb_t)0xffff0fa0)();
0053     }
0054 };
0055 
0056 typedef fence_operations_linux_arm fence_operations;
0057 
0058 } // namespace detail
0059 } // namespace atomics
0060 } // namespace boost
0061 
0062 #include <boost/atomic/detail/footer.hpp>
0063 
0064 #endif // BOOST_ATOMIC_DETAIL_FENCE_OPS_LINUX_ARM_HPP_INCLUDED_