Skip to content

Commit

Permalink
sched: nxtask_start should call entry point directly for kernel thread
Browse files Browse the repository at this point in the history
since nxtask_startup will initialize c++ global variables which shouldn't
be done inside the kernel thread

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
  • Loading branch information
xiaoxiang781216 committed Sep 30, 2020
1 parent c18e7bb commit 007cbbf
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sched/task/task_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,18 @@ void nxtask_start(void)
* we have to switch to user-mode before calling the task.
*/

#ifndef CONFIG_BUILD_FLAT
if ((tcb->cmn.flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL)
if ((tcb->cmn.flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
{
up_task_start(tcb->cmn.entry.main, argc, tcb->argv);
exitcode = tcb->cmn.entry.main(argc, tcb->argv);
}
else
{
exitcode = tcb->cmn.entry.main(argc, tcb->argv);
}
#ifdef CONFIG_BUILD_FLAT
nxtask_startup(tcb->cmn.entry.main, argc, tcb->argv);
#else
nxtask_startup(tcb->cmn.entry.main, argc, tcb->argv);
up_task_start(tcb->cmn.entry.main, argc, tcb->argv);
#endif
}

/* Call exit() if/when the task returns */

Expand Down

0 comments on commit 007cbbf

Please sign in to comment.