kernel: fix hosted build

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-06-21 14:24:16 +08:00
parent 1bc84c76ff
commit 86dd38f7fa
6 changed files with 22 additions and 5 deletions

View file

@ -3,6 +3,10 @@
use xous_kernel::{PID, TID};
pub unsafe fn take_isr_return_pair() -> Option<(PID, TID)> {
None
}
pub fn enable_irq(_irq_no: usize) {
unimplemented!()
}

View file

@ -48,6 +48,8 @@ impl MemoryMapping {
) -> Result<(), Error> {
Ok(())
}
pub fn print_map(&self) {}
}
/// Determine whether a virtual address has been mapped

View file

@ -394,6 +394,12 @@ impl Process {
});
Ok(())
}
pub fn print_all_threads(&self) {}
}
impl Thread {}
pub fn current_tid() -> TID {
1
}

View file

@ -163,7 +163,7 @@ pub fn irq(_irq_number: usize, _arg: *mut usize) {
}
fn process_irq_character(b: u8) {
#[cfg(feature = "gdbserver")]
#[cfg(all(feature = "gdbserver", baremetal))]
if gdb_server::handle(b) {
return;
}
@ -259,7 +259,7 @@ fn process_irq_character(b: u8) {
});
println!("{} k total", total_bytes / 1024);
}
#[cfg(feature = "gdbserver")]
#[cfg(all(feature = "gdbserver", baremetal))]
b'g' => {
println!("Starting GDB server -- attach your debugger now");
gdb_server::setup();
@ -268,7 +268,7 @@ fn process_irq_character(b: u8) {
println!("Xous Kernel Debug");
println!("key | command");
println!("--- + -----------------------");
#[cfg(feature = "gdbserver")]
#[cfg(all(feature = "gdbserver", baremetal))]
println!(" g | enter the gdb server");
println!(" m | print MMU page tables of all processes");
println!(" p | print all processes");

View file

@ -107,7 +107,6 @@ 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,
@ -120,6 +119,7 @@ impl MemoryManager {
#[cfg(not(baremetal))]
MEMORY_MANAGER.with(|ss| f(&ss.borrow_mut()))
}
#[cfg(baremetal)]
pub fn init_from_memory(
&mut self,
@ -177,9 +177,9 @@ impl MemoryManager {
/// Print the number of RAM bytes used by the specified process.
/// This does not include memory such as peripherals and CSRs.
#[cfg(baremetal)]
pub fn ram_used_by(&self, pid: PID) -> usize {
let mut owned_bytes = 0;
#[cfg(baremetal)]
unsafe {
for owner in &MEMORY_ALLOCATIONS[0..self.ram_size / PAGE_SIZE] {
if owner == &Some(pid) {

View file

@ -2135,4 +2135,9 @@ impl SystemServices {
}
None
}
#[cfg(not(baremetal))]
pub fn process_name(&self, pid: PID) -> Option<&str> {
None
}
}