Wrap syscalls in user_lib && change xstate to exit_code

This commit is contained in:
Yifan Wu 2021-01-06 00:09:52 +08:00
parent 923abbbc96
commit 15ea8d934a
5 changed files with 19 additions and 14 deletions

View file

@ -1,11 +1,13 @@
use core::fmt::{self, Write};
use crate::syscall::{STDOUT, sys_write};
use super::write;
struct Stdout;
const STDOUT: usize = 1;
impl Write for Stdout {
fn write_str(&mut self, s: &str) -> fmt::Result {
sys_write(STDOUT, s.as_bytes());
write(STDOUT, s.as_bytes());
Ok(())
}
}