1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-25 09:26:17 +04:00

Merge pull request #46 from Jackey-Huo/dev

HTIF interface read enabled for rocket-chip
This commit is contained in:
Chen 2019-05-03 14:09:12 +08:00 committed by GitHub
commit 2a4747abaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View File

@ -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;
}
}

View File

@ -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(),
));

0
tools/addr2line.py Normal file → Executable file
View File