From 741224411b68042b804f979ec308f07cbc6e066a Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Mon, 28 Jan 2019 11:24:16 +0100 Subject: [PATCH] Use the BootInfo struct passed by the bootloader --- src/main.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 35708d85..d7edbde3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,11 +3,13 @@ #![cfg_attr(test, allow(unused_imports))] use blog_os::println; +use bootloader::{bootinfo::BootInfo, entry_point}; use core::panic::PanicInfo; +entry_point!(kernel_main); + #[cfg(not(test))] -#[no_mangle] -pub extern "C" fn _start() -> ! { +fn kernel_main(boot_info: &'static BootInfo) -> ! { use blog_os::interrupts::PICS; use blog_os::memory::{self, create_example_mapping, EmptyFrameAllocator}; @@ -18,8 +20,7 @@ pub extern "C" fn _start() -> ! { unsafe { PICS.lock().initialize() }; x86_64::instructions::interrupts::enable(); - const LEVEL_4_TABLE_ADDR: usize = 0o_177777_777_777_777_777_0000; - let mut recursive_page_table = unsafe { memory::init(LEVEL_4_TABLE_ADDR) }; + let mut recursive_page_table = unsafe { memory::init(boot_info.p4_table_addr as usize) }; create_example_mapping(&mut recursive_page_table, &mut EmptyFrameAllocator); unsafe { (0xdeadbeaf900 as *mut u64).write_volatile(0xf021f077f065f04e) };