Run hello_world/power one by one in batch mode.

This commit is contained in:
Yifan Wu 2020-11-20 01:18:25 +08:00
parent bae5383602
commit 2ce04bf19f
10 changed files with 74 additions and 26 deletions

15
os/src/syscall/fs.rs Normal file
View file

@ -0,0 +1,15 @@
const FD_STDOUT: usize = 1;
pub fn sys_write(fd: usize, buf: *const u8, len: usize) -> isize {
match fd {
FD_STDOUT => {
let slice = unsafe { core::slice::from_raw_parts(buf, len) };
let str = core::str::from_utf8(slice).unwrap();
print!("{}", str);
len as isize
},
_ => {
panic!("Unsupported fd in sys_write!");
}
}
}