Skip to content

Commit

Permalink
Merge pull request #346 from xhochy/issue-343
Browse files Browse the repository at this point in the history
Use tpidrro_el0 for thread local storage in macOS-arm64
  • Loading branch information
daanx committed Jan 29, 2021
2 parents 2ab0bb3 + a753084 commit da2cf36
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/mimalloc-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(__APPLE__)
__asm__ volatile ("mrs %0, tpidrro_el0" : "=r" (tcb));
#else
__asm__ volatile ("mrs %0, tpidr_el0" : "=r" (tcb));
#endif
res = tcb[slot];
#endif
return res;
Expand All @@ -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(__APPLE__)
__asm__ volatile ("mrs %0, tpidrro_el0" : "=r" (tcb));
#else
__asm__ volatile ("mrs %0, tpidr_el0" : "=r" (tcb));
#endif
tcb[slot] = value;
#endif
}
Expand Down

0 comments on commit da2cf36

Please sign in to comment.