mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-26 12:27:11 +08:00
CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE
Ensure that CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE meets the task storage alignment requirement.
This commit is contained in:
@@ -887,9 +887,17 @@
|
||||
* The default value is 0.
|
||||
*
|
||||
* @par Value Constraints
|
||||
* The value of this configuration option shall be greater than or equal to 0
|
||||
* and less than or equal to <a
|
||||
* href="https://en.cppreference.com/w/c/types/limits">SIZE_MAX</a>.
|
||||
* @parblock
|
||||
* The value of this configuration option shall satisfy all of the following
|
||||
* constraints:
|
||||
*
|
||||
* * It shall be greater than or equal to 0.
|
||||
*
|
||||
* * It shall be less than or equal to <a
|
||||
* href="https://en.cppreference.com/w/c/types/limits">SIZE_MAX</a>.
|
||||
*
|
||||
* * It shall be an integral multiple of #RTEMS_TASK_STORAGE_ALIGNMENT.
|
||||
* @endparblock
|
||||
*
|
||||
* @par Notes
|
||||
* @parblock
|
||||
|
||||
@@ -138,6 +138,11 @@ typedef union {
|
||||
|
||||
const size_t _Thread_Maximum_name_size = CONFIGURE_MAXIMUM_THREAD_NAME_SIZE;
|
||||
|
||||
RTEMS_STATIC_ASSERT(
|
||||
CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE % RTEMS_TASK_STORAGE_ALIGNMENT == 0,
|
||||
CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE
|
||||
);
|
||||
|
||||
const size_t _Thread_Maximum_TLS_size =
|
||||
CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE;
|
||||
|
||||
|
||||
@@ -36,20 +36,20 @@
|
||||
#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE
|
||||
#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_TOO_LARGE_TLS_SIZE
|
||||
|
||||
static _Thread_local short tls;
|
||||
static _Thread_local int tls[ RTEMS_TASK_STORAGE_ALIGNMENT ];
|
||||
|
||||
static void force_error(void)
|
||||
static void force_error( void )
|
||||
{
|
||||
long var;
|
||||
int var;
|
||||
|
||||
var = tls;
|
||||
var = tls[ 0 ];
|
||||
RTEMS_OBFUSCATE_VARIABLE( var );
|
||||
tls = var;
|
||||
tls[ 0 ] = var;
|
||||
|
||||
/* Not reached */
|
||||
rtems_test_assert( 0 );
|
||||
}
|
||||
|
||||
#define CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE 1
|
||||
#define CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE RTEMS_TASK_STORAGE_ALIGNMENT
|
||||
|
||||
#include "../spfatal_support/spfatalimpl.h"
|
||||
|
||||
Reference in New Issue
Block a user