get_tp.s (565B)
1 /* tcc-build aarch64 thread-pointer reader. 2 * 3 * Reads tpidr_el0 into x0 and returns. Stock musl's pthread_arch.h 4 * uses `__asm__ ("mrs %0, tpidr_el0" : "=r"(tp))`; the inline-asm 5 * operand syntax is unsupported by tcc 0.9.26's arm64-asm.c (phase 3, 6 * not yet started). The mrs mnemonic itself is also outside phase 1+2, 7 * so emit raw bytes: 8 * 9 * d53bd040 mrs x0, tpidr_el0 (op0=3 op1=3 CRn=13 CRm=0 op2=2 Rt=0) 10 * d65f03c0 ret (encoded by phase-1 `ret`) 11 */ 12 13 .global __get_tp 14 .type __get_tp,@function 15 __get_tp: 16 .long 0xd53bd040 17 ret