Use cfg!() rather than #[cfg] for controlling self_modifying

This commit is contained in:
bjorn3
2025-09-07 12:30:33 +02:00
parent b5822ac118
commit fefede0d67
+4 -5
View File
@@ -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();