summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-17 07:57:09 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-17 08:06:40 +0200
commit320faf8e68796bcea316accdfa75c1f64a73f6b7 (patch)
tree8fb29bb6756f095bd0f281faaf4189fec380e2af
parentdoc: Typo (diff)
downloadrtems-320faf8e68796bcea316accdfa75c1f64a73f6b7.tar.bz2
score: Clarify TLS support
-rw-r--r--c/src/lib/libcpu/powerpc/new-exceptions/cpu.c2
-rw-r--r--cpukit/score/cpu/m68k/cpu.c2
-rw-r--r--cpukit/score/cpu/sparc/cpu.c2
-rw-r--r--cpukit/score/cpu/sparc64/cpu.c2
-rw-r--r--cpukit/score/include/rtems/score/tls.h4
-rw-r--r--doc/cpu_supplement/general.t21
6 files changed, 26 insertions, 7 deletions
diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c b/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
index 3b17662287..73a1d3ece5 100644
--- a/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
+++ b/c/src/lib/libcpu/powerpc/new-exceptions/cpu.c
@@ -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 {
diff --git a/cpukit/score/cpu/m68k/cpu.c b/cpukit/score/cpu/m68k/cpu.c
index f6342d667e..4efaaa49ef 100644
--- a/cpukit/score/cpu/m68k/cpu.c
+++ b/cpukit/score/cpu/m68k/cpu.c
@@ -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 );
}
}
diff --git a/cpukit/score/cpu/sparc/cpu.c b/cpukit/score/cpu/sparc/cpu.c
index 2878c3e469..73ed4fdd78 100644
--- a/cpukit/score/cpu/sparc/cpu.c
+++ b/cpukit/score/cpu/sparc/cpu.c
@@ -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;
}
diff --git a/cpukit/score/cpu/sparc64/cpu.c b/cpukit/score/cpu/sparc64/cpu.c
index c5420c3d8c..6d79a5adb9 100644
--- a/cpukit/score/cpu/sparc64/cpu.c
+++ b/cpukit/score/cpu/sparc64/cpu.c
@@ -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;
}
diff --git a/cpukit/score/include/rtems/score/tls.h b/cpukit/score/include/rtems/score/tls.h
index 75213d88b7..f9abc27ac9 100644
--- a/cpukit/score/include/rtems/score/tls.h
+++ b/cpukit/score/include/rtems/score/tls.h
@@ -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;
diff --git a/doc/cpu_supplement/general.t b/doc/cpu_supplement/general.t
index 9c952a7e97..173f84fcc9 100644
--- a/doc/cpu_supplement/general.t
+++ b/doc/cpu_supplement/general.t
@@ -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: