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!();
}
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)> {
unimplemented!()
}

View file

@ -237,7 +237,7 @@ impl Process {
/// Initialize this process thread with the given entrypoint and stack
/// 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 tid = INITIAL_TID;
@ -313,6 +313,7 @@ impl Process {
.expect("couldn't reserve stack")
});
}
Ok(())
}
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,
}
#[allow(dead_code)]
impl KernelArguments {
#[allow(dead_code)]
pub fn get() -> Self {
KernelArguments { base: unsafe { KERNEL_ARGUMENTS_BASE } }
}
#[allow(dead_code)]
pub unsafe fn init(base: *const u32) {
KERNEL_ARGUMENTS_BASE = base;
}

View file

@ -46,7 +46,9 @@ impl fmt::Display for MemoryRangeExtra {
pub struct MemoryManager {
ram_start: usize,
ram_size: usize,
#[allow(dead_code)]
ram_name: u32,
#[allow(dead_code)]
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
/// initial context set up.
#[allow(dead_code)]
Setup(ThreadInit),
/// 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
// once a context switch _away_ from the kernel occurs, however we need
// 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
@ -446,16 +447,16 @@ impl SystemServices {
Ok(())
}
#[cfg(not(baremetal))]
pub fn make_callback_to(
&mut self,
_pid: PID,
_pc: *const usize,
_irq_no: usize,
_arg: *mut usize,
) -> Result<(), xous_kernel::Error> {
Err(xous_kernel::Error::UnhandledSyscall)
}
// #[cfg(not(baremetal))]
// pub fn make_callback_to(
// &mut self,
// _pid: PID,
// _pc: *const usize,
// _irq_no: usize,
// _arg: *mut usize,
// ) -> Result<(), xous_kernel::Error> {
// Err(xous_kernel::Error::UnhandledSyscall)
// }
/// Create a stack frame in the specified process and jump to it.
/// 1. Pause the current process and switch to the new one
@ -854,7 +855,8 @@ impl SystemServices {
new.state = match new.state {
ProcessState::Setup(thread_init) => {
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)
}
@ -899,16 +901,16 @@ impl SystemServices {
previous_pid, other
),
};
// if advance_thread {
// previous.current_thread += 1;
// if previous.current_thread as TID > arch::process::MAX_CONTEXT {
// previous.current_thread = 0;
// }
// }
// println!(
// "Set previous process PID {} state to {:?} (with can_resume = {})",
// previous_pid, previous.state, can_resume
// );
// if advance_thread {
// previous.current_thread += 1;
// if previous.current_thread as TID > arch::process::MAX_CONTEXT {
// previous.current_thread = 0;
// }
// }
// println!(
// "Set previous process PID {} state to {:?} (with can_resume = {})",
// previous_pid, previous.state, can_resume
// );
} else {
// if self.current_thread(previous_pid) == new_tid {
// if !can_resume {
@ -1367,7 +1369,8 @@ impl SystemServices {
for (server_idx, server) in self.servers.iter().enumerate() {
if let Some(allocated_server) = server {
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!(
// "KERNEL({}): New connection to {:?}. After connection, process connection map is: {:?}",
// _pid.get(),