Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#![feature(pointer_methods)]
#![feature(const_fn)]
#![feature(nll)]
#![feature(panic_implementation)]
#![no_std]
#![no_main]

Expand All @@ -19,6 +20,7 @@ extern crate xmas_elf;
extern crate fixedvec;

use core::slice;
use core::panic::PanicInfo;
use os_bootinfo::BootInfo;
use usize_conversions::usize_from;
use x86_64::structures::paging::{Mapper, RecursivePageTable};
Expand Down Expand Up @@ -214,17 +216,11 @@ fn enable_write_protect_bit() {
unsafe { Cr0::update(|cr0| *cr0 |= Cr0Flags::WRITE_PROTECT) };
}

#[lang = "panic_fmt"]
#[panic_implementation]
#[no_mangle]
pub extern "C" fn rust_begin_panic(
msg: core::fmt::Arguments,
file: &'static str,
line: u32,
_column: u32,
) -> ! {
pub extern "C" fn panic(info: &PanicInfo) -> ! {
use core::fmt::Write;
write!(printer::Printer, "PANIC: {} in {}:{}", msg, file, line).unwrap();

write!(printer::Printer, "{}", info).unwrap();
loop {}
}

Expand Down