diff --git a/uefi/src/boot.rs b/uefi/src/boot.rs index b6abf4a10..0f36a3e02 100644 --- a/uefi/src/boot.rs +++ b/uefi/src/boot.rs @@ -44,6 +44,12 @@ use uefi_raw::table::boot::InterfaceType; #[cfg(feature = "alloc")] use {alloc::vec::Vec, uefi::ResultExt}; +/// Size in bytes of a UEFI page. +/// +/// Note that this is not necessarily the processor's page size. The UEFI page +/// size is always 4 KiB. +pub const PAGE_SIZE: usize = 4096; + /// Global image handle. This is only set by [`set_image_handle`], and it is /// only read by [`image_handle`]. static IMAGE_HANDLE: AtomicPtr = AtomicPtr::new(ptr::null_mut()); diff --git a/uefi/src/proto/security/memory_protection.rs b/uefi/src/proto/security/memory_protection.rs index fa94452d2..36842adf7 100644 --- a/uefi/src/proto/security/memory_protection.rs +++ b/uefi/src/proto/security/memory_protection.rs @@ -29,7 +29,7 @@ impl MemoryProtection { /// [`EXECUTE_PROTECT`]: MemoryAttribute::EXECUTE_PROTECT /// [`READ_ONLY`]: MemoryAttribute::READ_ONLY /// [`Status::NO_MAPPING`]: crate::Status::NO_MAPPING - /// [UEFI page size]: uefi::table::boot::PAGE_SIZE + /// [UEFI page size]: crate::boot::PAGE_SIZE pub fn get_memory_attributes( &self, byte_region: Range, @@ -53,7 +53,7 @@ impl MemoryProtection { /// [`READ_PROTECT`]: MemoryAttribute::READ_PROTECT /// [`EXECUTE_PROTECT`]: MemoryAttribute::EXECUTE_PROTECT /// [`READ_ONLY`]: MemoryAttribute::READ_ONLY - /// [UEFI page size]: uefi::table::boot::PAGE_SIZE + /// [UEFI page size]: crate::boot::PAGE_SIZE pub fn set_memory_attributes( &self, byte_region: Range, @@ -76,7 +76,7 @@ impl MemoryProtection { /// [`READ_PROTECT`]: MemoryAttribute::READ_PROTECT /// [`EXECUTE_PROTECT`]: MemoryAttribute::EXECUTE_PROTECT /// [`READ_ONLY`]: MemoryAttribute::READ_ONLY - /// [UEFI page size]: uefi::table::boot::PAGE_SIZE + /// [UEFI page size]: crate::boot::PAGE_SIZE pub fn clear_memory_attributes( &self, byte_region: Range, diff --git a/uefi/src/table/boot.rs b/uefi/src/table/boot.rs index 69635d685..3c8b36d03 100644 --- a/uefi/src/table/boot.rs +++ b/uefi/src/table/boot.rs @@ -4,7 +4,7 @@ pub use crate::boot::{ AllocateType, EventNotifyFn, LoadImageSource, OpenProtocolAttributes, OpenProtocolParams, - ProtocolSearchKey, SearchType, TimerTrigger, + ProtocolSearchKey, SearchType, TimerTrigger, PAGE_SIZE, }; pub use uefi_raw::table::boot::{ EventType, InterfaceType, MemoryAttribute, MemoryDescriptor, MemoryType, Tpl, @@ -29,12 +29,6 @@ use core::ops::{Deref, DerefMut}; use core::ptr::NonNull; use core::{ptr, slice}; -/// Size in bytes of a UEFI page. -/// -/// Note that this is not necessarily the processor's page size. The UEFI page -/// size is always 4 KiB. -pub const PAGE_SIZE: usize = 4096; - /// Contains pointers to all of the boot services. /// /// # Accessing `BootServices`