Trait hal_core::mem::page::PageFlags

source ·
pub trait PageFlags<S: Size>: Debug {
    // Required methods
    unsafe fn set_writable(&mut self, writable: bool);
    unsafe fn set_executable(&mut self, executable: bool);
    unsafe fn set_present(&mut self, present: bool);
    fn is_writable(&self) -> bool;
    fn is_executable(&self) -> bool;
    fn is_present(&self) -> bool;
    fn commit(&mut self, page: Page<VAddr, S>);
}

Required Methods§

source

unsafe fn set_writable(&mut self, writable: bool)

Set whether or not this page is writable.

Safety

Manual control of page flags can be used to violate Rust invariants. Using set_writable to make memory that the Rust compiler expects to be read-only may cause undefined behavior. Making a page which is aliased page table (i.e. it has multiple page table entries pointing to it) may also cause undefined behavior.

source

unsafe fn set_executable(&mut self, executable: bool)

Set whether or not this page is executable.

Safety

Manual control of page flags can be used to violate Rust invariants. Using set_executable to make writable memory executable may cause undefined behavior. Also, this can be used to execute the contents of arbitrary memory, which (of course) is wildly unsafe.

source

unsafe fn set_present(&mut self, present: bool)

Set whether or not this page is present.

Safety

Manual control of page flags can be used to violate Rust invariants.

source

fn is_writable(&self) -> bool

source

fn is_executable(&self) -> bool

source

fn is_present(&self) -> bool

source

fn commit(&mut self, page: Page<VAddr, S>)

Commit the changes to the page table.

Depending on the CPU architecture, this may be a nop. In other cases, it may invoke special instructions (such as invlpg on x86) or write data to the page table.

If page table changes are reflected as soon as flags are modified, the implementation may do nothing.

Implementors§