File indexing completed on 2025-01-30 09:35:34
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_FIBER_DETAIL_RTM_H
0009 #define BOOST_FIBER_DETAIL_RTM_H
0010
0011 #include <cstdint>
0012
0013 #include <boost/assert.hpp>
0014 #include <boost/config.hpp>
0015
0016 #include <boost/fiber/detail/config.hpp>
0017
0018 #ifdef BOOST_HAS_ABI_HEADERS
0019 # include BOOST_ABI_PREFIX
0020 #endif
0021
0022 namespace boost {
0023 namespace fibers {
0024 namespace detail {
0025
0026 struct rtm_status {
0027 enum {
0028 none = 0,
0029 explicit_abort = 1 << 0,
0030 may_retry = 1 << 1,
0031 memory_conflict = 1 << 2,
0032 buffer_overflow = 1 << 3,
0033 debug_hit = 1 << 4,
0034 nested_abort = 1 << 5
0035 };
0036
0037 static constexpr std::uint32_t success = ~std::uint32_t{ 0 };
0038 };
0039
0040 static BOOST_FORCEINLINE
0041 std::uint32_t rtm_begin() noexcept {
0042 std::uint32_t result = rtm_status::success;
0043 __asm__ __volatile__
0044 (
0045 ".byte 0xc7,0xf8 ; .long 0"
0046 : "+a" (result)
0047 :
0048 : "memory"
0049 );
0050 return result;
0051 }
0052
0053 static BOOST_FORCEINLINE
0054 void rtm_end() noexcept {
0055 __asm__ __volatile__
0056 (
0057 ".byte 0x0f,0x01,0xd5"
0058 :
0059 :
0060 : "memory"
0061 );
0062 }
0063
0064 static BOOST_FORCEINLINE
0065 void rtm_abort_lock_not_free() noexcept {
0066 __asm__ __volatile__
0067 (
0068 ".byte 0xc6,0xf8,0xff"
0069 :
0070 :
0071 : "memory"
0072 );
0073 }
0074
0075 static BOOST_FORCEINLINE
0076 bool rtm_test() noexcept {
0077 bool result;
0078 __asm__ __volatile__
0079 (
0080 ".byte 0x0f,0x01,0xd6; setz %0"
0081 : "=q" (result)
0082 :
0083 : "memory"
0084 );
0085 return result;
0086 }
0087
0088 }}}
0089
0090 #ifdef BOOST_HAS_ABI_HEADERS
0091 # include BOOST_ABI_SUFFIX
0092 #endif
0093
0094 #endif