add #![deny(missing_docs)] AND #![deny(warnings)] in main.rs, and add more comments

This commit is contained in:
Yu Chen 2022-03-25 11:17:40 +08:00
parent 2b53281dd8
commit 745ea760d0
20 changed files with 126 additions and 13 deletions

View file

@ -1,5 +1,8 @@
//! File and filesystem-related syscalls
const FD_STDOUT: usize = 1;
/// write buf of length `len` to a file with `fd`
pub fn sys_write(fd: usize, buf: *const u8, len: usize) -> isize {
match fd {
FD_STDOUT => {

View file

@ -1,3 +1,15 @@
//! Implementation of syscalls
//!
//! The single entry point to all system calls, [`syscall()`], is called
//! whenever userspace wishes to perform a system call using the `ecall`
//! instruction. In this case, the processor raises an 'Environment call from
//! U-mode' exception, which is handled as one of the cases in
//! [`crate::trap::trap_handler`].
//!
//! For clarity, each single syscall is implemented as its own function, named
//! `sys_` then the name of the syscall. You can find functions like this in
//! submodules, and you should also implement syscalls this way.
const SYSCALL_WRITE: usize = 64;
const SYSCALL_EXIT: usize = 93;
const SYSCALL_YIELD: usize = 124;

View file

@ -1,3 +1,4 @@
//! Process management syscalls
use crate::task::{exit_current_and_run_next, suspend_current_and_run_next};
use crate::timer::get_time_ms;