feat: entry: done

This commit is contained in:
Paul Pan 2024-06-16 23:36:42 +08:00
parent 92801fccdc
commit 2ec3859da7

View File

@ -3,6 +3,7 @@ use crate::plat::console::{set_console, ConsoleDevice, ConsoleDriver, CONSOLE};
use crate::plat::lowlevel::{Hardware, LowLevel};
use crate::plat::timer::{Timer, TimerOps};
use crate::plat::trap::{Trap, TrapOps};
use crate::root::setup_root_server;
use crate::scheduler::{IDLE_THREAD, SCHEDULER};
use core::cell::Cell;
use core::sync::atomic::{AtomicUsize, Ordering};
@ -31,33 +32,16 @@ pub fn rust_main() -> ! {
crate::test_main();
}
// TODO: setup and start scheduler
// --- some dummy tests ---
Trap::init();
Timer::init();
SCHEDULER.init();
SCHEDULER.add(&IDLE_THREAD);
setup_root_server(&fdt);
SCHEDULER.schedule();
loop {
let data = CONSOLE.lock().try_read();
match data {
Some(ch) => {
debug!("Key: {}", ch as char);
if ch == b'q' {
break;
}
},
None => continue,
}
}
// --- end ---
error!("[rust_main] Should not reach here! Maybe scheduler is not working?");
Hardware::shutdown(true);
}