[PATCH v2] CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Mar 3 17:47:07 UTC 2021


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 +++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/cpukit/doxygen/appl-config.h b/cpukit/doxygen/appl-config.h
index 092e02ccca..4b18ac29a7 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 97508068e2..279c6264db 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;
 
-- 
2.26.2



More information about the devel mailing list