Skip to content

Commit 6ca1cfb

Browse files
boot: Add freestanding stall
One minor implementation change from the BootServices version: the Status value is ignored rather than asserting it is `SUCCESS`. There shouldn't be any practical difference, as stalling should always succeed. In the unlikely event that some implementation returns an error, a panic is unlikely to be desirable to the caller.
1 parent d4ae463 commit 6ca1cfb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

uefi/src/boot.rs

+12
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,18 @@ pub unsafe fn exit(
521521
)
522522
}
523523

524+
/// Stalls execution for the given number of microseconds.
525+
pub fn stall(microseconds: usize) {
526+
let bt = boot_services_raw_panicking();
527+
let bt = unsafe { bt.as_ref() };
528+
529+
unsafe {
530+
// No error conditions are defined in the spec for this function, so
531+
// ignore the status.
532+
let _ = (bt.stall)(microseconds);
533+
}
534+
}
535+
524536
/// A buffer returned by [`locate_handle_buffer`] that contains an array of
525537
/// [`Handle`]s that support the requested protocol.
526538
#[derive(Debug, Eq, PartialEq)]

0 commit comments

Comments
 (0)