tg-rcore-tutorial-user 0.4.10

User-space apps for rCore Tutorial chapters (subset for ch2).
Documentation
#![no_std]
#![no_main]

#[macro_use]
extern crate user_lib;

use user_lib::{get_time, sched_yield};

// 教学目标:
// 通过 `get_time + sched_yield` 组合验证基础计时与让出 CPU 行为。

#[unsafe(no_mangle)]
extern "C" fn main() -> i32 {
    let current_time = get_time();
    assert!(current_time > 0);
    println!("get_time OK! {}", current_time);
    let wait_for = current_time + 3000;
    while get_time() < wait_for {
        sched_yield();
    }
    println!("Test sleep OK!");
    0
}