2 * Copyright (c) 2013 Apple Inc. All rights reserved.
4 * @APPLE_APACHE_LICENSE_HEADER_START@
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * @APPLE_APACHE_LICENSE_HEADER_END@
21 #include "lock_internal.h"
23 #ifdef OS_VARIANT_SELECTOR
25 #if TARGET_OS_EMBEDDED
26 OS_VARIANT_UPMP_RESOLVER(OSAtomicAdd32Barrier
)
27 OS_VARIANT_UPMP_RESOLVER(OSAtomicIncrement32Barrier
)
28 OS_VARIANT_UPMP_RESOLVER(OSAtomicDecrement32Barrier
)
29 OS_VARIANT_UPMP_RESOLVER(OSAtomicAdd64Barrier
)
30 OS_VARIANT_UPMP_RESOLVER(OSAtomicIncrement64Barrier
)
31 OS_VARIANT_UPMP_RESOLVER(OSAtomicDecrement64Barrier
)
32 OS_VARIANT_UPMP_RESOLVER(OSAtomicAnd32Barrier
)
33 OS_VARIANT_UPMP_RESOLVER(OSAtomicAnd32OrigBarrier
)
34 OS_VARIANT_UPMP_RESOLVER(OSAtomicOr32Barrier
)
35 OS_VARIANT_UPMP_RESOLVER(OSAtomicOr32OrigBarrier
)
36 OS_VARIANT_UPMP_RESOLVER(OSAtomicXor32Barrier
)
37 OS_VARIANT_UPMP_RESOLVER(OSAtomicXor32OrigBarrier
)
38 OS_VARIANT_UPMP_RESOLVER(OSAtomicCompareAndSwap32Barrier
)
39 OS_VARIANT_UPMP_RESOLVER(OSAtomicCompareAndSwap64Barrier
)
40 OS_VARIANT_UPMP_RESOLVER(OSAtomicCompareAndSwapIntBarrier
)
41 OS_VARIANT_UPMP_RESOLVER(OSAtomicCompareAndSwapLongBarrier
)
42 OS_VARIANT_UPMP_RESOLVER(OSAtomicCompareAndSwapPtrBarrier
)
43 OS_VARIANT_UPMP_RESOLVER(OSAtomicTestAndSetBarrier
)
44 OS_VARIANT_UPMP_RESOLVER(OSAtomicTestAndClearBarrier
)
45 OS_VARIANT_UPMP_RESOLVER(OSAtomicEnqueue
)
46 OS_VARIANT_UPMP_RESOLVER(OSAtomicDequeue
)
47 OS_VARIANT_UPMP_RESOLVER(OSMemoryBarrier
)
49 OS_VARIANT_UPMP_RESOLVER(OSSpinLockLock
)
50 OS_VARIANT_UPMP_RESOLVER(OSSpinLockTry
)
51 OS_VARIANT_UPMP_RESOLVER(OSSpinLockUnlock
)
52 OS_VARIANT_UPMP_RESOLVER(spin_lock
)
53 OS_VARIANT_UPMP_RESOLVER(spin_lock_try
)
54 OS_VARIANT_UPMP_RESOLVER(spin_unlock
)
55 OS_VARIANT_UPMP_RESOLVER(_spin_lock
)
56 OS_VARIANT_UPMP_RESOLVER(_spin_lock_try
)
57 OS_VARIANT_UPMP_RESOLVER(_spin_unlock
)
59 OS_VARIANT_UPMP_RESOLVER(os_unfair_lock_lock
)
60 OS_VARIANT_UPMP_RESOLVER(os_unfair_lock_lock_with_options
)
61 OS_VARIANT_UPMP_RESOLVER(os_unfair_lock_trylock
)
62 OS_VARIANT_UPMP_RESOLVER(os_unfair_lock_unlock
)
63 OS_VARIANT_UPMP_RESOLVER(os_unfair_lock_lock_no_tsd_4libpthread
)
64 OS_VARIANT_UPMP_RESOLVER(os_unfair_lock_unlock_no_tsd_4libpthread
)
65 OS_VARIANT_UPMP_RESOLVER(os_unfair_lock_lock_with_options_4Libc
)
66 OS_VARIANT_UPMP_RESOLVER(os_unfair_lock_unlock_4Libc
)
67 OS_VARIANT_UPMP_RESOLVER(_os_nospin_lock_lock
)
68 OS_VARIANT_UPMP_RESOLVER(_os_nospin_lock_trylock
)
69 OS_VARIANT_UPMP_RESOLVER(_os_nospin_lock_unlock
)
71 OS_VARIANT_UPMP_RESOLVER_INTERNAL(_os_lock_spin_lock
)
72 OS_VARIANT_UPMP_RESOLVER_INTERNAL(_os_lock_spin_trylock
)
73 OS_VARIANT_UPMP_RESOLVER_INTERNAL(_os_lock_spin_unlock
)
74 OS_VARIANT_UPMP_RESOLVER_INTERNAL(_os_lock_handoff_lock
)
75 OS_VARIANT_UPMP_RESOLVER_INTERNAL(_os_lock_handoff_trylock
)
76 OS_VARIANT_UPMP_RESOLVER_INTERNAL(_os_lock_handoff_unlock
)
77 OS_VARIANT_UPMP_RESOLVER_INTERNAL(_os_lock_unfair_lock
)
78 OS_VARIANT_UPMP_RESOLVER_INTERNAL(_os_lock_unfair_trylock
)
79 OS_VARIANT_UPMP_RESOLVER_INTERNAL(_os_lock_unfair_unlock
)
80 OS_VARIANT_UPMP_RESOLVER_INTERNAL(_os_lock_nospin_lock
)
81 OS_VARIANT_UPMP_RESOLVER_INTERNAL(_os_lock_nospin_trylock
)
82 OS_VARIANT_UPMP_RESOLVER_INTERNAL(_os_lock_nospin_unlock
)
84 OS_VARIANT_UPMP_RESOLVER(_os_once
)
85 OS_VARIANT_UPMP_RESOLVER(__os_once_reset
)
86 #endif // TARGET_OS_EMBEDDED
88 #endif // OS_VARIANT_SELECTOR
90 #ifdef OS_LOCK_VARIANT_SELECTOR
92 #define WFE_RESOLVER(s) \
93 _OS_VARIANT_RESOLVER(s, hidden, \
94 uint32_t *_c = (void*)(uintptr_t)_COMM_PAGE_CPU_CAPABILITIES; \
95 if (*_c & kHasEvent) { \
96 extern void OS_VARIANT(s, wfe)(void); \
97 return &OS_VARIANT(s, wfe); \
99 extern void OS_VARIANT(s, mp)(void); \
100 return &OS_VARIANT(s, mp); \
103 WFE_RESOLVER(_OSSpinLockLockSlow
)
105 #endif // OS_LOCK_VARIANT_SELECTOR