mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
42 lines
1.0 KiB
Rust
42 lines
1.0 KiB
Rust
#![feature(lang_items)]
|
|
#![feature(const_fn)]
|
|
#![feature(const_unique_new)]
|
|
#![feature(unique)]
|
|
#![no_std]
|
|
|
|
extern crate rlibc;
|
|
extern crate volatile;
|
|
extern crate spin;
|
|
extern crate multiboot2;
|
|
|
|
#[macro_use]
|
|
mod vga_buffer;
|
|
|
|
#[no_mangle]
|
|
pub extern fn rust_main(multiboot_information_address: usize) {
|
|
vga_buffer::clear_screen();
|
|
println!("Hello World{}", "!");
|
|
|
|
let boot_info = unsafe{ multiboot2::load(multiboot_information_address) };
|
|
let memory_map_tag = boot_info.memory_map_tag()
|
|
.expect("Memory map tag required");
|
|
|
|
println!("memory areas:");
|
|
for area in memory_map_tag.memory_areas() {
|
|
println!(" start: 0x{:x}, length: 0x{:x}",
|
|
area.base_addr, area.length);
|
|
}
|
|
|
|
loop{}
|
|
}
|
|
|
|
#[lang = "eh_personality"] extern fn eh_personality() {}
|
|
|
|
#[lang = "panic_fmt"]
|
|
#[no_mangle]
|
|
pub extern fn panic_fmt(fmt: core::fmt::Arguments, file: &'static str, line: u32) -> ! {
|
|
println!("\n\nPANIC in {} at line {}:", file, line);
|
|
println!(" {}", fmt);
|
|
loop{}
|
|
}
|