fix up_tls_info define for BUILD_KERNEL

Summary:
- In case of BUILD_KERNEL, NuttX uses USR mode sp and SVC mode sp.
- The kernel runs on SVC mode sp.
- While the kernel is running, up_getsp() cannot get the TLS address.
- The kernel requires tls_get_info() function.
- For the user land, up_getsp() can be used.
- tls_getinfo.c is always compiled and tls_get_info() function is
  filtered by macros in the tls_getinfo.c.

Impact:
BUILD_KERNEL

Testing:
test program on custom Cortex-A9 board (BUILD_KERNEL)
ostest on sabre-6quad:smp (QEMU, BUILD_FLAT)

Signed-off-by: Oki Minabe <minabe.oki@gmail.com>
This commit is contained in:
Oki Minabe
2022-02-27 17:24:50 +09:00
committed by Xiang Xiao
parent 44bd3212d4
commit fbf05db906
4 changed files with 6 additions and 10 deletions
+1 -1
View File
@@ -1780,7 +1780,7 @@ int up_timer_start(FAR const struct timespec *ts);
*/
#ifndef up_tls_info
# ifdef CONFIG_TLS_ALIGNED
# if defined(CONFIG_TLS_ALIGNED) && !defined(__KERNEL__)
# define up_tls_info() TLS_INFO((uintptr_t)up_getsp())
# else
# define up_tls_info() tls_get_info()
+1 -1
View File
@@ -378,7 +378,7 @@ uintptr_t task_tls_get_value(int tlsindex);
*
****************************************************************************/
#ifndef CONFIG_TLS_ALIGNED
#if !defined(CONFIG_TLS_ALIGNED) || defined(__KERNEL__)
FAR struct tls_info_s *tls_get_info(void);
#endif