forked from AbleOS/ableos
Erin
105df1bcd6
- Using `pc-keyboard` instead of custom one as it sometimes caused double-faults on keypress
50 lines
1.2 KiB
Rust
50 lines
1.2 KiB
Rust
#![allow(clippy::empty_loop)]
|
|
|
|
use crate::arch::drivers::sysinfo::master;
|
|
use crate::scheduler::SCHEDULER;
|
|
use crate::{
|
|
arch::{init, sloop},
|
|
relib::network::socket::{SimpleSock, Socket},
|
|
scratchpad,
|
|
};
|
|
use crate::{boot_conf::KernelConfig, systeminfo::RELEASE_TYPE};
|
|
use kernel::KERNEL_VERSION;
|
|
use spin::Lazy;
|
|
|
|
// TODO: Change this structure to allow for multiple cores loaded
|
|
pub static KERNEL_CONF: Lazy<KernelConfig> = Lazy::new(KernelConfig::new);
|
|
|
|
/// The main entry point of the kernel
|
|
#[no_mangle]
|
|
pub fn kernel_main() -> ! {
|
|
init::init();
|
|
|
|
if KERNEL_CONF.logging.enabled {
|
|
log::set_max_level(KERNEL_CONF.log_level());
|
|
} else {
|
|
log::set_max_level(log::LevelFilter::Off);
|
|
}
|
|
|
|
x86_64::instructions::interrupts::without_interrupts(|| {
|
|
SCHEDULER.lock().enqueue_spawn(scratchpad);
|
|
});
|
|
|
|
sloop()
|
|
}
|
|
|
|
pub fn cpu_socket_startup() {
|
|
let mut cpu_info_socket = SimpleSock::new();
|
|
cpu_info_socket.register_protocol("CPU_INFO".to_string());
|
|
|
|
// let x = master().unwrap();
|
|
// let _xyz = x.brand_string().unwrap();
|
|
}
|
|
|
|
pub fn log_version_data() {
|
|
info!("{} v{:?}", RELEASE_TYPE, KERNEL_VERSION);
|
|
info!(
|
|
"Brand String: {}",
|
|
master().unwrap().brand_string().unwrap()
|
|
);
|
|
}
|