From 4c9deb6c10ad2ccab37da5723748841dbc73f0d2 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 9 Dec 2019 14:33:06 +0100 Subject: score: Add _Stack_Extend_size() Update #3835. --- cpukit/include/rtems/score/stackimpl.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'cpukit/include/rtems/score/stackimpl.h') diff --git a/cpukit/include/rtems/score/stackimpl.h b/cpukit/include/rtems/score/stackimpl.h index aafde5d1a0..305c4e4e51 100644 --- a/cpukit/include/rtems/score/stackimpl.h +++ b/cpukit/include/rtems/score/stackimpl.h @@ -120,6 +120,33 @@ RTEMS_INLINE_ROUTINE size_t _Stack_Ensure_minimum ( return _Stack_Minimum(); } +/** + * @brief Extend the stack size to account for additional data structures + * allocated in the stack area of a thread. + * + * @param stack_size The stack size. + * @param is_fp Indicates if the stack is for a floating-point thread. + * + * @return The extended stack size. + */ +RTEMS_INLINE_ROUTINE size_t _Stack_Extend_size( + size_t stack_size, + bool is_fp +) +{ +#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) + if ( is_fp ) { + stack_size += CONTEXT_FP_SIZE; + } +#else + (void) is_fp; +#endif + + stack_size += _TLS_Get_allocation_size(); + + return stack_size; +} + /** * @brief Allocate the requested stack space. * -- cgit v1.2.3