summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-12-09 14:48:34 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-02-12 09:08:36 +0100
commit01d59443b06ab351039cbc63a688cfa87f196ea0 (patch)
tree2044378caa3adc38cb494405d5618731f3686de2 /cpukit/rtems
parentscore: Add _Stack_Extend_size() (diff)
downloadrtems-01d59443b06ab351039cbc63a688cfa87f196ea0.tar.bz2
score: Move thread stack allocation
Move thread stack allocation to caller side of _Thread_Initialize(). Update #3835.
Diffstat (limited to 'cpukit/rtems')
-rw-r--r--cpukit/rtems/src/taskcreate.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/cpukit/rtems/src/taskcreate.c b/cpukit/rtems/src/taskcreate.c
index 5b53ed6f78..03917f3cf4 100644
--- a/cpukit/rtems/src/taskcreate.c
+++ b/cpukit/rtems/src/taskcreate.c
@@ -25,6 +25,7 @@
#include <rtems/rtems/support.h>
#include <rtems/score/apimutex.h>
#include <rtems/score/schedulerimpl.h>
+#include <rtems/score/stackimpl.h>
#include <rtems/score/sysstate.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/userextimpl.h>
@@ -78,7 +79,6 @@ rtems_status_code rtems_task_create(
_Attributes_Clear( the_attribute_set, ATTRIBUTES_NOT_SUPPORTED );
memset( &config, 0, sizeof( config ) );
- config.stack_size = stack_size;
config.budget_algorithm = _Modes_Is_timeslice( initial_modes ) ?
THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE
: THREAD_CPU_BUDGET_ALGORITHM_NONE,
@@ -86,6 +86,8 @@ rtems_status_code rtems_task_create(
config.name.name_u32 = name;
config.is_fp = _Attributes_Is_floating_point( the_attribute_set );
config.is_preemptible = _Modes_Is_preempt( initial_modes );
+ config.stack_size = _Stack_Ensure_minimum( stack_size );
+ config.stack_size = _Stack_Extend_size( config.stack_size, config.is_fp );
/*
* Validate the RTEMS API priority and convert it to the core priority range.
@@ -148,11 +150,21 @@ rtems_status_code rtems_task_create(
}
#endif
+ config.stack_area = _Stack_Allocate( config.stack_size );
+ config.allocated_stack = config.stack_area;
+ status = ( config.stack_area != NULL );
+
/*
* Initialize the core thread for this task.
*/
- status = _Thread_Initialize( &_RTEMS_tasks_Information, the_thread, &config );
+ if ( status ) {
+ status = _Thread_Initialize(
+ &_RTEMS_tasks_Information,
+ the_thread,
+ &config
+ );
+ }
if ( !status ) {
#if defined(RTEMS_MULTIPROCESSING)