Skip to content

Commit 49d1bd5

Browse files
committed
libxernel: Bump libxernel crate to rust edition 2024
1 parent 562ed60 commit 49d1bd5

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

crates/libxernel/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "libxernel"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

crates/libxernel/src/sync/spin.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use core::{
55
sync::atomic::{AtomicBool, Ordering},
66
};
77

8-
use crate::{
9-
ipl::{raise_ipl, splx, IPL},
10-
on_drop::OnDrop,
11-
};
8+
use crate::on_drop::OnDrop;
9+
10+
#[cfg(feature = "kernel")]
11+
use crate::ipl::{raise_ipl, splx, IPL};
1212

1313
/// Simple data locking structure using a spin loop.
1414
///
@@ -80,12 +80,14 @@ impl<T: ?Sized> Spinlock<T> {
8080
function(&mut *lock)
8181
}
8282

83+
#[cfg(feature = "kernel")]
8384
pub fn aquire(&self) -> OnDrop<SpinlockGuard<'_, T>, impl FnOnce()> {
8485
let ipl = raise_ipl(IPL::DPC);
8586
let callback = move || splx(ipl);
8687
OnDrop::new(self.lock(), callback)
8788
}
8889

90+
#[cfg(feature = "kernel")]
8991
pub fn aquire_at(&self, ipl: IPL) -> OnDrop<SpinlockGuard<'_, T>, impl FnOnce()> {
9092
let ipl = raise_ipl(ipl);
9193
let callback = move || splx(ipl);
@@ -133,6 +135,7 @@ impl<T: ?Sized> DerefMut for SpinlockGuard<'_, T> {
133135
}
134136

135137
#[inline]
138+
#[cfg(feature = "kernel")]
136139
fn write_cr8(ipl: IPL) {
137140
unsafe {
138141
asm!("mov cr8, {}", in(reg) ipl as u64, options(nomem, nostack, preserves_flags));

0 commit comments

Comments
 (0)