2021-11-16 00:09:27 -06:00
|
|
|
#![allow(clippy::empty_loop)]
|
2021-11-28 14:50:14 -06:00
|
|
|
|
2022-02-18 10:04:10 -06:00
|
|
|
// use acpi::AcpiTables;
|
|
|
|
// use x86_64::instructions::interrupts::{disable, enable};
|
2022-02-07 03:42:57 -06:00
|
|
|
|
2022-02-18 10:04:10 -06:00
|
|
|
// use crate::{scratchpad, SCHEDULER, SCREEN_BUFFER};
|
2022-02-08 03:01:29 -06:00
|
|
|
|
2021-12-24 03:30:27 -06:00
|
|
|
use {
|
|
|
|
crate::{
|
2022-01-22 00:01:16 -06:00
|
|
|
arch::{init, sloop},
|
2022-02-04 00:16:06 -06:00
|
|
|
relib::network::socket::{SimpleSock, Socket},
|
2022-02-18 10:04:10 -06:00
|
|
|
scratchpad,
|
2022-02-04 00:16:06 -06:00
|
|
|
},
|
2021-12-24 03:30:27 -06:00
|
|
|
lazy_static::lazy_static,
|
2021-11-16 00:09:27 -06:00
|
|
|
};
|
2022-01-13 08:54:33 -06:00
|
|
|
|
2021-11-16 00:09:27 -06:00
|
|
|
lazy_static! {
|
2022-02-07 21:14:47 -06:00
|
|
|
// TODO: Change this structure to allow for multiple cores loaded
|
2022-03-11 13:51:47 -06:00
|
|
|
pub static ref KERNEL_CONF: KernelConfig = KernelConfig::new();
|
2021-11-16 00:09:27 -06:00
|
|
|
}
|
2021-11-23 06:01:42 -06:00
|
|
|
|
2022-01-26 19:43:03 -06:00
|
|
|
/// The main entry point of the kernel
|
2021-11-16 00:09:27 -06:00
|
|
|
#[no_mangle]
|
2021-11-23 06:01:42 -06:00
|
|
|
pub fn kernel_main() -> ! {
|
2021-11-16 00:09:27 -06:00
|
|
|
init::init();
|
2022-03-11 13:51:47 -06:00
|
|
|
|
|
|
|
if KERNEL_CONF.logging.enabled {
|
|
|
|
log::set_max_level(KERNEL_CONF.log_level());
|
|
|
|
} else {
|
|
|
|
log::set_max_level(log::LevelFilter::Off);
|
|
|
|
}
|
2022-02-07 07:33:40 -06:00
|
|
|
let mut scheduler = SCHEDULER.lock();
|
2022-03-16 05:39:01 -05:00
|
|
|
for proc in &scheduler.execution_queue {
|
|
|
|
trace!("{:?}", proc);
|
2022-02-07 06:38:18 -06:00
|
|
|
}
|
2022-03-16 05:39:01 -05:00
|
|
|
|
2022-02-07 07:33:40 -06:00
|
|
|
drop(scheduler);
|
2022-02-03 13:47:58 -06:00
|
|
|
|
2022-02-18 10:04:10 -06:00
|
|
|
// start_facepalm();
|
2022-03-11 15:14:35 -06:00
|
|
|
scratchpad();
|
2022-02-18 10:04:10 -06:00
|
|
|
|
2021-11-23 05:54:57 -06:00
|
|
|
sloop()
|
2021-11-16 00:09:27 -06:00
|
|
|
}
|
2021-11-23 08:49:41 -06:00
|
|
|
|
2022-01-22 00:01:16 -06: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 06:15:51 -06:00
|
|
|
|
2022-02-18 10:04:10 -06:00
|
|
|
// let x = master().unwrap();
|
|
|
|
// let _xyz = x.brand_string().unwrap();
|
2022-01-18 06:15:51 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn log_version_data() {
|
2022-04-11 13:53:33 -05:00
|
|
|
info!("{} v{:?}", RELEASE_TYPE, KERNEL_VERSION);
|
2022-01-18 06:15:51 -06:00
|
|
|
info!(
|
2022-03-16 05:39:01 -05:00
|
|
|
"Brand String: {}",
|
|
|
|
master().unwrap().brand_string().unwrap()
|
2022-01-18 06:15:51 -06:00
|
|
|
);
|
|
|
|
}
|
2022-02-18 10:04:10 -06:00
|
|
|
|
2022-03-16 05:39:01 -05:00
|
|
|
use crate::info::master;
|
2022-03-11 14:18:07 -06:00
|
|
|
|
|
|
|
use kernel::KERNEL_VERSION;
|
|
|
|
|
2022-03-16 05:39:01 -05:00
|
|
|
use crate::scheduler::SCHEDULER;
|
2022-03-11 15:14:35 -06:00
|
|
|
use crate::{
|
2022-03-16 05:39:01 -05:00
|
|
|
boot_conf::KernelConfig, scheduler::capabilities::FileAccess, systeminfo::RELEASE_TYPE,
|
2022-03-11 15:14:35 -06:00
|
|
|
};
|