ableos/ableos/src/kmain.rs

55 lines
1.3 KiB
Rust
Raw Normal View History

2021-11-16 06:09:27 +00:00
#![allow(clippy::empty_loop)]
2021-11-28 20:50:14 +00:00
use crate::arch::drivers::sysinfo::master;
2022-04-11 22:23:11 +00:00
use crate::scheduler::SCHEDULER;
use crate::{
arch::{init, sloop},
relib::network::socket::{SimpleSock, Socket},
scratchpad,
2021-11-16 06:09:27 +00:00
};
2022-04-11 22:23:11 +00:00
use crate::{boot_conf::KernelConfig, systeminfo::RELEASE_TYPE};
use kernel::KERNEL_VERSION;
use spin::Lazy;
2022-01-13 14:54:33 +00:00
// TODO: Change this structure to allow for multiple cores loaded
pub static KERNEL_CONF: Lazy<KernelConfig> = Lazy::new(KernelConfig::new);
2021-11-23 12:01:42 +00:00
/// The main entry point of the kernel
2021-11-16 06:09:27 +00:00
#[no_mangle]
2021-11-23 12:01:42 +00:00
pub fn kernel_main() -> ! {
2021-11-16 06:09:27 +00:00
init::init();
if KERNEL_CONF.logging.enabled {
log::set_max_level(KERNEL_CONF.log_level());
} else {
log::set_max_level(log::LevelFilter::Off);
}
let scheduler = SCHEDULER.lock();
for proc in &scheduler.execution_queue {
trace!("{:?}", proc);
2022-02-07 12:38:18 +00:00
}
2022-02-07 13:33:40 +00:00
drop(scheduler);
2022-02-03 19:47:58 +00:00
2022-02-18 16:04:10 +00:00
// start_facepalm();
2022-03-11 21:14:35 +00:00
scratchpad();
2022-02-18 16:04:10 +00:00
sloop()
2021-11-16 06:09:27 +00:00
}
2021-11-23 14:49:41 +00:00
2022-01-22 06:01:16 +00:00
pub fn cpu_socket_startup() {
let mut cpu_info_socket = SimpleSock::new();
cpu_info_socket.register_protocol("CPU_INFO".to_string());
2022-01-18 12:15:51 +00:00
2022-02-18 16:04:10 +00:00
// let x = master().unwrap();
// let _xyz = x.brand_string().unwrap();
2022-01-18 12:15:51 +00:00
}
pub fn log_version_data() {
2022-04-11 18:53:33 +00:00
info!("{} v{:?}", RELEASE_TYPE, KERNEL_VERSION);
2022-01-18 12:15:51 +00:00
info!(
"Brand String: {}",
master().unwrap().brand_string().unwrap()
2022-01-18 12:15:51 +00:00
);
}