42 lines
1.2 KiB
Rust
42 lines
1.2 KiB
Rust
// Copyright (c) 2025 shibedrill
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
use crate::format;
|
|
use crate::memory::alloc::string::String;
|
|
use crate::{LOGGER, LogLevel, log_trace};
|
|
use lazy_static::lazy_static;
|
|
use limine::request::*;
|
|
|
|
#[used]
|
|
#[unsafe(link_section = ".requests")]
|
|
pub static FILE_REQUEST: ExecutableFileRequest = limine::request::ExecutableFileRequest::new();
|
|
|
|
#[used]
|
|
#[unsafe(link_section = ".requests")]
|
|
pub static MODULE_REQUEST: ModulesRequest = limine::request::ModulesRequest::new();
|
|
|
|
#[used]
|
|
#[unsafe(link_section = ".requests")]
|
|
pub static IOMMU_REQUEST: KeepIommuRequest = limine::request::KeepIommuRequest::new();
|
|
|
|
lazy_static! {
|
|
pub static ref MODULE_RESPONSE: Option<&'static ModulesResponse> = MODULE_REQUEST.response();
|
|
}
|
|
|
|
pub fn log_modules() {
|
|
if let Some(modules) = *MODULE_RESPONSE {
|
|
if !modules.modules().is_empty() {
|
|
let mut log_msg: String = String::from("Kernel modules list:\n");
|
|
for module in modules.modules() {
|
|
log_msg.push_str(&format!(
|
|
"\t{}",
|
|
String::from_utf8_lossy(module.path().as_bytes())
|
|
));
|
|
}
|
|
log_trace!("{log_msg}")
|
|
}
|
|
} else {
|
|
log_trace!("No modules found.");
|
|
}
|
|
}
|