diff options
| author | Natasha Moongrave <natasha@256phi.eu> | 2026-03-30 11:13:41 +0200 |
|---|---|---|
| committer | Natasha Moongrave <natasha@256phi.eu> | 2026-03-30 11:13:41 +0200 |
| commit | e61ddcf9141132fe4ab0ef6b8600ecde591886b3 (patch) | |
| tree | 1fecf57b67e29b2995c2eeb0c615f5d223404201 | |
| parent | 834c63a77cd17d20bd2d3b994c61290bc14ca6c2 (diff) | |
added the printing of level 4 page table addresses on runtime + configured a proper entr ypoint founction instead of a C make #no_mangle _start
kernel_main()
| -rw-r--r-- | StrixKernel/src/main.rs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/StrixKernel/src/main.rs b/StrixKernel/src/main.rs index 6a8b00f..8ab4568 100644 --- a/StrixKernel/src/main.rs +++ b/StrixKernel/src/main.rs @@ -6,26 +6,33 @@ use strix_os::println; use core::panic::PanicInfo; -use bootloader::BootInfo; +use bootloader::{BootInfo, entry_point}; + +entry_point!(kernel_main); +fn kernel_main(boot_info: &'static BootInfo) -> ! { + use strix_os::memory::active_level_4_table; + use x86_64::VirtAddr; -#[unsafe(no_mangle)] -pub extern "C" fn _start(boot_info: &'static BootInfo) -> ! { println!("Hello World{}", "!"); println!("The Strix OS kernel is now online"); strix_os::init(); // Call the init function as declared in ./lib.rs - // Access the level 4 page table and print its address - use x86_64::registers::control::Cr3; + let phys_mem_offset = VirtAddr::new(boot_info.physical_memory_offset); + let l4_table = unsafe { active_level_4_table(phys_mem_offset) }; - let (level_4_page_table, _) = Cr3::read(); - println!("Level 4 page table at: {:?}", level_4_page_table.start_address()); + for (i, entry) in l4_table.iter().enumerate() { + if !entry.is_unused() { + println!("L4 Entry {}: {:?}", i, entry); + } + } // Continue as normal #[cfg(test)] test_main(); + println!("It did not crash{}", "!"); strix_os::hlt_loop(); } |
