Struct zfi::BootServices

source ·
#[repr(C)]
pub struct BootServices { /* private fields */ }
Expand description

Represents an EFI_BOOT_SERVICES.

Implementations§

source§

impl BootServices

source

pub fn allocate_pages( &self, at: AllocateType, mt: MemoryType, pages: usize, addr: u64 ) -> Result<Pages, Status>

Allocates memory pages from the system.

source

pub unsafe fn free_pages( &self, base: *mut u8, pages: usize ) -> Result<(), Status>

Safety

base must be allocated with [allocate_pages()].

source

pub fn get_memory_map(&self) -> Result<(Vec<MemoryDescriptor>, usize), Status>

Returns the current memory map. A common mistake when using this method to get a key to invoke [exit_boot_services()] is discarding the result, which will cause the vector to drop and memory map will be changed.

source

pub fn allocate_pool( &self, ty: MemoryType, size: usize ) -> Result<*mut u8, Status>

All allocations are eight-byte aligned.

source

pub unsafe fn free_pool(&self, mem: *mut u8) -> Result<(), Status>

Safety

mem must be allocated by [allocate_pool()].

source

pub fn locate_device_path<'a>( &self, proto: &Guid, path: &'a Path ) -> Result<(&'static Device, &'a Path), Status>

Locates the handle to a device on the device path that supports the specified protocol.

source

pub unsafe fn exit_boot_services(&self, map_key: usize) -> Result<(), Status>

Terminates all boot services.

Safety

Once this method is returned any functions provided by ZFI will not be usable. Beware of any functions that are automatically called by Rust (e.g. when the value is dropped)! Usually this method will be called right before transfering the control to the OS kernel.

source

pub unsafe fn get_protocol( &self, handle: *const (), proto: &Guid ) -> Option<*const ()>

Safety

This method don’t check anything so the caller is responsible to make sure all arguments is valid for EFI_BOOT_SERVICES.OpenProtocol().

source

pub unsafe fn open_protocol( &self, handle: *const (), proto: &Guid, agent: *const (), controller: *const (), attrs: OpenProtocolAttributes ) -> Result<*const (), Status>

Safety

This method don’t check anything so the caller is responsible to make sure all arguments is valid for EFI_BOOT_SERVICES.OpenProtocol().

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.