Add sys_yield tests and compile them to different location.

This commit is contained in:
Yifan Wu 2020-11-28 16:22:29 +08:00
parent 1414d05325
commit 4e8059e222
12 changed files with 99 additions and 57 deletions

View file

@ -2,6 +2,8 @@ pub const STDOUT: usize = 1;
const SYSCALL_WRITE: usize = 64;
const SYSCALL_EXIT: usize = 93;
const SYSCALL_YIELD: usize = 124;
const SYSCALL_GET_TIME: usize = 169;
fn syscall(id: usize, args: [usize; 3]) -> isize {
let mut ret: isize;
@ -23,3 +25,11 @@ pub fn sys_write(fd: usize, buffer: &[u8]) -> isize {
pub fn sys_exit(xstate: i32) -> isize {
syscall(SYSCALL_EXIT, [xstate as usize, 0, 0])
}
pub fn sys_yield() -> isize {
syscall(SYSCALL_YIELD, [0, 0, 0])
}
pub fn sys_get_time() -> isize {
syscall(SYSCALL_GET_TIME, [0, 0, 0])
}