Skip to content

Commit 2aeaf0a

Browse files
boot: Add freestanding install_configuration_table
1 parent c684367 commit 2aeaf0a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

uefi/src/boot.rs

+26
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,32 @@ pub unsafe fn exit(
724724
)
725725
}
726726

727+
/// Adds, updates, or removes a configuration table entry
728+
/// from the EFI System Table.
729+
///
730+
/// # Safety
731+
///
732+
/// When installing or updating a configuration table, the data pointed to by
733+
/// `table_ptr` must be a pool allocation of type
734+
/// [`RUNTIME_SERVICES_DATA`]. Once this table has been installed, the caller
735+
/// should not modify or free the data.
736+
///
737+
/// [`RUNTIME_SERVICES_DATA`]: MemoryType::RUNTIME_SERVICES_DATA
738+
///
739+
/// # Errors
740+
///
741+
/// * [`Status::NOT_FOUND`]: tried to delete a nonexistent entry.
742+
/// * [`Status::OUT_OF_RESOURCES`]: out of memory.
743+
pub unsafe fn install_configuration_table(
744+
guid_entry: &'static Guid,
745+
table_ptr: *const c_void,
746+
) -> Result {
747+
let bt = boot_services_raw_panicking();
748+
let bt = unsafe { bt.as_ref() };
749+
750+
(bt.install_configuration_table)(guid_entry, table_ptr).to_result()
751+
}
752+
727753
/// Stalls execution for the given number of microseconds.
728754
pub fn stall(microseconds: usize) {
729755
let bt = boot_services_raw_panicking();

0 commit comments

Comments
 (0)