Skip to content

Commit

Permalink
fix deallocate page table
Browse files Browse the repository at this point in the history
  • Loading branch information
0x6D70 committed Jan 25, 2024
1 parent 430dc39 commit 708386f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xernel/kernel/src/mem/paging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ impl Pagemap {
fn deallocate_pt(pt: *mut PageTable, level: u8) {
let mut frame_allocator = FRAME_ALLOCATOR.lock();
if level == 4 {
for i in 0..128 {
for i in 0..256 {
unsafe {
if (*pt)[i].flags().contains(PageTableFlags::PRESENT) {
let pt = ((*pt)[i].addr().as_u64() + *HIGHER_HALF_OFFSET) as *mut PageTable;
Expand All @@ -348,7 +348,7 @@ impl Pagemap {
);
}
} else if level > 1 {
for i in 0..256 {
for i in 0..512 {
unsafe {
if (*pt)[i].flags().contains(PageTableFlags::PRESENT) {
let pt = ((*pt)[i].addr().as_u64() + *HIGHER_HALF_OFFSET) as *mut PageTable;
Expand Down

0 comments on commit 708386f

Please sign in to comment.