This commit is contained in:
Jack Halford 2018-03-13 15:42:30 +01:00
parent 3dfc440d20
commit 99f0ec0b7d
3 changed files with 4 additions and 8 deletions

View file

@ -35,8 +35,8 @@ pub extern fn kmain(multiboot_info_addr: usize) -> ! {
let boot_info = unsafe { multiboot2::load(multiboot_info_addr) }; let boot_info = unsafe { multiboot2::load(multiboot_info_addr) };
enable_write_protect_bit(); enable_write_protect_bit();
vga::init();
memory::init(&boot_info); memory::init(&boot_info);
vga::init();
use alloc::boxed::Box; use alloc::boxed::Box;
let mut heap_test = Box::new(42); let mut heap_test = Box::new(42);

View file

@ -118,7 +118,7 @@ impl ActivePageTable {
// execute f in the new context // execute f in the new context
f(self); f(self);
// TODO restore recursive mapping to original p2 table // restore recursive mapping to original p2 table
p2_table[1023].set(backup, EntryFlags::PRESENT | EntryFlags::WRITABLE); p2_table[1023].set(backup, EntryFlags::PRESENT | EntryFlags::WRITABLE);
} }
@ -207,12 +207,8 @@ pub fn remap_the_kernel<A>(allocator: &mut A, boot_info: &BootInformation)
}); });
let old_table = active_table.switch(new_table); let old_table = active_table.switch(new_table);
let old_p2_page = Page::containing_address(old_table.p2_frame.start_address());
let old_p2_page = Page::containing_address(
old_table.p2_frame.start_address()
);
active_table.unmap(old_p2_page, allocator); active_table.unmap(old_p2_page, allocator);
active_table active_table
} }

View file

@ -74,6 +74,6 @@ impl FrameAllocator for TinyAllocator {
return; return;
} }
} }
panic!("Tiny allcoator can only hold 1 frame."); panic!("Tiny allocator can only hold 1 frame.");
} }
} }