aboutsummaryrefslogtreecommitdiff
path: root/src/panic_wait.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/panic_wait.rs')
-rw-r--r--src/panic_wait.rs40
1 files changed, 23 insertions, 17 deletions
diff --git a/src/panic_wait.rs b/src/panic_wait.rs
index a9dfba3..53998a0 100644
--- a/src/panic_wait.rs
+++ b/src/panic_wait.rs
@@ -2,7 +2,7 @@
//!
//! A panic handler that infinitely waits
-use crate::{cpu,println};
+use crate::{cpu, println};
use core::panic::PanicInfo;
/// # Prevent Double Faulting
@@ -12,28 +12,34 @@ use core::panic::PanicInfo;
/// there was already a fault, it spins to
/// prevent a recursive faulting cycle.
fn panic_prevent_reenter() {
- use core::sync::atomic::{AtomicBool, Ordering};
+ use core::sync::atomic::{AtomicBool, Ordering};
- static PANIC_IN_PROGRESS: AtomicBool = AtomicBool::new(false);
+ static PANIC_IN_PROGRESS: AtomicBool = AtomicBool::new(false);
- if !PANIC_IN_PROGRESS.load(Ordering::Relaxed) {
- PANIC_IN_PROGRESS.store(true, Ordering::Relaxed);
- return;
- }
+ if !PANIC_IN_PROGRESS.load(Ordering::Relaxed) {
+ PANIC_IN_PROGRESS.store(true, Ordering::Relaxed);
+ return;
+ }
- cpu::wait_forever()
+ cpu::wait_forever()
}
/// # Panic handler
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
- panic_prevent_reenter();
-
- let (location, line, column) = match info.location() {
- Some(loc) => (loc.file(), loc.line(), loc.column()),
- _ => ("???",0,0),
- };
-
- println!("Kernel panic!\n\nPanic Location:\n\tFile: '{}', line {}, column {}\n\n{}", location, line, column, info.message().unwrap_or(&format_args!("")),);
- cpu::wait_forever()
+ panic_prevent_reenter();
+
+ let (location, line, column) = match info.location() {
+ Some(loc) => (loc.file(), loc.line(), loc.column()),
+ _ => ("???", 0, 0),
+ };
+
+ println!(
+ "Kernel panic!\n\nPanic Location:\n\tFile: '{}', line {}, column {}\n\n{}",
+ location,
+ line,
+ column,
+ info.message().unwrap_or(&format_args!("")),
+ );
+ cpu::wait_forever()
}