diff --git a/kernel/src/arch/riscv/mem.rs b/kernel/src/arch/riscv/mem.rs index 9a76f782b..9ab82b456 100644 --- a/kernel/src/arch/riscv/mem.rs +++ b/kernel/src/arch/riscv/mem.rs @@ -3,7 +3,7 @@ use core::fmt; use riscv::register::satp; use xous::{MemoryFlags, PID}; -pub const DEFAULT_STACK_TOP: usize = 0x8000_0000; +// pub const DEFAULT_STACK_TOP: usize = 0x8000_0000; pub const DEFAULT_HEAP_BASE: usize = 0x2000_0000; pub const DEFAULT_MESSAGE_BASE: usize = 0x4000_0000; pub const DEFAULT_BASE: usize = 0x6000_0000; diff --git a/kernel/src/arch/riscv/process.rs b/kernel/src/arch/riscv/process.rs index 002f5d6f4..1c9384f30 100644 --- a/kernel/src/arch/riscv/process.rs +++ b/kernel/src/arch/riscv/process.rs @@ -46,12 +46,6 @@ impl Process { &mut self.contexts[self.context_nr - 1] } - /// Return the current context number. Context numbers are 0-indexed. - pub fn current_context_nr(&self) -> CtxID { - assert!(self.context_nr != 0, "context number was 0"); - self.context_nr - } - /// Set the current context number. pub fn set_context_nr(&mut self, context: CtxID) { assert!( @@ -125,18 +119,6 @@ impl Process { } impl ProcessContext { - /// Determine whether a process context is valid. - /// Contexts are valid when they have a place to return to -- - /// i.e. `SEPC` is nonzero - pub fn valid(&self) -> bool { - self.sepc != 0 - } - - /// Invalidate a context by removing its return address - pub fn invalidate(&mut self) { - self.sepc = 0; - } - /// The current stack pointer for this context pub fn stack_pointer(&self) -> usize { self.registers[1] diff --git a/kernel/src/mem.rs b/kernel/src/mem.rs index a781c043b..7db7b6016 100644 --- a/kernel/src/mem.rs +++ b/kernel/src/mem.rs @@ -1,5 +1,4 @@ use crate::args::KernelArguments; -use crate::services::SystemServicesHandle; use core::fmt; use core::mem; use core::slice; diff --git a/kernel/src/server.rs b/kernel/src/server.rs index 204c7304a..d30fa476d 100644 --- a/kernel/src/server.rs +++ b/kernel/src/server.rs @@ -211,8 +211,8 @@ impl Server { msg.offset.map(|x| x.get()).unwrap_or(0) as usize, msg.valid.map(|x| x.get()).unwrap_or(0) as usize, ), - xous::Message::MutableBorrow(msg) => unimplemented!(), - xous::Message::ImmutableBorrow(msg) => unimplemented!(), + xous::Message::MutableBorrow(_msg) => unimplemented!(), + xous::Message::ImmutableBorrow(_msg) => unimplemented!(), }; self.queue_head += 1; diff --git a/kernel/src/services.rs b/kernel/src/services.rs index 2ea656bba..dba63e02f 100644 --- a/kernel/src/services.rs +++ b/kernel/src/services.rs @@ -12,7 +12,7 @@ use xous::{CtxID, MemoryFlags, MemoryType, MessageEnvelope, CID, PID, SID}; const MAX_PROCESS_COUNT: usize = 32; const MAX_SERVER_COUNT: usize = 32; const DEFAULT_STACK_SIZE: usize = 131072; -pub use crate::arch::mem::DEFAULT_STACK_TOP; +// pub use crate::arch::mem::DEFAULT_STACK_TOP; /// This is the address a program will jump to in order to return from an ISR. pub const RETURN_FROM_ISR: usize = 0xff80_2000; @@ -133,10 +133,6 @@ impl Process { _ => false, } } - - pub fn current_context_nr(&self) -> usize { - self.current_context as usize - } } #[repr(C)] @@ -168,10 +164,10 @@ pub struct SystemServices { servers: [Option; MAX_SERVER_COUNT], /// A log of the currently-active syscall depth - syscall_stack: [(usize, usize); 3], + _syscall_stack: [(usize, usize); 3], /// How many entries there are on the syscall stack - syscall_depth: usize, + _syscall_depth: usize, } static mut SYSTEM_SERVICES: SystemServices = SystemServices { @@ -186,8 +182,8 @@ static mut SYSTEM_SERVICES: SystemServices = SystemServices { // Note we can't use MAX_SERVER_COUNT here because of how Rust's // macro tokenization works servers: filled_array![None; 32], - syscall_stack: [(0, 0), (0, 0), (0, 0)], - syscall_depth: 0, + _syscall_stack: [(0, 0), (0, 0), (0, 0)], + _syscall_depth: 0, }; impl core::fmt::Debug for Process { @@ -670,7 +666,7 @@ impl SystemServices { dest_pid: PID, len: usize, writable: bool, - borrow: bool, + _borrow: bool, ) -> Result { let current_pid = self.current_pid(); let phys = { @@ -792,7 +788,7 @@ impl SystemServices { }; Server::init(entry, pid, sid, addr, size).or_else(|x| { let mut mm = MemoryManagerHandle::get(); - mm.unmap_page(addr); + mm.unmap_page(addr)?; Err(x) })?; return Ok(sid); @@ -838,11 +834,6 @@ impl SystemServices { Err(xous::Error::OutOfMemory) } - /// Return a server based on the connection id and the current process - pub fn server_from_cid(&mut self, cid: CID) -> Option<&mut Server> { - self.servers[self.sidx_from_cid(cid)?].as_mut() - } - /// Return a server based on the connection id and the current process pub fn server_from_sidx(&mut self, sidx: usize) -> Option<&mut Server> { if sidx > self.servers.len() {