summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/score/stackimpl.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-12-09 14:33:06 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-02-12 09:08:36 +0100
commit4c9deb6c10ad2ccab37da5723748841dbc73f0d2 (patch)
treeeb22b027bc51c8b101d1e42427a15fbf6185dac2 /cpukit/include/rtems/score/stackimpl.h
parentscore: Add Thread_Configuration (diff)
downloadrtems-4c9deb6c10ad2ccab37da5723748841dbc73f0d2.tar.bz2
score: Add _Stack_Extend_size()
Update #3835.
Diffstat (limited to 'cpukit/include/rtems/score/stackimpl.h')
-rw-r--r--cpukit/include/rtems/score/stackimpl.h27
1 files changed, 27 insertions, 0 deletions
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
@@ -121,6 +121,33 @@ RTEMS_INLINE_ROUTINE size_t _Stack_Ensure_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.
*
* @param stack_size The stack space that is requested.