From 9a8c402cc2c961cb42f57f8c9d9b21f59d9c3cb4 Mon Sep 17 00:00:00 2001 From: bunnie Date: Wed, 14 Oct 2020 23:04:54 +0800 Subject: [PATCH] add hosted mode bits back in --- kernel/src/syscall.rs | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/kernel/src/syscall.rs b/kernel/src/syscall.rs index d16a811b1..bcffeedc3 100644 --- a/kernel/src/syscall.rs +++ b/kernel/src/syscall.rs @@ -300,20 +300,22 @@ fn return_memory(pid: PID, tid: TID, sender: MessageSender, buf: MemoryRange) -> // "KERNEL({}): Unblocking PID {} CTX {}", // pid, client_pid, client_ctx // ); - /* - ss.ready_thread(client_pid, client_tid)?; - ss.switch_to_thread(client_pid, Some(client_tid))?; - ss.set_thread_result(client_pid, client_tid, xous_kernel::Result::Ok)?;*/ + if !cfg!(baremetal) { + ss.ready_thread(client_pid, client_tid)?; + ss.switch_to_thread(client_pid, Some(client_tid))?; + ss.set_thread_result(client_pid, client_tid, xous_kernel::Result::Ok)?; + Ok(xous_kernel::Result::Ok) + } else { + // Switch away from the server, but leave it as Runnable + ss.switch_from_thread(pid, tid)?; + ss.ready_thread(pid, tid)?; + ss.set_thread_result(pid, tid, xous_kernel::Result::Ok)?; - // Switch away from the server, but leave it as Runnable - ss.switch_from_thread(pid, tid)?; - ss.ready_thread(pid, tid)?; - ss.set_thread_result(pid, tid, xous_kernel::Result::Ok)?; - - // Switch to the client - ss.ready_thread(client_pid, client_tid)?; - ss.switch_to_thread(client_pid, Some(client_tid))?; - Ok(xous_kernel::Result::Ok) + // Switch to the client + ss.ready_thread(client_pid, client_tid)?; + ss.switch_to_thread(client_pid, Some(client_tid))?; + Ok(xous_kernel::Result::Ok) + } }) }