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.
18 /* no .arch on clang. it only supports armv6+ anyway */
25 .global _mono_fast_get_tls_key
26 _mono_fast_get_tls_key :
28 .global mono_fast_get_tls_key
29 mono_fast_get_tls_key :
31 #if defined(__linux__)
32 mrc p15, 0, r1, c13, c0, 3
33 #if defined(HAVE_KW_THREAD)
35 #elif defined(TARGET_ANDROID)
36 ldr r0, [r1, r0, lsl #2]
39 #elif defined(TARGET_IOS)
40 mrc p15, 0, r1, c13, c0, 3
42 ldr r0, [r1, r0, lsl #2]
47 * The following thunks fetch the value corresponding to the key/offset
48 * passed in R0. These thunks are used in the unlikely cases where we determine
49 * at runtime that the current implementation is not accounted for.
54 .global _mono_fallback_get_tls_key
55 _mono_fallback_get_tls_key :
57 .global mono_fallback_get_tls_key
58 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.
86 .global _mono_fast_set_tls_key
87 _mono_fast_set_tls_key :
89 .global mono_fast_set_tls_key
90 mono_fast_set_tls_key :
92 #if defined(__linux__)
93 mrc p15, 0, r2, c13, c0, 3
94 #if defined(HAVE_KW_THREAD)
96 #elif defined(TARGET_ANDROID)
97 str r1, [r2, r0, lsl #2]
100 #elif defined(TARGET_IOS)
101 mrc p15, 0, r2, c13, c0, 3
103 str r1, [r2, r0, lsl #2]
108 * The following thunks set the value corresponding to the key/offset
109 * passed in R0. These thunks are used in the unlikely cases where we determine
110 * at runtime that the current implementation is not accounted for.
115 .global _mono_fallback_set_tls_key
116 _mono_fallback_set_tls_key :
118 .global mono_fallback_set_tls_key
119 mono_fallback_set_tls_key :
121 #if defined(__linux__)
127 #if defined(HAVE_KW_THREAD)
129 #elif defined(TARGET_ANDROID)
130 str r1, [r0, r2, lsl #2]
133 #elif defined(TARGET_IOS)
135 bl _pthread_setspecific