Reset code to post-09 branch for new 'Paging Implementation' post

This commit is contained in:
Philipp Oppermann
2019-03-14 10:20:46 +01:00
parent 90f0caec1a
commit ef1cc0ed4f
4 changed files with 12 additions and 94 deletions

View File

@@ -3,15 +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))]
fn kernel_main(boot_info: &'static BootInfo) -> ! {
#[no_mangle]
pub extern "C" fn _start() -> ! {
use blog_os::interrupts::PICS;
use blog_os::memory::{self, create_example_mapping};
use x86_64::registers::control::Cr3;
println!("Hello World{}", "!");
@@ -20,11 +18,11 @@ fn kernel_main(boot_info: &'static BootInfo) -> ! {
unsafe { PICS.lock().initialize() };
x86_64::instructions::interrupts::enable();
let mut recursive_page_table = unsafe { memory::init(boot_info.p4_table_addr as usize) };
let mut frame_allocator = memory::init_frame_allocator(&boot_info.memory_map);
create_example_mapping(&mut recursive_page_table, &mut frame_allocator);
unsafe { (0xdeadbeaf900 as *mut u64).write_volatile(0xf021f077f065f04e) };
let (level_4_page_table, _) = Cr3::read();
println!(
"Level 4 page table at: {:?}",
level_4_page_table.start_address()
);
println!("It did not crash!");
blog_os::hlt_loop();