Backport of Issue: RTX: Main thread should not write MAGIC_WORD to stack #827

pull/1118/head
Dmitry Bogdanov 2015-05-08 19:58:12 +04:00
parent f3a03cacc1
commit 6d0c61a6ad
1 changed files with 6 additions and 5 deletions

View File

@ -522,18 +522,19 @@ osThreadId svcThreadCreate (osThreadDef_t *thread_def, void *argument) {
U8 priority = thread_def->tpriority - osPriorityIdle + 1;
P_TCB task_context = &thread_def->tcb;
/* If "size != 0" use a private user provided stack. */
/* Utilize the user provided stack. */
task_context->stack = (U32*)thread_def->stack_pointer;
task_context->priv_stack = thread_def->stacksize;
/* Find a free entry in 'os_active_TCB' table. */
OS_TID tsk = rt_get_TID ();
os_active_TCB[tsk-1] = task_context;
task_context->task_id = tsk;
/* Pass parameter 'argv' to 'rt_init_context' */
task_context->msg = argument;
/* For 'size == 0' system allocates the user stack from the memory pool. */
rt_init_context (task_context, priority, (FUNCP)thread_def->pthread);
/* Find a free entry in 'os_active_TCB' table. */
OS_TID tsk = rt_get_TID ();
os_active_TCB[tsk-1] = task_context;
task_context->task_id = tsk;
/* Dispatch this task to the scheduler for execution. */
DBG_TASK_NOTIFY(task_context, __TRUE);
rt_dispatch (task_context);