sched: nxtask_start should call entry point directly for kernel thread

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>
This commit is contained in:
Xiang Xiao 2020-09-30 18:09:22 +08:00 committed by Alin Jerpelea
parent cb6dd70082
commit c59fcd3a53

View File

@ -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)
{
up_task_start(tcb->cmn.entry.main, argc, tcb->argv);
}
else
if ((tcb->cmn.flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
{
exitcode = tcb->cmn.entry.main(argc, tcb->argv);
}
else
{
#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 */