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 cdd111a commit 5ddf583
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 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)
{
#ifndef CONFIG_BUILD_FLAT
up_task_start(tcb->cmn.entry.main, argc, tcb->argv);
#else
nxtask_startup(tcb->cmn.entry.main, argc, tcb->argv);
#endif
}
else
{
exitcode = tcb->cmn.entry.main(argc, tcb->argv);
}
#else
nxtask_startup(tcb->cmn.entry.main, argc, tcb->argv);
#endif

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

Expand Down

0 comments on commit 5ddf583

Please sign in to comment.