Update docs

This commit is contained in:
田凯夫 2022-03-14 16:37:10 +08:00 committed by dramforever
parent 493fba58fe
commit e60ef5a67a
7 changed files with 36 additions and 2 deletions

View file

@ -9,6 +9,7 @@ mod process;
use fs::*;
use process::*;
/// handle syscall exception with `syscall_id` and other arguments
pub fn syscall(syscall_id: usize, args: [usize; 3]) -> isize {
match syscall_id {
SYSCALL_WRITE => sys_write(args[0], args[1] as *const u8, args[2]),

View file

@ -1,17 +1,20 @@
use crate::task::{exit_current_and_run_next, suspend_current_and_run_next};
use crate::timer::get_time_ms;
/// task exits and submit an exit code
pub fn sys_exit(exit_code: i32) -> ! {
println!("[kernel] Application exited with code {}", exit_code);
exit_current_and_run_next();
panic!("Unreachable in sys_exit!");
}
/// current task gives up resources for other tasks
pub fn sys_yield() -> isize {
suspend_current_and_run_next();
0
}
/// get time in milliseconds
pub fn sys_get_time() -> isize {
get_time_ms() as isize
}