diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-10-19 16:37:03 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-10-25 08:01:02 +0200 |
commit | 9be97a34db3b712a8a962b3e0d0c134f5055e6d4 (patch) | |
tree | ae3f009b669f588ef988f4a9073f494fd3adb2df /cpukit/score | |
parent | score: Simplify _Watchdog_Next_first() (diff) | |
download | rtems-9be97a34db3b712a8a962b3e0d0c134f5055e6d4.tar.bz2 |
score: Optimize default idle task stack allocator
Update #4524.
Diffstat (limited to 'cpukit/score')
-rw-r--r-- | cpukit/score/src/stackallocatorforidle.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cpukit/score/src/stackallocatorforidle.c b/cpukit/score/src/stackallocatorforidle.c index 7c4fd10c7d..7a8a05fae6 100644 --- a/cpukit/score/src/stackallocatorforidle.c +++ b/cpukit/score/src/stackallocatorforidle.c @@ -31,6 +31,7 @@ #include <rtems/score/stack.h> #include <rtems/score/thread.h> +#include <rtems/score/assert.h> /** * @brief Default stack allocator allocate for idle handler. @@ -41,18 +42,23 @@ * The default allocator for IDLE thread stacks gets the memory from a * statically allocated area provided via confdefs.h. * - * @param cpu Index of the CPU for the IDLE thread using this stack + * @param cpu_index 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 (never returned). * @retval other Pointer to begin of stack area. */ static void *_Stack_Allocator_allocate_for_idle_default( - uint32_t cpu, + uint32_t cpu_index, size_t stack_size ) { - return &_Thread_Idle_stacks[ cpu * stack_size ]; +#if defined(RTEMS_SMP) + return &_Thread_Idle_stacks[ cpu_index * stack_size ]; +#else + _Assert( cpu_index == 0 ); + return &_Thread_Idle_stacks[ 0 ]; +#endif } const Stack_Allocator_allocate_for_idle _Stack_Allocator_allocate_for_idle = |