From f6002e839d3a6ba5c0fd4ba37a942e565d62520a Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Wed, 6 Sep 2023 23:16:05 +0200 Subject: [PATCH] Centralize global scheme constructors. --- src/main.rs | 3 +++ src/scheme/mod.rs | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/main.rs b/src/main.rs index b9d15673df..04a561ba1e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -178,6 +178,9 @@ fn kmain(cpu_count: u32, bootstrap: Bootstrap) -> ! { //Initialize the first context, stored in kernel/src/context/mod.rs context::init(); + //Initialize global schemes, such as `acpi:`. + scheme::init_globals(); + let pid = syscall::getpid(); info!("BSP: {:?} {}", pid, cpu_count); info!("Env: {:?}", ::core::str::from_utf8(bootstrap.env)); diff --git a/src/scheme/mod.rs b/src/scheme/mod.rs index 6c515704e2..0e90b99165 100644 --- a/src/scheme/mod.rs +++ b/src/scheme/mod.rs @@ -496,3 +496,12 @@ impl GlobalSchemes { SchemeId::new(self as usize) } } + +#[cold] +pub fn init_globals() { + #[cfg(all(feature = "acpi", any(target_arch = "x86", target_arch = "x86_64")))] + { + AcpiScheme::init(); + } + IrqScheme::init(); +}