Skip to content

Commit

Permalink
Check page table bounds
Browse files Browse the repository at this point in the history
Signed-off-by: Marcus Weiner <[email protected]>
  • Loading branch information
mraerino committed Sep 10, 2023
1 parent 9c52cb5 commit f072d8f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions riscv64/src/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ impl PageTable {
}

pub fn dump_entry(&self, at: u16) -> PageTableEntry {
assert!(at < 512, "index out of range: page tables always have 512 entries");
let addr = self.addr + (at as u64 * Self::ENTRY_SIZE);
let val = unsafe { read_volatile(addr as *const u64) };
val.into()
Expand Down

0 comments on commit f072d8f

Please sign in to comment.