mirror of https://github.com/python/cpython
gh-112535: Update _Py_ThreadId() to support PowerPC (gh-112624)
This commit is contained in:
parent
81ee026091
commit
d824512059
|
@ -261,6 +261,22 @@ _Py_ThreadId(void)
|
|||
__asm__ ("mrs %0, tpidrro_el0" : "=r" (tid));
|
||||
#elif defined(__aarch64__)
|
||||
__asm__ ("mrs %0, tpidr_el0" : "=r" (tid));
|
||||
#elif defined(__powerpc64__)
|
||||
#if defined(__clang__) && _Py__has_builtin(__builtin_thread_pointer)
|
||||
tid = (uintptr_t)__builtin_thread_pointer();
|
||||
#else
|
||||
register uintptr_t tp __asm__ ("r13");
|
||||
__asm__("" : "=r" (tp));
|
||||
tid = tp;
|
||||
#endif
|
||||
#elif defined(__powerpc__)
|
||||
#if defined(__clang__) && _Py__has_builtin(__builtin_thread_pointer)
|
||||
tid = (uintptr_t)__builtin_thread_pointer();
|
||||
#else
|
||||
register uintptr_t tp __asm__ ("r2");
|
||||
__asm__ ("" : "=r" (tp));
|
||||
tid = tp;
|
||||
#endif
|
||||
#else
|
||||
# error "define _Py_ThreadId for this platform"
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue