On Thu, Feb 18, 2021 at 11:59 AM Kinsey Moore <kinsey.mo...@oarcorp.com> wrote: > > The size of the reserved TLS space is not guaranteed to adhere to stack > alignment requirements which can cause stack_end to become misaligned. > This enforces the alignment of stack_end. > --- > cpukit/score/src/threadinitialize.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/cpukit/score/src/threadinitialize.c > b/cpukit/score/src/threadinitialize.c > index 05c30c3d43..ad5dccbbb2 100644 > --- a/cpukit/score/src/threadinitialize.c > +++ b/cpukit/score/src/threadinitialize.c > @@ -108,6 +108,10 @@ bool _Thread_Initialize( > ( ( (uintptr_t) stack_end + tls_align - 1 ) & ~( tls_align - 1 ) ); > } > > + /* Enforce stack alignment */ > + stack_end = (char *)((uintptr_t) stack_end & > + ~( (uintptr_t) CPU_STACK_ALIGNMENT - 1 )); > +
Aside from Sebastian's points, please note that we have alignment macros available via basedefs.h that should be used, i.e., RTEMS_ALIGN_* > _Stack_Initialize( > &the_thread->Start.Initial_stack, > stack_begin, > -- > 2.20.1 > > _______________________________________________ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel