diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2019-12-09 10:12:14 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-02-12 09:08:36 +0100 |
commit | f4dbf37dd432623c345f8e19f78a4eb01fcedb8b (patch) | |
tree | cb18eb86ccce8ab3fff22c9c4543ddaf9d93b183 /cpukit/include | |
parent | score: Simplify FP context allocation (diff) | |
download | rtems-f4dbf37dd432623c345f8e19f78a4eb01fcedb8b.tar.bz2 |
score: Simplify TLS area allocation
Use the stack area to allocate the TLS area.
Update #3835.
Diffstat (limited to 'cpukit/include')
-rw-r--r-- | cpukit/include/rtems/confdefs.h | 3 | ||||
-rw-r--r-- | cpukit/include/rtems/config.h | 8 | ||||
-rw-r--r-- | cpukit/include/rtems/score/stack.h | 11 | ||||
-rw-r--r-- | cpukit/include/rtems/score/stackimpl.h | 4 | ||||
-rw-r--r-- | cpukit/include/rtems/score/tls.h | 25 |
5 files changed, 18 insertions, 33 deletions
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h index a356a94118..7fc1cf97de 100644 --- a/cpukit/include/rtems/confdefs.h +++ b/cpukit/include/rtems/confdefs.h @@ -2726,12 +2726,13 @@ struct _reent *__getreent(void) uint32_t rtems_minimum_stack_size = CONFIGURE_MINIMUM_TASK_STACK_SIZE; + const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE; + /** * This is the primary Configuration Table for this application. */ const rtems_configuration_table Configuration = { CONFIGURE_EXECUTIVE_RAM_SIZE, /* required RTEMS workspace */ - _CONFIGURE_STACK_SPACE_SIZE, /* required stack space */ CONFIGURE_MAXIMUM_USER_EXTENSIONS, /* maximum dynamic extensions */ CONFIGURE_MICROSECONDS_PER_TICK, /* microseconds per clock tick */ CONFIGURE_TICKS_PER_TIMESLICE, /* ticks per timeslice quantum */ diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h index fac5c6e009..725f45d140 100644 --- a/cpukit/include/rtems/config.h +++ b/cpukit/include/rtems/config.h @@ -96,11 +96,6 @@ typedef struct { uintptr_t work_space_size; /** - * This field specifies the size in bytes of the RTEMS thread stack space. - */ - uintptr_t stack_space_size; - - /** * This field contains the maximum number of POSIX API * key value pairs which are configured for this application. * @@ -191,8 +186,7 @@ extern const rtems_configuration_table Configuration; #define rtems_configuration_get_stack_allocator_avoids_work_space() \ (Configuration.stack_allocator_avoids_work_space) -#define rtems_configuration_get_stack_space_size() \ - (Configuration.stack_space_size) +uintptr_t rtems_configuration_get_stack_space_size( void ); #define rtems_configuration_get_work_space_size() \ (Configuration.work_space_size + \ diff --git a/cpukit/include/rtems/score/stack.h b/cpukit/include/rtems/score/stack.h index 1158f3472e..2ad362abd2 100644 --- a/cpukit/include/rtems/score/stack.h +++ b/cpukit/include/rtems/score/stack.h @@ -58,12 +58,19 @@ typedef struct { } Stack_Control; /** - * This variable contains the the minimum stack size; + * @brief The minimum stack size. * - * @note It is instantiated and set by User Configuration via confdefs.h. + * Application provided via <rtems/confdefs.h>. */ extern uint32_t rtems_minimum_stack_size; +/** + * @brief The configured stack space size. + * + * Application provided via <rtems/confdefs.h>. + */ +extern const uintptr_t _Stack_Space_size; + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/rtems/score/stackimpl.h b/cpukit/include/rtems/score/stackimpl.h index 60704534c7..aafde5d1a0 100644 --- a/cpukit/include/rtems/score/stackimpl.h +++ b/cpukit/include/rtems/score/stackimpl.h @@ -23,6 +23,7 @@ #include <rtems/score/stack.h> #include <rtems/score/context.h> +#include <rtems/score/tls.h> #ifdef __cplusplus extern "C" { @@ -87,7 +88,8 @@ RTEMS_INLINE_ROUTINE bool _Stack_Is_enough( { size_t minimum; - minimum = _Stack_Minimum(); + minimum = _TLS_Get_allocation_size(); + minimum += _Stack_Minimum(); #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) if ( is_fp ) { diff --git a/cpukit/include/rtems/score/tls.h b/cpukit/include/rtems/score/tls.h index dadcb770ad..1b9dae11b1 100644 --- a/cpukit/include/rtems/score/tls.h +++ b/cpukit/include/rtems/score/tls.h @@ -134,30 +134,11 @@ static inline uintptr_t _TLS_Get_thread_control_block_area_size( } /** - * @brief Returns the actual size that has to be allocated for this size and - * alignment. + * @brief Return the TLS area allocation size. * - * @param size The size for the operation. - * @param alignment The alignment for the operation. - * - * @return The actual allocation size. + * @return The TLS area allocation size. */ -static inline uintptr_t _TLS_Get_allocation_size( - uintptr_t size, - uintptr_t alignment -) -{ - uintptr_t allocation_size = 0; - - allocation_size += _TLS_Heap_align_up( size ); - allocation_size += _TLS_Get_thread_control_block_area_size( alignment ); - -#ifndef __i386__ - allocation_size += sizeof(TLS_Dynamic_thread_vector); -#endif - - return allocation_size; -} +uintptr_t _TLS_Get_allocation_size( void ); /** * @brief Copies TLS size bytes from the address tls_area and returns a pointer |