forked from AbleOS/holey-bytes
Fixed mapping problems
This commit is contained in:
parent
c55e3e82c9
commit
e3dd5ed944
|
@ -64,7 +64,7 @@ impl Memory {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Walk pagetable levels
|
// Walk pagetable levels
|
||||||
for lvl in (lookup_depth..4).rev() {
|
for lvl in (lookup_depth + 1..5).rev() {
|
||||||
let entry = (*current_pt)
|
let entry = (*current_pt)
|
||||||
.table
|
.table
|
||||||
.get_unchecked_mut(addr_extract_index(target, lvl));
|
.get_unchecked_mut(addr_extract_index(target, lvl));
|
||||||
|
@ -114,7 +114,6 @@ impl Memory {
|
||||||
/// just should be ignored.
|
/// just should be ignored.
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
pub fn unmap(&mut self, addr: u64) -> Result<(), NothingToUnmap> {
|
pub fn unmap(&mut self, addr: u64) -> Result<(), NothingToUnmap> {
|
||||||
extern crate std;
|
|
||||||
let mut current_pt = self.root_pt;
|
let mut current_pt = self.root_pt;
|
||||||
let mut page_tables = [core::ptr::null_mut(); 5];
|
let mut page_tables = [core::ptr::null_mut(); 5];
|
||||||
|
|
||||||
|
@ -140,6 +139,7 @@ impl Memory {
|
||||||
// empty permission - no UB here!
|
// empty permission - no UB here!
|
||||||
_ => unsafe {
|
_ => unsafe {
|
||||||
core::ptr::write_bytes(entry, 0, 1);
|
core::ptr::write_bytes(entry, 0, 1);
|
||||||
|
break;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue