summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-09-14 23:09:18 -0500
committerNathan Ringo <nathan@remexre.com>2024-09-14 23:09:18 -0500
commitfc918ea68d536fa9f219e7b4decdae1f561c9886 (patch)
treee5e57ee80050e6fe59cee5838419a4cac47d5660 /crates
parent22231ec036268ca2adb1f0b0feed0a91ea68728f (diff)
Fix ICE.
Diffstat (limited to 'crates')
-rw-r--r--crates/Cargo.lock3
-rw-r--r--crates/kernel/src/alloc.rs2
-rw-r--r--crates/utils/Cargo.toml1
-rw-r--r--crates/utils/src/lib.rs10
4 files changed, 9 insertions, 7 deletions
diff --git a/crates/Cargo.lock b/crates/Cargo.lock
index f844fc7..41dfbb3 100644
--- a/crates/Cargo.lock
+++ b/crates/Cargo.lock
@@ -413,6 +413,9 @@ dependencies = [
[[package]]
name = "vernos_utils"
version = "0.1.0"
+dependencies = [
+ "spin",
+]
[[package]]
name = "void"
diff --git a/crates/kernel/src/alloc.rs b/crates/kernel/src/alloc.rs
index 690b428..203ef5c 100644
--- a/crates/kernel/src/alloc.rs
+++ b/crates/kernel/src/alloc.rs
@@ -135,10 +135,8 @@ pub fn kernel_map(
let buddy_allocator = buddy_allocator.as_mut().unwrap();
kernel_page_table.map(&mut *buddy_allocator, vaddr, paddr, len, flags)?;
vernos_utils::first_time! {
- {
log::warn!("TODO: sfence.vma");
log::warn!("TODO: TLB shootdown");
- }
}
Ok(())
}
diff --git a/crates/utils/Cargo.toml b/crates/utils/Cargo.toml
index a03aeac..768287c 100644
--- a/crates/utils/Cargo.toml
+++ b/crates/utils/Cargo.toml
@@ -5,3 +5,4 @@ edition = "2021"
publish = false
[dependencies]
+spin = { version = "0.9.8", default-features = false, features = ["lazy"] }
diff --git a/crates/utils/src/lib.rs b/crates/utils/src/lib.rs
index c6681d9..1e8ddfb 100644
--- a/crates/utils/src/lib.rs
+++ b/crates/utils/src/lib.rs
@@ -134,11 +134,11 @@ impl_FromEndianBytes!(i8, i16, i32, i64, isize, u8, u16, u32, u64, usize);
/// Runs the body block the first time it is encountered.
#[macro_export]
macro_rules! first_time {
- ($($stmt:stmt);*) => {{
- use core::cell::LazyCell;
- static LAZY_CELL = LazyCell::new(|| {
- $($stmt);*
+ ($($stmt:stmt)*) => {{
+ use spin::lazy::Lazy;
+ static LAZY: Lazy<()> = Lazy::new(|| {
+ $($stmt)*
});
- let _: &() = core::cell::LazyCell::force(&LAZY_CELL);
+ *Lazy::force(&LAZY)
}};
}