mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
kernel: clean up most warnings
Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
b61f1518d0
commit
a947d7fd79
5 changed files with 10 additions and 38 deletions
|
|
@ -3,7 +3,7 @@ use core::fmt;
|
||||||
use riscv::register::satp;
|
use riscv::register::satp;
|
||||||
use xous::{MemoryFlags, PID};
|
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_HEAP_BASE: usize = 0x2000_0000;
|
||||||
pub const DEFAULT_MESSAGE_BASE: usize = 0x4000_0000;
|
pub const DEFAULT_MESSAGE_BASE: usize = 0x4000_0000;
|
||||||
pub const DEFAULT_BASE: usize = 0x6000_0000;
|
pub const DEFAULT_BASE: usize = 0x6000_0000;
|
||||||
|
|
|
||||||
|
|
@ -46,12 +46,6 @@ impl Process {
|
||||||
&mut self.contexts[self.context_nr - 1]
|
&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.
|
/// Set the current context number.
|
||||||
pub fn set_context_nr(&mut self, context: CtxID) {
|
pub fn set_context_nr(&mut self, context: CtxID) {
|
||||||
assert!(
|
assert!(
|
||||||
|
|
@ -125,18 +119,6 @@ impl Process {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProcessContext {
|
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
|
/// The current stack pointer for this context
|
||||||
pub fn stack_pointer(&self) -> usize {
|
pub fn stack_pointer(&self) -> usize {
|
||||||
self.registers[1]
|
self.registers[1]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
use crate::args::KernelArguments;
|
use crate::args::KernelArguments;
|
||||||
use crate::services::SystemServicesHandle;
|
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
use core::slice;
|
use core::slice;
|
||||||
|
|
|
||||||
|
|
@ -211,8 +211,8 @@ impl Server {
|
||||||
msg.offset.map(|x| x.get()).unwrap_or(0) as usize,
|
msg.offset.map(|x| x.get()).unwrap_or(0) as usize,
|
||||||
msg.valid.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::MutableBorrow(_msg) => unimplemented!(),
|
||||||
xous::Message::ImmutableBorrow(msg) => unimplemented!(),
|
xous::Message::ImmutableBorrow(_msg) => unimplemented!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
self.queue_head += 1;
|
self.queue_head += 1;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ use xous::{CtxID, MemoryFlags, MemoryType, MessageEnvelope, CID, PID, SID};
|
||||||
const MAX_PROCESS_COUNT: usize = 32;
|
const MAX_PROCESS_COUNT: usize = 32;
|
||||||
const MAX_SERVER_COUNT: usize = 32;
|
const MAX_SERVER_COUNT: usize = 32;
|
||||||
const DEFAULT_STACK_SIZE: usize = 131072;
|
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.
|
/// This is the address a program will jump to in order to return from an ISR.
|
||||||
pub const RETURN_FROM_ISR: usize = 0xff80_2000;
|
pub const RETURN_FROM_ISR: usize = 0xff80_2000;
|
||||||
|
|
@ -133,10 +133,6 @@ impl Process {
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn current_context_nr(&self) -> usize {
|
|
||||||
self.current_context as usize
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
@ -168,10 +164,10 @@ pub struct SystemServices {
|
||||||
servers: [Option<Server>; MAX_SERVER_COUNT],
|
servers: [Option<Server>; MAX_SERVER_COUNT],
|
||||||
|
|
||||||
/// A log of the currently-active syscall depth
|
/// 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
|
/// How many entries there are on the syscall stack
|
||||||
syscall_depth: usize,
|
_syscall_depth: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
static mut SYSTEM_SERVICES: SystemServices = SystemServices {
|
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
|
// Note we can't use MAX_SERVER_COUNT here because of how Rust's
|
||||||
// macro tokenization works
|
// macro tokenization works
|
||||||
servers: filled_array![None; 32],
|
servers: filled_array![None; 32],
|
||||||
syscall_stack: [(0, 0), (0, 0), (0, 0)],
|
_syscall_stack: [(0, 0), (0, 0), (0, 0)],
|
||||||
syscall_depth: 0,
|
_syscall_depth: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
impl core::fmt::Debug for Process {
|
impl core::fmt::Debug for Process {
|
||||||
|
|
@ -670,7 +666,7 @@ impl SystemServices {
|
||||||
dest_pid: PID,
|
dest_pid: PID,
|
||||||
len: usize,
|
len: usize,
|
||||||
writable: bool,
|
writable: bool,
|
||||||
borrow: bool,
|
_borrow: bool,
|
||||||
) -> Result<usize, xous::Error> {
|
) -> Result<usize, xous::Error> {
|
||||||
let current_pid = self.current_pid();
|
let current_pid = self.current_pid();
|
||||||
let phys = {
|
let phys = {
|
||||||
|
|
@ -792,7 +788,7 @@ impl SystemServices {
|
||||||
};
|
};
|
||||||
Server::init(entry, pid, sid, addr, size).or_else(|x| {
|
Server::init(entry, pid, sid, addr, size).or_else(|x| {
|
||||||
let mut mm = MemoryManagerHandle::get();
|
let mut mm = MemoryManagerHandle::get();
|
||||||
mm.unmap_page(addr);
|
mm.unmap_page(addr)?;
|
||||||
Err(x)
|
Err(x)
|
||||||
})?;
|
})?;
|
||||||
return Ok(sid);
|
return Ok(sid);
|
||||||
|
|
@ -838,11 +834,6 @@ impl SystemServices {
|
||||||
Err(xous::Error::OutOfMemory)
|
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
|
/// Return a server based on the connection id and the current process
|
||||||
pub fn server_from_sidx(&mut self, sidx: usize) -> Option<&mut Server> {
|
pub fn server_from_sidx(&mut self, sidx: usize) -> Option<&mut Server> {
|
||||||
if sidx > self.servers.len() {
|
if sidx > self.servers.len() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue