Skip to content

Commit 5789318

Browse files
uefi: Remove the implementations of allocator::{init,exit_boot_services}
These are no longer needed and will be deprecated in the following commit.
1 parent a001b5d commit 5789318

File tree

1 file changed

+5
-25
lines changed

1 file changed

+5
-25
lines changed

uefi/src/allocator.rs

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,48 +12,28 @@
1212
//! Failure to do so will turn subsequent allocation into undefined behaviour.
1313
1414
use core::alloc::{GlobalAlloc, Layout};
15-
use core::ffi::c_void;
1615
use core::ptr::{self, NonNull};
17-
use core::sync::atomic::{AtomicPtr, AtomicU32, Ordering};
16+
use core::sync::atomic::{AtomicU32, Ordering};
1817

1918
use crate::boot;
2019
use crate::mem::memory_map::MemoryType;
2120
use crate::proto::loaded_image::LoadedImage;
2221
use crate::table::{Boot, SystemTable};
2322

24-
/// Reference to the system table, used to call the boot services pool memory
25-
/// allocation functions.
26-
///
27-
/// The pointer is only safe to dereference if UEFI boot services have not been
28-
/// exited by the host application yet.
29-
static SYSTEM_TABLE: AtomicPtr<c_void> = AtomicPtr::new(ptr::null_mut());
30-
31-
/// The memory type used for pool memory allocations.
32-
static MEMORY_TYPE: AtomicU32 = AtomicU32::new(MemoryType::LOADER_DATA.0);
33-
3423
/// Initializes the allocator.
3524
///
3625
/// # Safety
3726
///
3827
/// This function is unsafe because you _must_ make sure that exit_boot_services
3928
/// will be called when UEFI boot services will be exited.
40-
pub unsafe fn init(system_table: &mut SystemTable<Boot>) {
41-
SYSTEM_TABLE.store(system_table.as_ptr().cast_mut(), Ordering::Release);
42-
43-
let boot_services = system_table.boot_services();
44-
if let Ok(loaded_image) =
45-
boot::open_protocol_exclusive::<LoadedImage>(boot_services.image_handle())
46-
{
47-
MEMORY_TYPE.store(loaded_image.data_type().0, Ordering::Release);
48-
}
49-
}
29+
#[allow(unused_unsafe)]
30+
pub unsafe fn init(_: &mut SystemTable<Boot>) {}
5031

5132
/// Notify the allocator library that boot services are not safe to call anymore
5233
///
5334
/// You must arrange for this function to be called on exit from UEFI boot services
54-
pub fn exit_boot_services() {
55-
SYSTEM_TABLE.store(ptr::null_mut(), Ordering::Release);
56-
}
35+
#[allow(clippy::missing_const_for_fn)]
36+
pub fn exit_boot_services() {}
5737

5838
/// Get the memory type to use for allocation.
5939
///

0 commit comments

Comments
 (0)