Struct uefi::proto::security::MemoryProtection
source · pub struct MemoryProtection(/* private fields */);
Expand description
Protocol for getting and setting memory protection attributes.
Corresponds to the C type EFI_MEMORY_ATTRIBUTE_PROTOCOL
.
Implementations§
source§impl MemoryProtection
impl MemoryProtection
sourcepub fn get_memory_attributes(
&self,
byte_region: Range<PhysicalAddress>
) -> Result<MemoryAttribute>
pub fn get_memory_attributes( &self, byte_region: Range<PhysicalAddress> ) -> Result<MemoryAttribute>
Get the attributes of a memory region.
The attribute mask this returns will only contain bits in the
set of READ_PROTECT
, EXECUTE_PROTECT
, and READ_ONLY
.
If the attributes are not consistent within the region,
Status::NO_MAPPING
is returned.
Implementations typically require that the start and end of the memory region are aligned to the UEFI page size.
sourcepub fn set_memory_attributes(
&self,
byte_region: Range<PhysicalAddress>,
attributes: MemoryAttribute
) -> Result
pub fn set_memory_attributes( &self, byte_region: Range<PhysicalAddress>, attributes: MemoryAttribute ) -> Result
Set the attributes of a memory region.
The valid attributes to set are READ_PROTECT
,
EXECUTE_PROTECT
, and READ_ONLY
.
Implementations typically require that the start and end of the memory region are aligned to the UEFI page size.
sourcepub fn clear_memory_attributes(
&self,
byte_region: Range<PhysicalAddress>,
attributes: MemoryAttribute
) -> Result
pub fn clear_memory_attributes( &self, byte_region: Range<PhysicalAddress>, attributes: MemoryAttribute ) -> Result
Clear the attributes of a memory region.
The valid attributes to clear are READ_PROTECT
,
EXECUTE_PROTECT
, and READ_ONLY
.
Implementations typically require that the start and end of the memory region are aligned to the UEFI page size.