Skip to content

Commit 8519ada

Browse files
committed
memory_encryption: missing documentation
1 parent 1560047 commit 8519ada

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/structures/mem_encrypt.rs

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ pub(crate) static ENC_BIT_MASK: AtomicU64 = AtomicU64::new(0);
1717
/// than encrypted)
1818
static ENC_BIT_REVERSED: AtomicBool = AtomicBool::new(false);
1919

20+
/// Defines the configuration for memory encryption
21+
#[derive(Debug)]
2022
pub enum MemoryEncryptionConfiguration {
2123
/// Defines that a memory page should be accessed encrypted if this bit of its physical address
2224
/// is set in the page table entry.
@@ -33,6 +35,10 @@ pub enum MemoryEncryptionConfiguration {
3335

3436
/// Enable memory encryption by defining the physical address bit that is used to mark a page
3537
/// encrypted (or shared) in a page table entry
38+
///
39+
/// # Safety
40+
/// Caller must make sure that any existing page table entry is discarded or adapted to take this
41+
/// bit into consideration
3642
pub unsafe fn enable_memory_encryption(configuration: MemoryEncryptionConfiguration) {
3743
let (bit_position, reversed) = match configuration {
3844
MemoryEncryptionConfiguration::EncryptBit(pos) => (pos as u64, false),

0 commit comments

Comments
 (0)