mirror of
https://github.com/panpaul/tiny_os
synced 2024-09-20 09:45:19 +08:00
feat: entry: done
This commit is contained in:
parent
92801fccdc
commit
2ec3859da7
@ -3,6 +3,7 @@ use crate::plat::console::{set_console, ConsoleDevice, ConsoleDriver, CONSOLE};
|
|||||||
use crate::plat::lowlevel::{Hardware, LowLevel};
|
use crate::plat::lowlevel::{Hardware, LowLevel};
|
||||||
use crate::plat::timer::{Timer, TimerOps};
|
use crate::plat::timer::{Timer, TimerOps};
|
||||||
use crate::plat::trap::{Trap, TrapOps};
|
use crate::plat::trap::{Trap, TrapOps};
|
||||||
|
use crate::root::setup_root_server;
|
||||||
use crate::scheduler::{IDLE_THREAD, SCHEDULER};
|
use crate::scheduler::{IDLE_THREAD, SCHEDULER};
|
||||||
use core::cell::Cell;
|
use core::cell::Cell;
|
||||||
use core::sync::atomic::{AtomicUsize, Ordering};
|
use core::sync::atomic::{AtomicUsize, Ordering};
|
||||||
@ -31,33 +32,16 @@ pub fn rust_main() -> ! {
|
|||||||
crate::test_main();
|
crate::test_main();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: setup and start scheduler
|
|
||||||
|
|
||||||
// --- some dummy tests ---
|
|
||||||
|
|
||||||
Trap::init();
|
Trap::init();
|
||||||
Timer::init();
|
Timer::init();
|
||||||
|
|
||||||
SCHEDULER.init();
|
SCHEDULER.init();
|
||||||
SCHEDULER.add(&IDLE_THREAD);
|
SCHEDULER.add(&IDLE_THREAD);
|
||||||
|
|
||||||
|
setup_root_server(&fdt);
|
||||||
|
|
||||||
SCHEDULER.schedule();
|
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?");
|
error!("[rust_main] Should not reach here! Maybe scheduler is not working?");
|
||||||
Hardware::shutdown(true);
|
Hardware::shutdown(true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user