2 * mini-arm-tls.S: tls getters and setters for arm platforms
4 * Copyright 2015 Xamarin, Inc.
9 #ifndef MONO_CROSS_COMPILE
12 * The following thunks fetch the value corresponding to the key/offset
13 * passed in R0. These thunks don't do jumps to external code so execution
14 * within can be tracked. The tls value is returned in R0.
17 .macro DECLARE_GLOBAL_SYMBOL name
28 /* no .arch on clang. it only supports armv6+ anyway */
35 DECLARE_GLOBAL_SYMBOL mono_fast_get_tls_key
36 #if defined(__linux__)
37 mrc p15, 0, r1, c13, c0, 3
38 #if defined(HAVE_KW_THREAD)
40 #elif defined(TARGET_ANDROID)
41 ldr r0, [r1, r0, lsl #2]
44 #elif defined(TARGET_IOS)
45 mrc p15, 0, r1, c13, c0, 3
47 ldr r0, [r1, r0, lsl #2]
50 DECLARE_GLOBAL_SYMBOL mono_fast_get_tls_key_end
53 * The following thunks fetch the value corresponding to the key/offset
54 * passed in R0. These thunks are used in the unlikely cases where we determine
55 * at runtime that the current implementation is not accounted for.
59 DECLARE_GLOBAL_SYMBOL mono_fallback_get_tls_key
60 #if defined(__linux__)
66 #if defined(HAVE_KW_THREAD)
68 #elif defined(TARGET_ANDROID)
69 ldr r0, [r0, r1, lsl #2]
72 #elif defined(TARGET_IOS)
74 bl _pthread_getspecific
79 * The following thunks set the value corresponding to the key/offset
80 * passed in R0. These thunks don't do jumps to external code so execution
81 * within can be tracked. The tls value is passed in R1.
85 DECLARE_GLOBAL_SYMBOL mono_fast_set_tls_key
86 #if defined(__linux__)
87 mrc p15, 0, r2, c13, c0, 3
88 #if defined(HAVE_KW_THREAD)
90 #elif defined(TARGET_ANDROID)
91 str r1, [r2, r0, lsl #2]
94 #elif defined(TARGET_IOS)
95 mrc p15, 0, r2, c13, c0, 3
97 str r1, [r2, r0, lsl #2]
100 DECLARE_GLOBAL_SYMBOL mono_fast_set_tls_key_end
103 * The following thunks set the value corresponding to the key/offset
104 * passed in R0. These thunks are used in the unlikely cases where we determine
105 * at runtime that the current implementation is not accounted for.
109 DECLARE_GLOBAL_SYMBOL mono_fallback_set_tls_key
110 #if defined(__linux__)
116 #if defined(HAVE_KW_THREAD)
118 #elif defined(TARGET_ANDROID)
119 str r1, [r0, r2, lsl #2]
122 #elif defined(TARGET_IOS)
124 bl _pthread_setspecific