2 // detail/gcc_arm_fenced_block.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_ASIO_DETAIL_GCC_ARM_FENCED_BLOCK_HPP
12 #define BOOST_ASIO_DETAIL_GCC_ARM_FENCED_BLOCK_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
20 #if defined(__GNUC__) && defined(__arm__)
22 #include <boost/asio/detail/push_options.hpp>
28 class gcc_arm_fenced_block
35 // Constructor for a half fenced block.
36 explicit gcc_arm_fenced_block(half_t)
40 // Constructor for a full fenced block.
41 explicit gcc_arm_fenced_block(full_t)
47 ~gcc_arm_fenced_block()
55 #if defined(__ARM_ARCH_4__) \
56 || defined(__ARM_ARCH_4T__) \
57 || defined(__ARM_ARCH_5__) \
58 || defined(__ARM_ARCH_5E__) \
59 || defined(__ARM_ARCH_5T__) \
60 || defined(__ARM_ARCH_5TE__) \
61 || defined(__ARM_ARCH_5TEJ__) \
62 || defined(__ARM_ARCH_6__) \
63 || defined(__ARM_ARCH_6J__) \
64 || defined(__ARM_ARCH_6K__) \
65 || defined(__ARM_ARCH_6Z__) \
66 || defined(__ARM_ARCH_6ZK__) \
67 || defined(__ARM_ARCH_6T2__)
68 # if defined(__thumb__)
69 // This is just a placeholder and almost certainly not sufficient.
70 __asm__ __volatile__ ("" : : : "memory");
71 # else // defined(__thumb__)
73 __asm__ __volatile__ ("swp %0, %1, [%2]"
74 : "=&r"(a) : "r"(1), "r"(&b) : "memory", "cc");
75 # endif // defined(__thumb__)
78 __asm__ __volatile__ ("dmb" : : : "memory");
87 #include <boost/asio/detail/pop_options.hpp>
89 #endif // defined(__GNUC__) && defined(__arm__)
91 #endif // BOOST_ASIO_DETAIL_GCC_ARM_FENCED_BLOCK_HPP