summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/score/stack.h
diff options
context:
space:
mode:
authorJoel Sherrill <joel@rtems.org>2021-10-07 17:28:26 -0500
committerJoel Sherrill <joel@rtems.org>2021-10-11 08:42:25 -0500
commit822ebb4cae2bb8bc9fe55915bd4acc4942fcd8ce (patch)
treed8b9f10c2f96ca59e190964557f8ab3b0c50af2a /cpukit/include/rtems/score/stack.h
parentscore: _Thread_queue_Surrender_priority_ceiling() (diff)
downloadrtems-822ebb4cae2bb8bc9fe55915bd4acc4942fcd8ce.tar.bz2
Add support for IDLE Thread stack allocator
Add a stack allocator hook specifically for allocation of IDLE thread stacks. This allows the user to decide if IDLE thread stacks are statically allocated or handled by the same custom allocator mechanism as other thread stacks. Closes #4524.
Diffstat (limited to 'cpukit/include/rtems/score/stack.h')
-rw-r--r--cpukit/include/rtems/score/stack.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/cpukit/include/rtems/score/stack.h b/cpukit/include/rtems/score/stack.h
index 23421cf7ae..ffa6368ba5 100644
--- a/cpukit/include/rtems/score/stack.h
+++ b/cpukit/include/rtems/score/stack.h
@@ -81,6 +81,23 @@ typedef void *( *Stack_Allocator_allocate )( size_t stack_size );
typedef void ( *Stack_Allocator_free )( void *addr );
/**
+ * @brief Stack allocator allocate for idle handler.
+ *
+ * The allocate for idle handler is optional even when the user thread stack
+ * allocator and deallocator are configured.
+ *
+ * @param cpu Index of the CPU for the IDLE thread using this stack
+ * @param stack_size The size of the stack area to allocate in bytes.
+ *
+ * @retval NULL Not enough memory.
+ * @retval other Pointer to begin of stack area.
+ */
+typedef void *( *Stack_Allocator_allocate_for_idle )(
+ uint32_t cpu,
+ size_t stack_size
+);
+
+/**
* @brief The minimum stack size.
*
* Application provided via <rtems/confdefs.h>.
@@ -130,6 +147,13 @@ extern const Stack_Allocator_free _Stack_Allocator_free;
void _Stack_Allocator_do_initialize( void );
/** @} */
+/**
+ * @brief The stack allocator allocate stack for idle thread handler.
+ *
+ * Application provided via <rtems/confdefs.h>.
+ */
+extern const Stack_Allocator_allocate_for_idle
+ _Stack_Allocator_allocate_for_idle;
#ifdef __cplusplus
}