mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-17 06:47:49 +00:00
Reset code to post-09 branch for new 'Paging Implementation' post
This commit is contained in:
18
src/main.rs
18
src/main.rs
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user