tls: restore C89 compatibility for TLS

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko
2021-12-13 20:27:51 +02:00
committed by Xiang Xiao
parent 9a86aa7f77
commit af614ac77d
4 changed files with 6 additions and 13 deletions
+2 -2
View File
@@ -65,7 +65,7 @@ int up_tls_size(void)
void up_tls_initialize(FAR struct tls_info_s *info)
{
FAR uint8_t *tls_data = info->tl_data;
FAR uint8_t *tls_data = (FAR uint8_t *)(info + 1);
uint32_t tdata_len = sizeof(uint32_t) * (_END_TDATA - _START_TDATA);
uint32_t tbss_len = sizeof(uint32_t) * (_END_TBSS - _START_TBSS);
@@ -86,5 +86,5 @@ void up_tls_initialize(FAR struct tls_info_s *info)
void *__aeabi_read_tp(void)
{
return tls_get_info()->tl_data;
return (void *)(tls_get_info() + 1);
}
+1 -1
View File
@@ -62,7 +62,7 @@ int up_tls_size(void)
void up_tls_initialize(FAR struct tls_info_s *info)
{
FAR uint8_t *tls_data = info->tl_data;
FAR uint8_t *tls_data = (FAR uint8_t *)(info + 1);
uint32_t tdata_len = sizeof(uint32_t) * (_END_TDATA - _START_TDATA);
uint32_t tbss_len = sizeof(uint32_t) * (_END_TBSS - _START_TBSS);
+2 -6
View File
@@ -55,11 +55,6 @@
void up_initial_state(struct tcb_s *tcb)
{
struct xcptcontext *xcp = &tcb->xcp;
#ifdef CONFIG_SCHED_THREAD_LOCAL
struct tls_info_s *info = tcb->stack_alloc_ptr;
#endif
uint32_t regval;
/* Initialize the idle thread stack */
@@ -101,7 +96,8 @@ void up_initial_state(struct tcb_s *tcb)
/* Setup thread local storage pointer */
#ifdef CONFIG_SCHED_THREAD_LOCAL
xcp->regs[REG_TP] = (uint32_t)info->tl_data;
xcp->regs[REG_TP] = (uint32_t)tcb->stack_alloc_ptr +
sizeof(struct tls_info_s);
#endif
/* If this task is running PIC, then set the PIC base register to the
+1 -4
View File
@@ -140,7 +140,7 @@ struct pthread_cleanup_s
* The stack memory is fully accessible to user mode threads. TLS is not
* available from interrupt handlers (nor from the IDLE thread).
*
* The following diagram represent the typic stack layout:
* The following diagram represent the typical stack layout:
*
* Push Down Push Up
* +-------------+ +-------------+ <- Stack memory allocation
@@ -179,9 +179,6 @@ struct tls_info_s
#endif
int tl_errno; /* Per-thread error number */
#ifdef CONFIG_SCHED_THREAD_LOCAL
uint8_t tl_data[0];
#endif
};
/****************************************************************************