kernel: fix hosted build/warnings

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-05-20 11:52:03 +08:00
parent 09b8242bb2
commit e616a4bf4f
6 changed files with 22 additions and 22 deletions

View file

@ -280,7 +280,7 @@ fn handle_connection(
chn.send(ThreadMessage::SysCall(
pid,
1,
xous_kernel::SysCall::TerminateProcess,
xous_kernel::SysCall::TerminateProcess(0),
))
.unwrap();
}
@ -542,7 +542,7 @@ pub fn idle() -> bool {
// If the call being made is to terminate the current process, we need to know
// because we won't be able to send a response.
let is_terminate = call == SysCall::TerminateProcess;
let is_terminate = call == SysCall::TerminateProcess(0);
let is_shutdown = call == SysCall::Shutdown;
// For a "Shutdown" command, send the response before we issue the shutdown.
@ -562,7 +562,7 @@ pub fn idle() -> bool {
"Unable to send response to process: {:?} -- terminating",
_e
);
crate::syscall::handle(pid, thread_id, false, SysCall::TerminateProcess)
crate::syscall::handle(pid, thread_id, false, SysCall::TerminateProcess(0))
.ok();
});
// println!("KERNEL: Done sending");
@ -604,7 +604,7 @@ pub fn idle() -> bool {
"KERNEL({}): Unable to send response to process: {:?} -- terminating",
pid, _e
);
crate::syscall::handle(pid, thread_id, false, SysCall::TerminateProcess)
crate::syscall::handle(pid, thread_id, false, SysCall::TerminateProcess(0))
.ok();
});
crate::arch::process::set_current_pid(existing_pid);

View file

@ -4,7 +4,11 @@
use xous_kernel::{PID, TID};
pub fn enable_irq(_irq_no: usize) {
unimplemented!();
unimplemented!()
}
pub fn disable_irq(_irq_no: usize) -> Result<(), xous_kernel::Error> {
unimplemented!()
}
pub unsafe fn set_isr_return_pair(_pid: PID, _ctx: TID) {

View file

@ -100,10 +100,6 @@ pub fn return_page_inner(
unimplemented!()
}
pub fn ensure_page_exists_inner(address: usize) -> Result<usize, xous_kernel::Error> {
unimplemented!()
}
pub fn unmap_page_inner(_mm: &mut MemoryManager, virt: usize) -> Result<usize, Error> {
Ok(virt)
}

View file

@ -2,9 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
use core::fmt;
use core::slice;
pub use crate::arch::mem::{page_is_lent, MemoryMapping, PAGE_SIZE};
pub use crate::arch::mem::{MemoryMapping, PAGE_SIZE};
use crate::arch::process::Process;
use xous_kernel::{MemoryFlags, MemoryRange, PID};
@ -108,6 +107,7 @@ impl MemoryManager {
MEMORY_MANAGER.with(|ss| f(&mut ss.borrow_mut()))
}
#[cfg(baremetal)]
pub fn with<F, R>(f: F) -> R
where
F: FnOnce(&MemoryManager) -> R,
@ -126,6 +126,7 @@ impl MemoryManager {
base: *mut u32,
args: &crate::args::KernelArguments,
) -> Result<(), xous_kernel::Error> {
use core::slice;
let mut args_iter = args.iter();
let xarg_def = args_iter.next().expect("mm: no kernel arguments found");
unsafe {
@ -189,11 +190,6 @@ impl MemoryManager {
owned_bytes
}
#[cfg(not(baremetal))]
pub fn ram_used_by(&self, _pid: PID) -> usize {
0
}
#[cfg(all(baremetal, feature = "print-debug"))]
pub fn print_ownership(&self) {
println!("Ownership ({} bytes in all):", unsafe {
@ -588,6 +584,7 @@ impl MemoryManager {
)
}
#[cfg(baremetal)]
pub fn ensure_page_exists(&mut self, address: usize) -> Result<(), xous_kernel::Error> {
crate::arch::mem::ensure_page_exists_inner(address).and(Ok(()))
}
@ -695,6 +692,7 @@ impl MemoryManager {
}
/// Convert an offset in the `MEMORY_ALLOCATIONS` array into a physical address.
#[cfg(baremetal)]
fn allocation_offset_to_address(&self, offset: usize) -> Option<usize> {
// If the offset is within the RAM size, simply turn it into
// an address.
@ -727,13 +725,14 @@ impl MemoryManager {
/// memory from the process, it only marks it as free.
/// This is very unsafe because the memory can immediately be re-allocated
/// to another process, so only call this as part of destroying a process.
pub unsafe fn release_all_memory_for_process(&mut self, pid: PID) {
pub unsafe fn release_all_memory_for_process(&mut self, _pid: PID) {
#[cfg(baremetal)]
for (idx, owner) in MEMORY_ALLOCATIONS.iter_mut().enumerate() {
// If this address has been allocated to this process, consider
// freeing it or reparenting it.
if owner == &mut Some(pid) {
if owner == &mut Some(_pid) {
let phys_addr = self.allocation_offset_to_address(idx).unwrap();
if page_is_lent(phys_addr as *mut u8) {
if crate::arch::mem::page_is_lent(phys_addr as *mut u8) {
// If the page is lent, reparent it to PID 1 so it will
// get freed when it is returned.
*owner = PID::new(1);

View file

@ -1882,6 +1882,7 @@ impl SystemServices {
}
/// Returns the process name, if any, of a given PID
#[cfg(baremetal)]
pub fn process_name(&self, pid: PID) -> Option<&str> {
let args = crate::args::KernelArguments::get();
for arg in args.iter() {

View file

@ -275,7 +275,7 @@ fn return_memory(
}
let result = server.take_waiting_message(sender.idx, Some(&buf))?;
klog!("waiting message was: {:?}", result);
let (client_pid, client_tid, server_addr, client_addr, len) = match result {
let (client_pid, client_tid, _server_addr, client_addr, len) = match result {
WaitingMessage::BorrowedMemory(
client_pid,
client_ctx,
@ -318,14 +318,14 @@ fn return_memory(
// "KERNEL({}): Returning {} bytes from {:08x} in PID {} to {:08x} in PID {} in context {}",
// pid,
// len,
// server_addr.get(),
// _server_addr.get(),
// pid,
// client_addr.get(),
// client_pid,
// client_tid
// );
#[cfg(baremetal)]
let src_virt = server_addr.get() as _;
let src_virt = _server_addr.get() as _;
#[cfg(not(baremetal))]
let src_virt = buf.addr.get() as _;