summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/score/stack.h
diff options
context:
space:
mode:
authorJoel Sherrill <joel@rtems.org>2021-10-01 14:56:34 -0500
committerJoel Sherrill <joel@rtems.org>2021-10-07 10:31:38 -0500
commitc8a10609883c67629ea029be617a42b75d168f0f (patch)
tree77fb5ef6d9a04763840be4a205516d5fb542d6e4 /cpukit/include/rtems/score/stack.h
parentpowerpc/motorola_powerpc: Map LibBSD bus space to the PCI base address (diff)
downloadrtems-c8a10609883c67629ea029be617a42b75d168f0f.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 #4520.
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 df1df74867..bad89e66fc 100644
--- a/cpukit/include/rtems/score/stack.h
+++ b/cpukit/include/rtems/score/stack.h
@@ -82,6 +82,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>.
@@ -124,6 +141,13 @@ extern const Stack_Allocator_allocate _Stack_Allocator_allocate;
extern const Stack_Allocator_free _Stack_Allocator_free;
/** @} */
+/**
+ * @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
}