You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
585 B
Rust
21 lines
585 B
Rust
const SYSCALL_WRITE: usize = 64;
|
|
const SYSCALL_EXIT: usize = 93;
|
|
const SYSCALL_YIELD: usize = 124;
|
|
const SYSCALL_GET_TIME: usize = 169;
|
|
|
|
mod fs;
|
|
mod process;
|
|
|
|
use fs::*;
|
|
use process::*;
|
|
|
|
/// 根据syscall_id 进行分发
|
|
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]),
|
|
SYSCALL_EXIT => sys_exit(args[0] as i32),
|
|
SYSCALL_YIELD => sys_yield(),
|
|
SYSCALL_GET_TIME => sys_get_time(),
|
|
_ => panic!("Unsupported syscall_id: {}", syscall_id),
|
|
}
|
|
} |