Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use panic_implementation instead of panic_fmt #11

Merged
merged 1 commit into from
Jun 5, 2018
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
16 changes: 9 additions & 7 deletions uefi-services/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#![no_std]

#![feature(lang_items)]
#![feature(panic_implementation)]

// These crates are required.
extern crate rlibc;
Expand Down Expand Up @@ -93,13 +94,14 @@ fn init_alloc() {
#[lang = "eh_personality"]
fn eh_personality() {}

#[lang = "panic_fmt"]
#[no_mangle]
pub fn panic_fmt(fmt: core::fmt::Arguments, file_line_col: &(&'static str, u32, u32)) {
let &(file, line, column) = file_line_col;

error!("Panic in {} at ({}, {}):", file, line, column);
error!("{}", fmt);
#[panic_implementation]
fn panic_fmt(info: &core::panic::PanicInfo) -> ! {
if let Some(location) = info.location() {
error!("Panic in {} at ({}, {}):", location.file(), location.line(), location.column());
if let Some(message) = info.message() {
error!("{}", info.message())
}
}

loop {
// TODO: add a timeout then shutdown.
Expand Down