@ -1,10 +1,7 @@
#![no_std]
#![no_main]
#[macro_use]
extern crate user_lib;
use user_lib::yield_;
use user_lib::{syscall::*, *};
const WIDTH: usize = 10;
const HEIGHT: usize = 5;
@ -16,7 +13,7 @@ fn main() -> i32 {
print!("A");
}
println!(" [{}/{}]", i + 1, HEIGHT);
yield_();
sys_yield();
println!("Test write_a OK!");
0
const HEIGHT: usize = 2;
print!("B");
println!("Test write_b OK!");
const HEIGHT: usize = 3;
print!("C");
println!("Test write_c OK!");
@ -2,6 +2,7 @@ use core::arch::asm;
const SYSCALL_WRITE: usize = 64;
const SYSCALL_EXIT: usize = 93;
const SYSCALL_YIELD: usize = 124;
fn syscall(id: usize, args: [usize; 3]) -> isize {
@ -28,3 +29,7 @@ pub fn sys_exit(exit_code: i32) -> isize {
syscall(SYSCALL_EXIT, [exit_code as usize, 0, 0])
pub fn sys_yield() {
syscall(SYSCALL_YIELD, [0, 0, 0]);