From 1025f3c193163b48ffd59661e44c9dcc03f5e417 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Tue, 14 Feb 2017 00:19:00 +0800 Subject: [PATCH] use host_task_stub() for host task Signed-off-by: Lai Jiangshan --- arch/lkl/include/asm/sched.h | 1 + arch/lkl/kernel/syscalls.c | 2 +- arch/lkl/kernel/threads.c | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/lkl/include/asm/sched.h b/arch/lkl/include/asm/sched.h index 7154d7f3bebeb0..e874d1afa1127a 100644 --- a/arch/lkl/include/asm/sched.h +++ b/arch/lkl/include/asm/sched.h @@ -18,5 +18,6 @@ static inline void thread_sched_jb(void) } void switch_to_host_task(struct task_struct *); +int host_task_stub(void *unused); #endif /* _ASM_LKL_SCHED_H */ diff --git a/arch/lkl/kernel/syscalls.c b/arch/lkl/kernel/syscalls.c index fb8e8d59b14bf2..b429c4c0eabdc5 100644 --- a/arch/lkl/kernel/syscalls.c +++ b/arch/lkl/kernel/syscalls.c @@ -61,7 +61,7 @@ static int new_host_task(struct task_struct **task) switch_to_host_task(host0); - pid = kernel_thread(NULL, NULL, CLONE_FLAGS); + pid = kernel_thread(host_task_stub, NULL, CLONE_FLAGS); if (pid < 0) return pid; diff --git a/arch/lkl/kernel/threads.c b/arch/lkl/kernel/threads.c index caede2f80f2d64..4a9c7d45c6527b 100644 --- a/arch/lkl/kernel/threads.c +++ b/arch/lkl/kernel/threads.c @@ -126,6 +126,11 @@ struct task_struct *__switch_to(struct task_struct *prev, return abs_prev; } +int host_task_stub(void *unused) +{ + return 0; +} + void switch_to_host_task(struct task_struct *task) { if (current == task) @@ -170,7 +175,7 @@ int copy_thread(unsigned long clone_flags, unsigned long esp, struct thread_info *ti = task_thread_info(p); struct thread_bootstrap_arg *tba; - if (!esp) { + if ((int (*)(void *))esp == host_task_stub) { set_ti_thread_flag(ti, TIF_HOST_THREAD); return 0; }