sched/tls: Wrap up_info_size into tls_info_size

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-06-05 19:17:33 +08:00 committed by Masayuki Ishikawa
parent 8543df7e4c
commit 11c8f3125d
12 changed files with 21 additions and 23 deletions

View file

@ -1838,8 +1838,6 @@ int up_timer_start(FAR const struct timespec *ts);
#ifdef CONFIG_SCHED_THREAD_LOCAL #ifdef CONFIG_SCHED_THREAD_LOCAL
int up_tls_size(void); int up_tls_size(void);
#else
#define up_tls_size() sizeof(struct tls_info_s)
#endif #endif
/**************************************************************************** /****************************************************************************

View file

@ -27,7 +27,6 @@
#include <stdint.h> #include <stdint.h>
#include <assert.h> #include <assert.h>
#include <nuttx/arch.h>
#include <nuttx/tls.h> #include <nuttx/tls.h>
#if !defined(up_tls_info) && (defined(__KERNEL__) || !defined(CONFIG_TLS_ALIGNED)) #if !defined(up_tls_info) && (defined(__KERNEL__) || !defined(CONFIG_TLS_ALIGNED))

View file

@ -23,11 +23,8 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#include <assert.h> #include <assert.h>
#include <nuttx/tls.h>
#include "unistd.h" #include "unistd.h"
/**************************************************************************** /****************************************************************************

View file

@ -33,7 +33,6 @@
#include <nuttx/fs/fs.h> #include <nuttx/fs/fs.h>
#include <nuttx/net/net.h> #include <nuttx/net/net.h>
#include <nuttx/lib/lib.h> #include <nuttx/lib/lib.h>
#include <nuttx/tls.h>
#ifdef CONFIG_BINFMT_LOADABLE #ifdef CONFIG_BINFMT_LOADABLE
# include <nuttx/binfmt/binfmt.h> # include <nuttx/binfmt/binfmt.h>

View file

@ -30,7 +30,6 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <nuttx/tls.h>
#include <nuttx/pthread.h> #include <nuttx/pthread.h>
#include "sched/sched.h" #include "sched/sched.h"

View file

@ -35,7 +35,6 @@
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/signal.h> #include <nuttx/signal.h>
#include <nuttx/tls.h>
#include "sched/sched.h" #include "sched/sched.h"
#include "task/task.h" #include "task/task.h"

View file

@ -33,9 +33,6 @@
#include <queue.h> #include <queue.h>
#include <debug.h> #include <debug.h>
#include <nuttx/sched.h>
#include <nuttx/tls.h>
#include "sched/sched.h" #include "sched/sched.h"
#include "environ/environ.h" #include "environ/environ.h"
#include "group/group.h" #include "group/group.h"

View file

@ -26,7 +26,6 @@
#include <nuttx/kmalloc.h> #include <nuttx/kmalloc.h>
#include <nuttx/semaphore.h> #include <nuttx/semaphore.h>
#include <nuttx/tls.h>
#include "tls.h" #include "tls.h"

View file

@ -24,7 +24,6 @@
#include <nuttx/kmalloc.h> #include <nuttx/kmalloc.h>
#include <nuttx/semaphore.h> #include <nuttx/semaphore.h>
#include <nuttx/tls.h>
#include "tls.h" #include "tls.h"

View file

@ -26,11 +26,29 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/sched.h> #include <nuttx/sched.h>
#include <nuttx/tls.h>
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: up_tls_size
*
* Description:
* Get TLS (sizeof(struct tls_info_s) + tdata + tbss) section size.
*
* Returned Value:
* Size of (sizeof(struct tls_info_s) + tdata + tbss).
*
****************************************************************************/
#ifdef CONFIG_SCHED_THREAD_LOCAL
# define tls_info_size() up_tls_size()
#else
# define tls_info_size() sizeof(struct tls_info_s)
#endif
/**************************************************************************** /****************************************************************************
* Name: task_init_info * Name: task_init_info
* *

View file

@ -26,9 +26,6 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <nuttx/arch.h>
#include <nuttx/tls.h>
#include "tls.h" #include "tls.h"
/**************************************************************************** /****************************************************************************
@ -56,7 +53,7 @@ int tls_dup_info(FAR struct tcb_s *dst, FAR struct tcb_s *src)
/* Allocate thread local storage */ /* Allocate thread local storage */
info = up_stack_frame(dst, up_tls_size()); info = up_stack_frame(dst, tls_info_size());
if (info == NULL) if (info == NULL)
{ {
return -ENOMEM; return -ENOMEM;
@ -66,7 +63,7 @@ int tls_dup_info(FAR struct tcb_s *dst, FAR struct tcb_s *src)
/* Copy thread local storage */ /* Copy thread local storage */
memcpy(info, src->stack_alloc_ptr, sizeof(struct tls_info_s)); memcpy(info, src->stack_alloc_ptr, tls_info_size());
/* Attach per-task info in group to TLS */ /* Attach per-task info in group to TLS */

View file

@ -25,9 +25,6 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <nuttx/arch.h>
#include <nuttx/tls.h>
#include "tls.h" #include "tls.h"
/**************************************************************************** /****************************************************************************
@ -54,7 +51,7 @@ int tls_init_info(FAR struct tcb_s *tcb)
/* Allocate thread local storage */ /* Allocate thread local storage */
info = up_stack_frame(tcb, up_tls_size()); info = up_stack_frame(tcb, tls_info_size());
if (info == NULL) if (info == NULL)
{ {
return -ENOMEM; return -ENOMEM;