diff options
Diffstat (limited to 'cpukit/score/src/stackallocatorforidle.c')
-rw-r--r-- | cpukit/score/src/stackallocatorforidle.c | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/cpukit/score/src/stackallocatorforidle.c b/cpukit/score/src/stackallocatorforidle.c index c97dde030f..c8c8c0b766 100644 --- a/cpukit/score/src/stackallocatorforidle.c +++ b/cpukit/score/src/stackallocatorforidle.c @@ -1,6 +1,15 @@ -/* - * SPDX-License-Identifier: BSD-2-Clause +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSScoreStack * + * @brief This source file contains the implementation of + * _Stack_Allocator_allocate_for_idle_static(). + */ + +/* * Copyright (C) 2021 On-Line Applications Research Corporation (OAR) * * Redistribution and use in source and binary forms, with or without @@ -30,35 +39,21 @@ #endif #include <rtems/score/stack.h> -#include <rtems/score/thread.h> #include <rtems/score/assert.h> -/** - * @brief Default stack allocator allocate for IDLE threads. - * - * The default allocator for IDLE thread stacks gets the memory from a - * statically allocated area provided via confdefs.h. - * - * @param cpu is the index of the CPU for the IDLE thread using this stack. - * - * @param stack_size[in] is pointer to a size_t object. On function - * entry, the object contains the size of the stack area to allocate in - * bytes. - * - * @return Returns the pointer to begin of the allocated stack area. - */ -static void *_Stack_Allocator_allocate_for_idle_default( +void *_Stack_Allocator_allocate_for_idle_static( uint32_t cpu_index, - size_t *stack_size + size_t *storage_size ) { + size_t size; + + size = _Stack_Allocator_allocate_for_idle_storage_size; + *storage_size = size; #if defined(RTEMS_SMP) - return &_Thread_Idle_stacks[ cpu_index * ( *stack_size ) ]; + return &_Stack_Allocator_allocate_for_idle_storage_areas[ cpu_index * size ]; #else _Assert( cpu_index == 0 ); - return &_Thread_Idle_stacks[ 0 ]; + return &_Stack_Allocator_allocate_for_idle_storage_areas[ 0 ]; #endif } - -const Stack_Allocator_allocate_for_idle _Stack_Allocator_allocate_for_idle = - _Stack_Allocator_allocate_for_idle_default; |