kernel: Init back pointer to microkernel task

Fibers initialize this back pointer to NULL as they are (by definition)
not microkernel tasks.  Microkernel tasks initialize it to their
corresponding 'ktask_t'.

However for nanokernel systems, the back pointer is always NULL. This
is because there is only one task in a nanokernel system (the background
task) and it can not pend on a nanokernel object--it must poll.

Change-Id: I9840fecc44224bef63d09d587d703720cf33ad57
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
This commit is contained in:
Peter Mitsis 2016-02-23 11:36:43 -05:00 committed by Anas Nashif
commit b58878bb89
8 changed files with 51 additions and 11 deletions

View file

@ -100,7 +100,8 @@ static ALWAYS_INLINE void _thread_monitor_init(struct tcs *tcs /* thread */
* @return N/A
*/
void _new_thread(char *pStackMem, unsigned stackSize, _thread_entry_t pEntry,
void _new_thread(char *pStackMem, unsigned stackSize,
void *uk_task_ptr, _thread_entry_t pEntry,
void *parameter1, void *parameter2, void *parameter3,
int priority, unsigned options)
{
@ -143,6 +144,12 @@ void _new_thread(char *pStackMem, unsigned stackSize, _thread_entry_t pEntry,
tcs->entry = (struct __thread_entry *)(pInitCtx);
#endif
#ifdef CONFIG_MICROKERNEL
tcs->uk_task_ptr = uk_task_ptr;
#else
ARG_UNUSED(uk_task_ptr);
#endif
tcs->preempReg.psp = (uint32_t)pInitCtx;
tcs->basepri = 0;