Skip to content

Commit 5189347

Browse files
boot: Add freestanding version of unload_image
1 parent a4135b1 commit 5189347

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

uefi/src/boot.rs

+13
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,19 @@ pub fn load_image(parent_image_handle: Handle, source: LoadImageSource) -> Resul
319319
}
320320
}
321321

322+
/// Unloads a UEFI image.
323+
///
324+
/// # Errors
325+
///
326+
/// * [`Status::UNSUPPORTED`]: the image has been started, and does not support unload.
327+
/// * [`Status::INVALID_PARAMETER`]: `image_handle` is not valid.
328+
pub fn unload_image(image_handle: Handle) -> Result {
329+
let bt = boot_services_raw_panicking();
330+
let bt = unsafe { bt.as_ref() };
331+
332+
unsafe { (bt.unload_image)(image_handle.as_ptr()) }.to_result()
333+
}
334+
322335
/// A buffer returned by [`locate_handle_buffer`] that contains an array of
323336
/// [`Handle`]s that support the requested protocol.
324337
#[derive(Debug, Eq, PartialEq)]

0 commit comments

Comments
 (0)