[rtems commit] CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE
Sebastian Huber
sebh at rtems.org
Fri Mar 5 05:58:48 UTC 2021
Module: rtems
Branch: master
Commit: 1de00d685d4ad5af7c6b09711b34369dc7d31bae
Changeset: http://git.rtems.org/rtems/commit/?id=1de00d685d4ad5af7c6b09711b34369dc7d31bae
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Mar 3 09:36:45 2021 +0100
CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE
Ensure that CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE meets the task
storage alignment requirement.
---
cpukit/doxygen/appl-config.h | 14 +++++++++++---
cpukit/include/rtems/confdefs/threads.h | 5 +++++
testsuites/sptests/spfatal33/init.c | 12 ++++++------
3 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/cpukit/doxygen/appl-config.h b/cpukit/doxygen/appl-config.h
index 092e02c..4b18ac2 100644
--- a/cpukit/doxygen/appl-config.h
+++ b/cpukit/doxygen/appl-config.h
@@ -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
diff --git a/cpukit/include/rtems/confdefs/threads.h b/cpukit/include/rtems/confdefs/threads.h
index 9750806..279c626 100644
--- a/cpukit/include/rtems/confdefs/threads.h
+++ b/cpukit/include/rtems/confdefs/threads.h
@@ -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;
diff --git a/testsuites/sptests/spfatal33/init.c b/testsuites/sptests/spfatal33/init.c
index 3cdce7d..a7218c5 100644
--- a/testsuites/sptests/spfatal33/init.c
+++ b/testsuites/sptests/spfatal33/init.c
@@ -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"
More information about the vc
mailing list