diff --git a/kernel/src/fs/stdio.rs b/kernel/src/fs/stdio.rs index 11a342e..6a73c28 100644 --- a/kernel/src/fs/stdio.rs +++ b/kernel/src/fs/stdio.rs @@ -29,7 +29,14 @@ impl Stdin { return c; } } - #[cfg(not(feature = "board_k210"))] + #[cfg(feature = "board_rocket_chip")] + loop { + let c = crate::arch::io::getchar(); + if c != '\0' && c as u8 != 254 { + return c; + } + } + #[cfg(not(any(feature = "board_k210", feature = "board_rocket_chip")))] loop { let mut buf_lock = self.buf.lock(); match buf_lock.pop_front() { @@ -41,7 +48,12 @@ impl Stdin { } } pub fn can_read(&self) -> bool { - self.buf.lock().len() > 0 + // Currently, rocket-chip implementation rely on htif interface, the serial interrupt DO + // NOT work, so return true always + #[cfg(feature = "board_rocket_chip")] + return true; + #[cfg(not(feature = "board_rocket_chip"))] + return self.buf.lock().len() > 0; } } diff --git a/kernel/src/shell.rs b/kernel/src/shell.rs index 7e8822b..45274c8 100644 --- a/kernel/src/shell.rs +++ b/kernel/src/shell.rs @@ -4,6 +4,7 @@ use crate::fs::ROOT_INODE; use crate::process::*; use alloc::string::String; use alloc::vec::Vec; +use crate::arch::io; #[cfg(not(feature = "run_cmdline"))] pub fn add_user_shell() { @@ -44,6 +45,7 @@ pub fn add_user_shell() { let inode = ROOT_INODE.lookup(&cmdline).unwrap(); processor().manager().add(Thread::new_user( &inode, + "/busybox", cmdline.split(' ').map(|s| s.into()).collect(), Vec::new(), )); diff --git a/tools/addr2line.py b/tools/addr2line.py old mode 100644 new mode 100755