@@ -264,7 +264,7 @@ pub fn open_protocol_exclusive<P: ProtocolPointer + ?Sized>(
264
264
///
265
265
/// If the image is successfully loaded, a [`Handle`] supporting the
266
266
/// [`LoadedImage`] and [`LoadedImageDevicePath`] protocols is returned. The
267
- /// image can be started with `start_image` and unloaded with
267
+ /// image can be started with [ `start_image`] and unloaded with
268
268
/// [`unload_image`].
269
269
///
270
270
/// # Errors
@@ -335,6 +335,27 @@ pub fn unload_image(image_handle: Handle) -> Result {
335
335
unsafe { ( bt. unload_image ) ( image_handle. as_ptr ( ) ) } . to_result ( )
336
336
}
337
337
338
+ /// Transfers control to a loaded image's entry point.
339
+ ///
340
+ /// # Errors
341
+ ///
342
+ /// * [`Status::INVALID_PARAMETER`]: `image_handle` is not valid, or the image
343
+ /// has already been initialized with `start_image`.
344
+ /// * [`Status::SECURITY_VIOLATION`]: a security policy specifies that the image
345
+ /// should not be started.
346
+ pub fn start_image ( image_handle : Handle ) -> Result {
347
+ let bt = boot_services_raw_panicking ( ) ;
348
+ let bt = unsafe { bt. as_ref ( ) } ;
349
+
350
+ // TODO: implement returning exit data to the caller.
351
+ let mut exit_data_size: usize = 0 ;
352
+ let mut exit_data: * mut u16 = ptr:: null_mut ( ) ;
353
+
354
+ unsafe {
355
+ ( bt. start_image ) ( image_handle. as_ptr ( ) , & mut exit_data_size, & mut exit_data) . to_result ( )
356
+ }
357
+ }
358
+
338
359
/// A buffer returned by [`locate_handle_buffer`] that contains an array of
339
360
/// [`Handle`]s that support the requested protocol.
340
361
#[ derive( Debug , Eq , PartialEq ) ]
0 commit comments