Skip to content

Commit 3e6dd56

Browse files
ithinuelkartben
authored andcommitted
arch: arm: cortex_m: make reading tls pointer faster on v7m and v8m.main
Encoding T3 allows for an offset of up to 12bits in size allowing for a single instruction instead of 3. Signed-off-by: Wilfried Chauveau <[email protected]>
1 parent 1ad33e2 commit 3e6dd56

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/arm/core/cortex_m/swap_helper.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,13 @@ SECTION_FUNC(TEXT, z_arm_pendsv)
159159

160160
#if defined(CONFIG_THREAD_LOCAL_STORAGE)
161161
/* Grab the TLS pointer */
162+
#if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE)
162163
ldr r4, =_thread_offset_to_tls
163164
adds r4, r2, r4
164165
ldr r0, [r4]
166+
#else
167+
ldr r0, [r2, #_thread_offset_to_tls]
168+
#endif
165169

166170
/* For Cortex-M, store TLS pointer in a global variable,
167171
* as it lacks the process ID or thread ID register

0 commit comments

Comments
 (0)