From fefede0d672b3ce22d0877752a656ab9fa36689b Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 7 Sep 2025 12:30:33 +0200 Subject: [PATCH] Use cfg!() rather than #[cfg] for controlling self_modifying --- src/arch/x86_64/alternative.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/arch/x86_64/alternative.rs b/src/arch/x86_64/alternative.rs index ee59b30ac4..639540e5b9 100644 --- a/src/arch/x86_64/alternative.rs +++ b/src/arch/x86_64/alternative.rs @@ -125,12 +125,8 @@ pub unsafe fn early_init(bsp: bool) { return; } - #[cfg(feature = "self_modifying")] overwrite(&relocs, enable); - #[cfg(not(feature = "self_modifying"))] - let _ = relocs; - if cfg!(not(feature = "self_modifying")) { assert!( cfg!(not(cpu_feature_auto = "smap")) @@ -143,8 +139,11 @@ pub unsafe fn early_init(bsp: bool) { FEATURES.call_once(|| enable); } -#[cfg(feature = "self_modifying")] unsafe fn overwrite(relocs: &[AltReloc], enable: KcpuFeatures) { + if cfg!(not(feature = "self_modifying")) { + return; + } + log::info!("self-modifying features: {:?}", enable); let mut mapper = KernelMapper::lock();