Skip to content

Commit 4ec91ab

Browse files
Add BootServices::exit method; Make PointerMode's fields public for checking against support of a pointer device (#261)
1 parent b1416ad commit 4ec91ab

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

src/proto/console/pointer/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ impl<'boot> Pointer<'boot> {
6161
#[derive(Debug, Copy, Clone)]
6262
#[repr(C)]
6363
pub struct PointerMode {
64-
// The pointer device's resolution on the X/Y/Z axis in counts/mm.
65-
// If a value is 0, then the device does _not_ support that axis.
66-
resolution: (u64, u64, u64),
64+
/// The pointer device's resolution on the X/Y/Z axis in counts/mm.
65+
/// If a value is 0, then the device does _not_ support that axis.
66+
pub resolution: (u64, u64, u64),
6767
/// Whether the devices has a left button / right button.
68-
has_button: (bool, bool),
68+
pub has_button: (bool, bool),
6969
}
7070

7171
/// The relative change in the pointer's state.

src/table/boot.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ pub struct BootServices {
9696
exit_data_size: *mut usize,
9797
exit_data: &mut *mut Char16,
9898
) -> Status,
99-
exit: usize,
99+
exit: extern "efiapi" fn(
100+
image_handle: Handle,
101+
exit_status: Status,
102+
exit_data_size: usize,
103+
exit_data: *mut Char16,
104+
) -> !,
100105
unload_image: extern "efiapi" fn(image_handle: Handle) -> Status,
101106
exit_boot_services:
102107
unsafe extern "efiapi" fn(image_handle: Handle, map_key: MemoryMapKey) -> Status,
@@ -485,6 +490,25 @@ impl BootServices {
485490
}
486491
}
487492

493+
/// Exits the UEFI application and returns control to the UEFI component
494+
/// that started the UEFI application.
495+
///
496+
/// # Safety
497+
///
498+
/// This function is unsafe because it is up to the caller to ensure that
499+
/// all resources allocated by the application is freed before invoking
500+
/// exit and returning control to the UEFI component that started the UEFI
501+
/// application.
502+
pub unsafe fn exit(
503+
&self,
504+
image_handle: Handle,
505+
exit_status: Status,
506+
exit_data_size: usize,
507+
exit_data: *mut Char16,
508+
) -> ! {
509+
(self.exit)(image_handle, exit_status, exit_data_size, exit_data)
510+
}
511+
488512
/// Exits the UEFI boot services
489513
///
490514
/// This unsafe method is meant to be an implementation detail of the safe

0 commit comments

Comments
 (0)