forked from Imagelibrary/rtems
score: Clarify TLS support
This commit is contained in:
@@ -135,7 +135,7 @@ void _CPU_Context_Initialize(
|
||||
#endif
|
||||
|
||||
if ( tls_area != NULL ) {
|
||||
void *tls_block = _TLS_TCB_before_tls_block_initialize( tls_area );
|
||||
void *tls_block = _TLS_TCB_before_TLS_block_initialize( tls_area );
|
||||
|
||||
the_ppc_context->gpr2 = (uint32_t) tls_block + 0x7000;
|
||||
} else {
|
||||
|
||||
@@ -205,6 +205,6 @@ void _CPU_Context_Initialize(
|
||||
#endif
|
||||
|
||||
if ( tls_area != NULL ) {
|
||||
_TLS_TCB_before_tls_block_initialize( tls_area );
|
||||
_TLS_TCB_before_TLS_block_initialize( tls_area );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ void _CPU_Context_Initialize(
|
||||
the_context->isr_dispatch_disable = 0;
|
||||
|
||||
if ( tls_area != NULL ) {
|
||||
void *tcb = _TLS_TCB_after_tls_block_initialize( tls_area );
|
||||
void *tcb = _TLS_TCB_after_TLS_block_initialize( tls_area );
|
||||
|
||||
the_context->g7 = (uintptr_t) tcb;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ void _CPU_Context_Initialize(
|
||||
the_context->isr_dispatch_disable = 0;
|
||||
|
||||
if ( tls_area != NULL ) {
|
||||
void *tcb = _TLS_TCB_after_tls_block_initialize( tls_area );
|
||||
void *tcb = _TLS_TCB_after_TLS_block_initialize( tls_area );
|
||||
|
||||
the_context->g7 = (uintptr_t) tcb;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ static inline void *_TLS_TCB_at_area_begin_initialize( void *tls_area )
|
||||
}
|
||||
|
||||
/* Use Variant I, TLS offsets emitted by linker neglects the TCB */
|
||||
static inline void *_TLS_TCB_before_tls_block_initialize( void *tls_area )
|
||||
static inline void *_TLS_TCB_before_TLS_block_initialize( void *tls_area )
|
||||
{
|
||||
void *tls_block = (char *) tls_area
|
||||
+ _TLS_Get_thread_control_block_area_size( (uintptr_t) _TLS_Alignment );
|
||||
@@ -160,7 +160,7 @@ static inline void *_TLS_TCB_before_tls_block_initialize( void *tls_area )
|
||||
}
|
||||
|
||||
/* Use Variant II */
|
||||
static inline void *_TLS_TCB_after_tls_block_initialize( void *tls_area )
|
||||
static inline void *_TLS_TCB_after_TLS_block_initialize( void *tls_area )
|
||||
{
|
||||
uintptr_t size = (uintptr_t) _TLS_Size;
|
||||
uintptr_t tls_align = (uintptr_t) _TLS_Alignment;
|
||||
|
||||
@@ -319,7 +319,26 @@ operations of the default CPU specific fatal error handler.
|
||||
In order to support thread-local storage (TLS) the CPU port must implement the
|
||||
facilities mandated by the application binary interface (ABI) of the CPU
|
||||
architecture. The CPU port must initialize the TLS area in the
|
||||
@code{_CPU_Context_Initialize} function.
|
||||
@code{_CPU_Context_Initialize()} function. There are support functions available
|
||||
via @code{#include <rtems/score/tls.h>} which implement Variants I and II
|
||||
according to Ulrich Drepper, @cite{ELF Handling For Thread-Local Storage}.
|
||||
|
||||
@table @code
|
||||
|
||||
@item _TLS_TCB_at_area_begin_initialize()
|
||||
Uses Variant I, TLS offsets emitted by linker takes the TCB into account. For
|
||||
a reference implementation see @file{cpukit/score/cpu/arm/cpu.c}.
|
||||
|
||||
@item _TLS_TCB_before_TLS_block_initialize()
|
||||
Uses Variant I, TLS offsets emitted by linker neglects the TCB. For a
|
||||
reference implementation see
|
||||
@file{c/src/lib/libcpu/powerpc/new-exceptions/cpu.c}.
|
||||
|
||||
@item _TLS_TCB_after_TLS_block_initialize()
|
||||
Uses Variant II. For a reference implementation see
|
||||
@file{cpukit/score/cpu/sparc/cpu.c}.
|
||||
|
||||
@end table
|
||||
|
||||
The board support package (BSP) must provide the following sections and symbols
|
||||
in its linker command file:
|
||||
|
||||
Reference in New Issue
Block a user