|
|
@ -83,7 +83,6 @@ pub struct MemoryAttr {
|
|
|
|
readonly: bool,
|
|
|
|
readonly: bool,
|
|
|
|
execute: bool,
|
|
|
|
execute: bool,
|
|
|
|
mmio: bool,
|
|
|
|
mmio: bool,
|
|
|
|
hide: bool,
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl MemoryAttr {
|
|
|
|
impl MemoryAttr {
|
|
|
@ -116,26 +115,18 @@ impl MemoryAttr {
|
|
|
|
self
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
** @brief set the memory attribute's hide bit
|
|
|
|
|
|
|
|
** @retval MemoryAttr the memory attribute itself
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
pub fn hide(mut self) -> Self {
|
|
|
|
|
|
|
|
self.hide = true;
|
|
|
|
|
|
|
|
self
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
** @brief apply the memory attribute to a page table entry
|
|
|
|
** @brief apply the memory attribute to a page table entry
|
|
|
|
** @param entry: &mut impl Entry
|
|
|
|
** @param entry: &mut impl Entry
|
|
|
|
** the page table entry to apply the attribute
|
|
|
|
** the page table entry to apply the attribute
|
|
|
|
** @retval none
|
|
|
|
** @retval none
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
fn apply(&self, entry: &mut Entry) {
|
|
|
|
pub fn apply(&self, entry: &mut Entry) {
|
|
|
|
if self.user { entry.set_user(true); }
|
|
|
|
entry.set_present(true);
|
|
|
|
if self.readonly { entry.set_writable(false); }
|
|
|
|
entry.set_user(self.user);
|
|
|
|
if self.execute { entry.set_execute(true); }
|
|
|
|
entry.set_writable(!self.readonly);
|
|
|
|
if self.mmio { entry.set_mmio(true); }
|
|
|
|
entry.set_execute(self.execute);
|
|
|
|
if self.hide { entry.set_present(false); }
|
|
|
|
entry.set_mmio(self.mmio);
|
|
|
|
if self.user || self.readonly || self.execute || self.mmio || self.hide { entry.update(); }
|
|
|
|
entry.update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|