From eb2014bc80df21f2ecba2d00b715fa565f6eb3d5 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Thu, 25 Mar 2021 09:13:27 +0800 Subject: [PATCH] kernel: hosted: fix kernel tests We don't need to re-create the PID1 process, since it is done immediately now. Signed-off-by: Sean Cross --- kernel/src/arch/hosted.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kernel/src/arch/hosted.rs b/kernel/src/arch/hosted.rs index fc61f7972..edd0f09f9 100644 --- a/kernel/src/arch/hosted.rs +++ b/kernel/src/arch/hosted.rs @@ -522,11 +522,13 @@ pub fn idle() -> bool { // Switch to this process immediately, which moves it from `Setup(_)` to `Running(0)`. // Note that in this system, multiple processes can be active at once. This is // similar to having one core for each process - SystemServices::with_mut(|ss| { - ss.create_thread(new_pid, ThreadInit {})?; - ss.switch_to_thread(new_pid, None) - }) - .unwrap(); + if new_pid != PID::new(1).unwrap() { + SystemServices::with_mut(|ss| { + ss.create_thread(new_pid, ThreadInit {})?; + ss.switch_to_thread(new_pid, None) + }) + .unwrap(); + } } ThreadMessage::SysCall(pid, thread_id, call) => { // println!("KERNEL({}): Received syscall {:?}", pid, call);