Skip to content

Commit

Permalink
arch/arm: Use TPIDRURO on cortex-a too
Browse files Browse the repository at this point in the history
V7-A also supports TPIDRURO, so go ahead and use that for TLS, enabling
thread local storage for the other ARM architectures.

Add __aeabi_read_tp function in case code was compiled to use that.

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Dec 20, 2021
1 parent f076540 commit 8e9000c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ config ARM
# FIXME: current state of the code for all ARM requires this, but
# is really only necessary for Cortex-M with ARM MPU!
select GEN_PRIV_STACKS
select ARCH_HAS_THREAD_LOCAL_STORAGE if CPU_CORTEX_R || CPU_CORTEX_M
select ARCH_HAS_THREAD_LOCAL_STORAGE
help
ARM architecture

Expand Down
1 change: 1 addition & 0 deletions arch/arm/core/aarch32/cortex_a_r/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ zephyr_library_sources(
)

zephyr_library_sources_ifdef(CONFIG_USERSPACE thread.c)
zephyr_library_sources_ifdef(CONFIG_THREAD_LOCAL_STORAGE __aeabi_read_tp.S)
17 changes: 17 additions & 0 deletions arch/arm/core/aarch32/cortex_a_r/__aeabi_read_tp.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright (c) 2020 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <toolchain.h>

_ASM_FILE_PROLOGUE

GTEXT(__aeabi_read_tp)

GDATA(z_arm_tls_ptr)

SECTION_FUNC(text, __aeabi_read_tp)
mrc 15, 0, r0, c13, c0, 3
bx lr
2 changes: 1 addition & 1 deletion arch/arm/core/aarch32/swap_helper.S
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ out_fp_endif:
adds r4, r2, r4
ldr r0, [r4]

#if defined(CONFIG_CPU_CORTEX_R)
#if defined(CONFIG_CPU_CORTEX_R) || defined(CONFIG_CPU_CORTEX_A)
/* Store TLS pointer in the "Process ID" register.
* This register is used as a base pointer to all
* thread variables with offsets added by toolchain.
Expand Down

0 comments on commit 8e9000c

Please sign in to comment.