kernel: fix remaining warnings

This fixes all remaining warnings in the kernel. For now.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2020-08-30 01:17:35 +08:00
parent bd851923cc
commit 96c5739cdd
5 changed files with 31 additions and 30 deletions

View file

@ -12,10 +12,6 @@ pub fn enable_irq(_irq_no: usize) {
unimplemented!(); unimplemented!();
} }
pub fn disable_irq(_irq_no: usize) -> Result<(), xous_kernel::Error> {
Err(xous_kernel::Error::UnhandledSyscall)
}
pub unsafe fn take_isr_return_pair() -> Option<(PID, TID)> { pub unsafe fn take_isr_return_pair() -> Option<(PID, TID)> {
unimplemented!() unimplemented!()
} }

View file

@ -237,7 +237,7 @@ impl Process {
/// Initialize this process thread with the given entrypoint and stack /// Initialize this process thread with the given entrypoint and stack
/// addresses. /// addresses.
pub fn setup_process(pid: PID, thread_init: ThreadInit) { pub fn setup_process(pid: PID, thread_init: ThreadInit) -> Result<(), xous_kernel::Error> {
let mut process = unsafe { &mut *PROCESS }; let mut process = unsafe { &mut *PROCESS };
let tid = INITIAL_TID; let tid = INITIAL_TID;
@ -313,6 +313,7 @@ impl Process {
.expect("couldn't reserve stack") .expect("couldn't reserve stack")
}); });
} }
Ok(())
} }
pub fn setup_thread(&mut self, new_tid: TID, setup: ThreadInit) -> Result<(), xous_kernel::Error> { pub fn setup_thread(&mut self, new_tid: TID, setup: ThreadInit) -> Result<(), xous_kernel::Error> {

View file

@ -22,13 +22,12 @@ pub struct KernelArgumentsIterator {
offset: usize, offset: usize,
} }
#[allow(dead_code)]
impl KernelArguments { impl KernelArguments {
#[allow(dead_code)]
pub fn get() -> Self { pub fn get() -> Self {
KernelArguments { base: unsafe { KERNEL_ARGUMENTS_BASE } } KernelArguments { base: unsafe { KERNEL_ARGUMENTS_BASE } }
} }
#[allow(dead_code)]
pub unsafe fn init(base: *const u32) { pub unsafe fn init(base: *const u32) {
KERNEL_ARGUMENTS_BASE = base; KERNEL_ARGUMENTS_BASE = base;
} }

View file

@ -46,7 +46,9 @@ impl fmt::Display for MemoryRangeExtra {
pub struct MemoryManager { pub struct MemoryManager {
ram_start: usize, ram_start: usize,
ram_size: usize, ram_size: usize,
#[allow(dead_code)]
ram_name: u32, ram_name: u32,
#[allow(dead_code)]
last_ram_page: usize, last_ram_page: usize,
} }

View file

@ -43,6 +43,7 @@ pub enum ProcessState {
/// This is a brand-new process that hasn't been run yet, and needs its /// This is a brand-new process that hasn't been run yet, and needs its
/// initial context set up. /// initial context set up.
#[allow(dead_code)]
Setup(ThreadInit), Setup(ThreadInit),
/// This process is able to be run. The context bitmask describes contexts /// This process is able to be run. The context bitmask describes contexts
@ -322,7 +323,7 @@ impl SystemServices {
// Set up our handle with a bogus sp and pc. These will get updated // Set up our handle with a bogus sp and pc. These will get updated
// once a context switch _away_ from the kernel occurs, however we need // once a context switch _away_ from the kernel occurs, however we need
// to make sure other fields such as "thread number" are all valid. // to make sure other fields such as "thread number" are all valid.
ArchProcess::setup_process(PID::new(1).unwrap(), ThreadInit::default()); ArchProcess::setup_process(PID::new(1).unwrap(), ThreadInit::default()).expect("couldn't setup process");
} }
/// Add a new entry to the process table. This results in a new address space /// Add a new entry to the process table. This results in a new address space
@ -446,16 +447,16 @@ impl SystemServices {
Ok(()) Ok(())
} }
#[cfg(not(baremetal))] // #[cfg(not(baremetal))]
pub fn make_callback_to( // pub fn make_callback_to(
&mut self, // &mut self,
_pid: PID, // _pid: PID,
_pc: *const usize, // _pc: *const usize,
_irq_no: usize, // _irq_no: usize,
_arg: *mut usize, // _arg: *mut usize,
) -> Result<(), xous_kernel::Error> { // ) -> Result<(), xous_kernel::Error> {
Err(xous_kernel::Error::UnhandledSyscall) // Err(xous_kernel::Error::UnhandledSyscall)
} // }
/// Create a stack frame in the specified process and jump to it. /// Create a stack frame in the specified process and jump to it.
/// 1. Pause the current process and switch to the new one /// 1. Pause the current process and switch to the new one
@ -854,7 +855,8 @@ impl SystemServices {
new.state = match new.state { new.state = match new.state {
ProcessState::Setup(thread_init) => { ProcessState::Setup(thread_init) => {
println!("Setting up new process..."); println!("Setting up new process...");
ArchProcess::setup_process(new_pid, thread_init); ArchProcess::setup_process(new_pid, thread_init)
.expect("couldn't set up new process");
ProcessState::Running(0) ProcessState::Running(0)
} }
@ -899,16 +901,16 @@ impl SystemServices {
previous_pid, other previous_pid, other
), ),
}; };
// if advance_thread { // if advance_thread {
// previous.current_thread += 1; // previous.current_thread += 1;
// if previous.current_thread as TID > arch::process::MAX_CONTEXT { // if previous.current_thread as TID > arch::process::MAX_CONTEXT {
// previous.current_thread = 0; // previous.current_thread = 0;
// } // }
// } // }
// println!( // println!(
// "Set previous process PID {} state to {:?} (with can_resume = {})", // "Set previous process PID {} state to {:?} (with can_resume = {})",
// previous_pid, previous.state, can_resume // previous_pid, previous.state, can_resume
// ); // );
} else { } else {
// if self.current_thread(previous_pid) == new_tid { // if self.current_thread(previous_pid) == new_tid {
// if !can_resume { // if !can_resume {
@ -1367,7 +1369,8 @@ impl SystemServices {
for (server_idx, server) in self.servers.iter().enumerate() { for (server_idx, server) in self.servers.iter().enumerate() {
if let Some(allocated_server) = server { if let Some(allocated_server) = server {
if allocated_server.sid == sid { if allocated_server.sid == sid {
process_inner.connection_map[slot_idx] = Some(NonZeroU8::new((server_idx as u8) + 2).unwrap()); process_inner.connection_map[slot_idx] =
Some(NonZeroU8::new((server_idx as u8) + 2).unwrap());
// println!( // println!(
// "KERNEL({}): New connection to {:?}. After connection, process connection map is: {:?}", // "KERNEL({}): New connection to {:?}. After connection, process connection map is: {:?}",
// _pid.get(), // _pid.get(),