ARC: add TLS support for ARCv3

For ARCv3 the register is fixed to r30, so we don't need to
configure it at compile-time.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
This commit is contained in:
Evgeniy Paltsev 2021-05-07 13:40:54 +03:00 committed by Kumar Gala
commit 93bf5f58e7
2 changed files with 12 additions and 4 deletions

View file

@ -12,8 +12,11 @@ zephyr_cc_option(-fno-delete-null-pointer-checks)
zephyr_cc_option_ifdef(CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS -munaligned-access)
if(CONFIG_ISA_ARCV2)
# Instruct compiler to use register R26 as thread pointer
# for thread local storage.
# For ARCv3 the register is fixed to r30, so we don't need to specify it
zephyr_cc_option_ifdef(CONFIG_THREAD_LOCAL_STORAGE -mtp-regno=26)
endif()
add_subdirectory(core)

View file

@ -122,8 +122,13 @@ static inline void arch_setup_callee_saved_regs(struct k_thread *thread,
ARG_UNUSED(regs);
#ifdef CONFIG_THREAD_LOCAL_STORAGE
/* R26 is used for thread pointer */
#ifdef CONFIG_ISA_ARCV2
/* R26 is used for thread pointer for ARCv2 */
regs->r26 = thread->tls;
#else
/* R30 is used for thread pointer for ARCv3 */
regs->r30 = thread->tls;
#endif /* CONFIG_ISA_ARCV2 */
#endif
}