kernel: services: fix warnings on hosted mode

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-08-16 15:01:07 +08:00
parent 90d1c7a4b8
commit 5eaa3a41b1

View file

@ -5,7 +5,6 @@ use crate::arch;
use crate::arch::mem::MemoryMapping; use crate::arch::mem::MemoryMapping;
pub use crate::arch::process::Process as ArchProcess; pub use crate::arch::process::Process as ArchProcess;
pub use crate::arch::process::Thread; pub use crate::arch::process::Thread;
use crate::arch::process::EXCEPTION_TID;
use xous_kernel::MemoryRange; use xous_kernel::MemoryRange;
use core::num::NonZeroU8; use core::num::NonZeroU8;
@ -2085,6 +2084,7 @@ impl SystemServices {
Ok(parent_pid) Ok(parent_pid)
} }
#[cfg(baremetal)]
pub fn suspend_process(&mut self, pid: PID) -> Result<(), xous_kernel::Error> { pub fn suspend_process(&mut self, pid: PID) -> Result<(), xous_kernel::Error> {
let (process_state, parent_pid) = { let (process_state, parent_pid) = {
let process = self.get_process_mut(pid)?; let process = self.get_process_mut(pid)?;
@ -2126,6 +2126,7 @@ impl SystemServices {
Ok(()) Ok(())
} }
#[cfg(baremetal)]
pub fn continue_process(&mut self, pid: PID) -> Result<(), xous_kernel::Error> { pub fn continue_process(&mut self, pid: PID) -> Result<(), xous_kernel::Error> {
let process = self.get_process_mut(pid)?; let process = self.get_process_mut(pid)?;
// let old_state = process.state; // let old_state = process.state;
@ -2185,6 +2186,7 @@ impl SystemServices {
/// 1. The process does not exist /// 1. The process does not exist
/// 2. The process has no exception handler /// 2. The process has no exception handler
/// 3. The process is not "Running" or "Ready" /// 3. The process is not "Running" or "Ready"
#[cfg(baremetal)]
pub fn begin_exception_handler(&mut self, pid: PID) -> Option<ExceptionHandler> { pub fn begin_exception_handler(&mut self, pid: PID) -> Option<ExceptionHandler> {
let process = self.get_process_mut(pid).ok()?; let process = self.get_process_mut(pid).ok()?;
let handler = process.exception_handler?; let handler = process.exception_handler?;
@ -2195,13 +2197,15 @@ impl SystemServices {
}; };
// Activate the current context // Activate the current context
let mut arch_process = ArchProcess::current(); let mut arch_process = ArchProcess::current();
arch_process.set_tid(EXCEPTION_TID).ok()?; arch_process
// process.current_thread = EXCEPTION_TID; .set_tid(crate::arch::process::EXCEPTION_TID)
.ok()?;
Some(handler) Some(handler)
} }
/// Move the current process from an `Exception` state back into a `Running` state /// Move the current process from an `Exception` state back into a `Running` state
/// with the current thread being marked as the given tid. /// with the current thread being marked as the given tid.
#[cfg(baremetal)]
pub fn finish_exception_handler_and_resume( pub fn finish_exception_handler_and_resume(
&mut self, &mut self,
pid: PID, pid: PID,
@ -2256,9 +2260,4 @@ impl SystemServices {
} }
None None
} }
#[cfg(not(baremetal))]
pub fn process_name(&self, pid: PID) -> Option<&str> {
None
}
} }