From 5eaa3a41b12ceb1bc8108c5882f041ec6e54cd0f Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Mon, 16 Aug 2021 15:01:07 +0800 Subject: [PATCH] kernel: services: fix warnings on hosted mode Signed-off-by: Sean Cross --- kernel/src/services.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/kernel/src/services.rs b/kernel/src/services.rs index 84d43426c..229660bfc 100644 --- a/kernel/src/services.rs +++ b/kernel/src/services.rs @@ -5,7 +5,6 @@ use crate::arch; use crate::arch::mem::MemoryMapping; pub use crate::arch::process::Process as ArchProcess; pub use crate::arch::process::Thread; -use crate::arch::process::EXCEPTION_TID; use xous_kernel::MemoryRange; use core::num::NonZeroU8; @@ -2085,6 +2084,7 @@ impl SystemServices { Ok(parent_pid) } + #[cfg(baremetal)] pub fn suspend_process(&mut self, pid: PID) -> Result<(), xous_kernel::Error> { let (process_state, parent_pid) = { let process = self.get_process_mut(pid)?; @@ -2126,6 +2126,7 @@ impl SystemServices { Ok(()) } + #[cfg(baremetal)] pub fn continue_process(&mut self, pid: PID) -> Result<(), xous_kernel::Error> { let process = self.get_process_mut(pid)?; // let old_state = process.state; @@ -2185,6 +2186,7 @@ impl SystemServices { /// 1. The process does not exist /// 2. The process has no exception handler /// 3. The process is not "Running" or "Ready" + #[cfg(baremetal)] pub fn begin_exception_handler(&mut self, pid: PID) -> Option { let process = self.get_process_mut(pid).ok()?; let handler = process.exception_handler?; @@ -2195,13 +2197,15 @@ impl SystemServices { }; // Activate the current context let mut arch_process = ArchProcess::current(); - arch_process.set_tid(EXCEPTION_TID).ok()?; - // process.current_thread = EXCEPTION_TID; + arch_process + .set_tid(crate::arch::process::EXCEPTION_TID) + .ok()?; Some(handler) } /// Move the current process from an `Exception` state back into a `Running` state /// with the current thread being marked as the given tid. + #[cfg(baremetal)] pub fn finish_exception_handler_and_resume( &mut self, pid: PID, @@ -2256,9 +2260,4 @@ impl SystemServices { } None } - - #[cfg(not(baremetal))] - pub fn process_name(&self, pid: PID) -> Option<&str> { - None - } }