arch: arm: cortex_m: Document why __aeabi_read_tp impl requires ASM impl

This method has special ABI requirement that requires the use of ASM.
This change documents why this is required & adds reference to the
related specification.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
This commit is contained in:
Wilfried Chauveau 2023-10-07 16:08:36 +01:00 committed by Carles Cufí
parent a2ed8162c8
commit 4c3f6ea5b2

View file

@ -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