Entry point for the Rust code
(multiboot_information_address: usize)
| 25 | #[no_mangle] |
| 26 | /// Entry point for the Rust code |
| 27 | pub extern "C" fn rust_main(multiboot_information_address: usize) { |
| 28 | |
| 29 | // clear the console screen |
| 30 | vga_buffer::clear_screen(); |
| 31 | |
| 32 | // print out a welcome message |
| 33 | println!("kernel: botting"); |
| 34 | |
| 35 | let boot_info = unsafe { multiboot2::load(multiboot_information_address) }; |
| 36 | |
| 37 | // enable NXE bit, to allow define none executable pages. |
| 38 | enable_nxe_bit(); |
| 39 | |
| 40 | // set write protect bit in order to enable write protection on kernel mode. |
| 41 | enable_write_protect_bit(); |
| 42 | |
| 43 | // set up guard page and map the heap pages |
| 44 | let mut memory_controller = memory::init(boot_info); |
| 45 | |
| 46 | // Initialize IDT |
| 47 | interrupts::init(&mut memory_controller); |
| 48 | |
| 49 | // Initialize devices |
| 50 | device::init(&mut memory_controller); |
| 51 | |
| 52 | // TODO Read ACPI tables, starts APs |
| 53 | |
| 54 | // Initialize all the non-core devices |
| 55 | device::init_non_core(); |
| 56 | |
| 57 | println!("It did not crash!"); |
| 58 | |
| 59 | loop {} |
| 60 | } |
nothing calls this directly
no test coverage detected