diff --git a/arch/arm/core/cortex_m/__aeabi_read_tp.S b/arch/arm/core/cortex_m/__aeabi_read_tp.S index 8aeba3e5d12..745fda73b9b 100644 --- a/arch/arm/core/cortex_m/__aeabi_read_tp.S +++ b/arch/arm/core/cortex_m/__aeabi_read_tp.S @@ -12,8 +12,14 @@ GTEXT(__aeabi_read_tp) GDATA(z_arm_tls_ptr) +/* Grab the TLS pointer and store in R0. + * According to the Run-Time ABI for the ArmĀ® Architecture section 5.3.5, this + * function may only clobber r0, ip, lr & CPSR. + * + * This can only be guaranteed by either implementing a naked C function with + * inline assembly, or plain assembly. + */ SECTION_FUNC(TEXT, __aeabi_read_tp) - /* Grab the TLS pointer and store in R0 */ ldr r0, =z_arm_tls_ptr ldr r0, [r0] bx lr