summaryrefslogtreecommitdiff
path: root/include/mimalloc-internal.h
diff options
context:
space:
mode:
authorUwe L. Korn <uwe.korn@quantco.com>2020-12-30 21:36:41 +0100
committerUwe L. Korn <uwe.korn@quantco.com>2020-12-30 21:49:41 +0100
commitab3dac04c2478a484b0e063b04fd0f19cc0f368d (patch)
tree8d20e4d38e0d12fb80b6f420b16875844b131225 /include/mimalloc-internal.h
parent2ab0bb35361deed12a355fc36004764b2f286286 (diff)
Use tpidrro_el0 for thread local storage in macOS-arm64
Fixes #343
Diffstat (limited to 'include/mimalloc-internal.h')
-rw-r--r--include/mimalloc-internal.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/mimalloc-internal.h b/include/mimalloc-internal.h
index e3e78e4..df700d3 100644
--- a/include/mimalloc-internal.h
+++ b/include/mimalloc-internal.h
@@ -707,7 +707,11 @@ static inline void* mi_tls_slot(size_t slot) mi_attr_noexcept {
res = tcb[slot];
#elif defined(__aarch64__)
void** tcb; UNUSED(ofs);
+#if defined(__MACH__)
+ __asm__ volatile ("mrs %0, tpidrro_el0" : "=r" (tcb));
+#else
__asm__ volatile ("mrs %0, tpidr_el0" : "=r" (tcb));
+#endif
res = tcb[slot];
#endif
return res;
@@ -730,7 +734,11 @@ static inline void mi_tls_slot_set(size_t slot, void* value) mi_attr_noexcept {
tcb[slot] = value;
#elif defined(__aarch64__)
void** tcb; UNUSED(ofs);
+#if defined(__MACH__)
+ __asm__ volatile ("mrs %0, tpidrro_el0" : "=r" (tcb));
+#else
__asm__ volatile ("mrs %0, tpidr_el0" : "=r" (tcb));
+#endif
tcb[slot] = value;
#endif
}