[PATCH 3/4] CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE
Gedare Bloom
gedare at rtems.org
Wed Mar 3 15:56:16 UTC 2021
On Wed, Mar 3, 2021 at 1:40 AM Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
>
> 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 | 8 +++++++-
> 2 files changed, 18 insertions(+), 4 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..a9c8a271b5 100644
> --- a/cpukit/include/rtems/confdefs/threads.h
> +++ b/cpukit/include/rtems/confdefs/threads.h
> @@ -138,8 +138,14 @@ typedef union {
>
> const size_t _Thread_Maximum_name_size = CONFIGURE_MAXIMUM_THREAD_NAME_SIZE;
>
> +#define _CONFIGURE_ASSERT_TASK_STORAGE_ALIGNMENT( _value ) \
> + ( ( _value ) % RTEMS_TASK_STORAGE_ALIGNMENT == 0 ? ( _value ) : \
> + sizeof( int[ ( _value ) % RTEMS_TASK_STORAGE_ALIGNMENT == 0 ? 1 : -1 ] ) )
> +
The name of this is misleading as it is not an "assert" statement.
perhaps ENFORCE instead of ASSERT?
> const size_t _Thread_Maximum_TLS_size =
> - CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE;
> + _CONFIGURE_ASSERT_TASK_STORAGE_ALIGNMENT(
> + CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE
> + );
>
> struct Thread_Configured_control {
> Thread_Control Control;
> --
> 2.26.2
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
More information about the devel
mailing list