37 lines
864 B
Rust
37 lines
864 B
Rust
#![no_std]
|
|
#![no_main]
|
|
#![feature(abi_x86_interrupt)] // for `mod interrupts`
|
|
#![feature(const_fn_trait_bound)] // for `mod sync`
|
|
#![feature(alloc_error_handler)] // for `mod heap`
|
|
#![feature(naked_functions)] // for `mod proc`
|
|
#![feature(asm_sym)] // for `mod interrupts`
|
|
#![feature(bench_black_box)] // for `mod proc`
|
|
|
|
extern crate alloc;
|
|
|
|
use bootloader::BootInfo;
|
|
use x86_64::VirtAddr;
|
|
|
|
mod gdt;
|
|
mod heap;
|
|
mod interrupts;
|
|
mod keyboard;
|
|
pub mod mem;
|
|
pub mod sync;
|
|
pub mod vga_text;
|
|
pub mod proc;
|
|
// pub use x;
|
|
|
|
pub fn init(info: &'static BootInfo) {
|
|
gdt::init_gdt();
|
|
interrupts::init_interrupts();
|
|
mem::init(info.physical_memory_offset, &info.memory_map);
|
|
heap::init();
|
|
proc::init();
|
|
}
|
|
|
|
fn assert_canonical(addr: u64) {
|
|
if VirtAddr::new_truncate(addr).as_u64() != addr {
|
|
panic!("Address 0x{:x} was not canonical!", addr);
|
|
}
|
|
} |