gh-125444: Fix illegal instruction for older Arm architectures (#125574) · python/cpython@feda9aa · GitHub
Skip to content

Commit feda9aa

Browse files
authored
gh-125444: Fix illegal instruction for older Arm architectures (#125574)
On Arm v5 it is not possible to get the thread ID via c13 register hence the illegal instruction. The c13 register started to provide thread ID since Arm v6K architecture variant. Other variants of Arm v6 (T2, Z and base) don’t provide the thread ID via c13. For the sake of simplicity we group v5 and v6 together and consider that instructions for Arm v7 only.
1 parent 51410d8 commit feda9aa

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

Include/internal/mimalloc/mimalloc/prim.h

Lines changed: 2 additions & 2 deletions

Include/object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ _Py_ThreadId(void)
192192
__asm__("movq %%gs:0, %0" : "=r" (tid)); // x86_64 macOSX uses GS
193193
#elif defined(__x86_64__)
194194
__asm__("movq %%fs:0, %0" : "=r" (tid)); // x86_64 Linux, BSD uses FS
195-
#elif defined(__arm__)
195+
#elif defined(__arm__) && __ARM_ARCH >= 7
196196
__asm__ ("mrc p15, 0, %0, c13, c0, 3\nbic %0, %0, #3" : "=r" (tid));
197197
#elif defined(__aarch64__) && defined(__APPLE__)
198198
__asm__ ("mrs %0, tpidrro_el0" : "=r" (tid));
Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)