Panic: Print location

pull/151/head
Andre Richter 2 years ago
parent 68b81aa6a0
commit 1581b26995
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E

@ -24,9 +24,14 @@ QEMU is no longer running in assembly mode. It will from now on show the output
```console ```console
$ make qemu $ make qemu
[...] [...]
Hello from Rust! Hello from Rust!
Kernel panic!
Panic location:
File 'src/main.rs', line 126, column 5
Kernel panic: Stopping here. Stopping here.
``` ```
## Diff to previous ## Diff to previous
@ -230,7 +235,7 @@ diff -uNr 02_runtime_init/src/main.rs 03_hacky_hello_world/src/main.rs
/// - Only a single core must be active and running this function. /// - Only a single core must be active and running this function.
unsafe fn kernel_init() -> ! { unsafe fn kernel_init() -> ! {
- panic!() - panic!()
+ println!("[0] Hello from Rust!"); + println!("Hello from Rust!");
+ +
+ panic!("Stopping here.") + panic!("Stopping here.")
} }
@ -238,7 +243,7 @@ diff -uNr 02_runtime_init/src/main.rs 03_hacky_hello_world/src/main.rs
diff -uNr 02_runtime_init/src/panic_wait.rs 03_hacky_hello_world/src/panic_wait.rs diff -uNr 02_runtime_init/src/panic_wait.rs 03_hacky_hello_world/src/panic_wait.rs
--- 02_runtime_init/src/panic_wait.rs --- 02_runtime_init/src/panic_wait.rs
+++ 03_hacky_hello_world/src/panic_wait.rs +++ 03_hacky_hello_world/src/panic_wait.rs
@@ -4,14 +4,52 @@ @@ -4,14 +4,61 @@
//! A panic handler that infinitely waits. //! A panic handler that infinitely waits.
@ -285,11 +290,20 @@ diff -uNr 02_runtime_init/src/panic_wait.rs 03_hacky_hello_world/src/panic_wait.
+ // Protect against panic infinite loops if any of the following code panics itself. + // Protect against panic infinite loops if any of the following code panics itself.
+ panic_prevent_reenter(); + panic_prevent_reenter();
+ +
+ if let Some(args) = info.message() { + let (location, line, column) = match info.location() {
+ println!("\nKernel panic: {}", args); + Some(loc) => (loc.file(), loc.line(), loc.column()),
+ } else { + _ => ("???", 0, 0),
+ println!("\nKernel panic!"); + };
+ } +
+ println!(
+ "Kernel panic!\n\n\
+ Panic location:\n File '{}', line {}, column {}\n\n\
+ {}",
+ location,
+ line,
+ column,
+ info.message().unwrap_or(&format_args!("")),
+ );
+ +
cpu::wait_forever() cpu::wait_forever()
} }

@ -121,7 +121,7 @@ mod print;
/// ///
/// - Only a single core must be active and running this function. /// - Only a single core must be active and running this function.
unsafe fn kernel_init() -> ! { unsafe fn kernel_init() -> ! {
println!("[0] Hello from Rust!"); println!("Hello from Rust!");
panic!("Stopping here.") panic!("Stopping here.")
} }

@ -45,11 +45,20 @@ fn panic(info: &PanicInfo) -> ! {
// Protect against panic infinite loops if any of the following code panics itself. // Protect against panic infinite loops if any of the following code panics itself.
panic_prevent_reenter(); panic_prevent_reenter();
if let Some(args) = info.message() { let (location, line, column) = match info.location() {
println!("\nKernel panic: {}", args); Some(loc) => (loc.file(), loc.line(), loc.column()),
} else { _ => ("???", 0, 0),
println!("\nKernel panic!"); };
}
println!(
"Kernel panic!\n\n\
Panic location:\n File '{}', line {}, column {}\n\n\
{}",
location,
line,
column,
info.message().unwrap_or(&format_args!("")),
);
cpu::wait_forever() cpu::wait_forever()
} }

@ -244,11 +244,12 @@ diff -uNr 03_hacky_hello_world/src/main.rs 04_safe_globals/src/main.rs
/// ///
/// - Only a single core must be active and running this function. /// - Only a single core must be active and running this function.
unsafe fn kernel_init() -> ! { unsafe fn kernel_init() -> ! {
- println!("Hello from Rust!");
+ use console::interface::Statistics; + use console::interface::Statistics;
+
println!("[0] Hello from Rust!");
- panic!("Stopping here.") - panic!("Stopping here.")
+ println!("[0] Hello from Rust!");
+
+ println!( + println!(
+ "[1] Chars written: {}", + "[1] Chars written: {}",
+ bsp::console::console().chars_written() + bsp::console::console().chars_written()

@ -45,11 +45,20 @@ fn panic(info: &PanicInfo) -> ! {
// Protect against panic infinite loops if any of the following code panics itself. // Protect against panic infinite loops if any of the following code panics itself.
panic_prevent_reenter(); panic_prevent_reenter();
if let Some(args) = info.message() { let (location, line, column) = match info.location() {
println!("\nKernel panic: {}", args); Some(loc) => (loc.file(), loc.line(), loc.column()),
} else { _ => ("???", 0, 0),
println!("\nKernel panic!"); };
}
println!(
"Kernel panic!\n\n\
Panic location:\n File '{}', line {}, column {}\n\n\
{}",
location,
line,
column,
info.message().unwrap_or(&format_args!("")),
);
cpu::wait_forever() cpu::wait_forever()
} }

@ -1446,18 +1446,15 @@ diff -uNr 04_safe_globals/src/panic_wait.rs 05_drivers_gpio_uart/src/panic_wait.
/// Stop immediately if called a second time. /// Stop immediately if called a second time.
/// ///
/// # Note /// # Note
@@ -46,9 +62,9 @@ @@ -50,7 +66,7 @@
panic_prevent_reenter(); _ => ("???", 0, 0),
};
if let Some(args) = info.message() {
- println!("\nKernel panic: {}", args); - println!(
+ panic_println!("\nKernel panic: {}", args); + panic_println!(
} else { "Kernel panic!\n\n\
- println!("\nKernel panic!"); Panic location:\n File '{}', line {}, column {}\n\n\
+ panic_println!("\nKernel panic!"); {}",
}
cpu::wait_forever()
diff -uNr 04_safe_globals/tests/boot_test_string.rb 05_drivers_gpio_uart/tests/boot_test_string.rb diff -uNr 04_safe_globals/tests/boot_test_string.rb 05_drivers_gpio_uart/tests/boot_test_string.rb
--- 04_safe_globals/tests/boot_test_string.rb --- 04_safe_globals/tests/boot_test_string.rb

@ -61,11 +61,20 @@ fn panic(info: &PanicInfo) -> ! {
// Protect against panic infinite loops if any of the following code panics itself. // Protect against panic infinite loops if any of the following code panics itself.
panic_prevent_reenter(); panic_prevent_reenter();
if let Some(args) = info.message() { let (location, line, column) = match info.location() {
panic_println!("\nKernel panic: {}", args); Some(loc) => (loc.file(), loc.line(), loc.column()),
} else { _ => ("???", 0, 0),
panic_println!("\nKernel panic!"); };
}
panic_println!(
"Kernel panic!\n\n\
Panic location:\n File '{}', line {}, column {}\n\n\
{}",
location,
line,
column,
info.message().unwrap_or(&format_args!("")),
);
cpu::wait_forever() cpu::wait_forever()
} }

@ -61,11 +61,20 @@ fn panic(info: &PanicInfo) -> ! {
// Protect against panic infinite loops if any of the following code panics itself. // Protect against panic infinite loops if any of the following code panics itself.
panic_prevent_reenter(); panic_prevent_reenter();
if let Some(args) = info.message() { let (location, line, column) = match info.location() {
panic_println!("\nKernel panic: {}", args); Some(loc) => (loc.file(), loc.line(), loc.column()),
} else { _ => ("???", 0, 0),
panic_println!("\nKernel panic!"); };
}
panic_println!(
"Kernel panic!\n\n\
Panic location:\n File '{}', line {}, column {}\n\n\
{}",
location,
line,
column,
info.message().unwrap_or(&format_args!("")),
);
cpu::wait_forever() cpu::wait_forever()
} }

@ -635,7 +635,7 @@ diff -uNr 06_uart_chainloader/src/main.rs 07_timestamps/src/main.rs
diff -uNr 06_uart_chainloader/src/panic_wait.rs 07_timestamps/src/panic_wait.rs diff -uNr 06_uart_chainloader/src/panic_wait.rs 07_timestamps/src/panic_wait.rs
--- 06_uart_chainloader/src/panic_wait.rs --- 06_uart_chainloader/src/panic_wait.rs
+++ 07_timestamps/src/panic_wait.rs +++ 07_timestamps/src/panic_wait.rs
@@ -58,13 +58,26 @@ @@ -58,18 +58,23 @@
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {
@ -645,25 +645,21 @@ diff -uNr 06_uart_chainloader/src/panic_wait.rs 07_timestamps/src/panic_wait.rs
panic_prevent_reenter(); panic_prevent_reenter();
+ let timestamp = crate::time::time_manager().uptime(); + let timestamp = crate::time::time_manager().uptime();
+ let (location, line, column) = match info.location() {
if let Some(args) = info.message() { Some(loc) => (loc.file(), loc.line(), loc.column()),
- panic_println!("\nKernel panic: {}", args); _ => ("???", 0, 0),
+ panic_println!( };
+ "[ {:>3}.{:06}] Kernel panic: {}",
+ timestamp.as_secs(), panic_println!(
+ timestamp.subsec_micros(), - "Kernel panic!\n\n\
+ args, + "[ {:>3}.{:06}] Kernel panic!\n\n\
+ ); Panic location:\n File '{}', line {}, column {}\n\n\
} else { {}",
- panic_println!("\nKernel panic!"); + timestamp.as_secs(),
+ panic_println!( + timestamp.subsec_micros(),
+ "[ {:>3}.{:06}] Kernel panic!", location,
+ timestamp.as_secs(), line,
+ timestamp.subsec_micros(), column,
+ );
}
cpu::wait_forever()
diff -uNr 06_uart_chainloader/src/print.rs 07_timestamps/src/print.rs diff -uNr 06_uart_chainloader/src/print.rs 07_timestamps/src/print.rs
--- 06_uart_chainloader/src/print.rs --- 06_uart_chainloader/src/print.rs

@ -64,21 +64,22 @@ fn panic(info: &PanicInfo) -> ! {
panic_prevent_reenter(); panic_prevent_reenter();
let timestamp = crate::time::time_manager().uptime(); let timestamp = crate::time::time_manager().uptime();
let (location, line, column) = match info.location() {
if let Some(args) = info.message() { Some(loc) => (loc.file(), loc.line(), loc.column()),
panic_println!( _ => ("???", 0, 0),
"[ {:>3}.{:06}] Kernel panic: {}", };
timestamp.as_secs(),
timestamp.subsec_micros(), panic_println!(
args, "[ {:>3}.{:06}] Kernel panic!\n\n\
); Panic location:\n File '{}', line {}, column {}\n\n\
} else { {}",
panic_println!( timestamp.as_secs(),
"[ {:>3}.{:06}] Kernel panic!", timestamp.subsec_micros(),
timestamp.as_secs(), location,
timestamp.subsec_micros(), line,
); column,
} info.message().unwrap_or(&format_args!("")),
);
cpu::wait_forever() cpu::wait_forever()
} }

@ -64,21 +64,22 @@ fn panic(info: &PanicInfo) -> ! {
panic_prevent_reenter(); panic_prevent_reenter();
let timestamp = crate::time::time_manager().uptime(); let timestamp = crate::time::time_manager().uptime();
let (location, line, column) = match info.location() {
if let Some(args) = info.message() { Some(loc) => (loc.file(), loc.line(), loc.column()),
panic_println!( _ => ("???", 0, 0),
"[ {:>3}.{:06}] Kernel panic: {}", };
timestamp.as_secs(),
timestamp.subsec_micros(), panic_println!(
args, "[ {:>3}.{:06}] Kernel panic!\n\n\
); Panic location:\n File '{}', line {}, column {}\n\n\
} else { {}",
panic_println!( timestamp.as_secs(),
"[ {:>3}.{:06}] Kernel panic!", timestamp.subsec_micros(),
timestamp.as_secs(), location,
timestamp.subsec_micros(), line,
); column,
} info.message().unwrap_or(&format_args!("")),
);
cpu::wait_forever() cpu::wait_forever()
} }

@ -64,21 +64,22 @@ fn panic(info: &PanicInfo) -> ! {
panic_prevent_reenter(); panic_prevent_reenter();
let timestamp = crate::time::time_manager().uptime(); let timestamp = crate::time::time_manager().uptime();
let (location, line, column) = match info.location() {
if let Some(args) = info.message() { Some(loc) => (loc.file(), loc.line(), loc.column()),
panic_println!( _ => ("???", 0, 0),
"[ {:>3}.{:06}] Kernel panic: {}", };
timestamp.as_secs(),
timestamp.subsec_micros(), panic_println!(
args, "[ {:>3}.{:06}] Kernel panic!\n\n\
); Panic location:\n File '{}', line {}, column {}\n\n\
} else { {}",
panic_println!( timestamp.as_secs(),
"[ {:>3}.{:06}] Kernel panic!", timestamp.subsec_micros(),
timestamp.as_secs(), location,
timestamp.subsec_micros(), line,
); column,
} info.message().unwrap_or(&format_args!("")),
);
cpu::wait_forever() cpu::wait_forever()
} }

@ -64,21 +64,22 @@ fn panic(info: &PanicInfo) -> ! {
panic_prevent_reenter(); panic_prevent_reenter();
let timestamp = crate::time::time_manager().uptime(); let timestamp = crate::time::time_manager().uptime();
let (location, line, column) = match info.location() {
if let Some(args) = info.message() { Some(loc) => (loc.file(), loc.line(), loc.column()),
panic_println!( _ => ("???", 0, 0),
"[ {:>3}.{:06}] Kernel panic: {}", };
timestamp.as_secs(),
timestamp.subsec_micros(), panic_println!(
args, "[ {:>3}.{:06}] Kernel panic!\n\n\
); Panic location:\n File '{}', line {}, column {}\n\n\
} else { {}",
panic_println!( timestamp.as_secs(),
"[ {:>3}.{:06}] Kernel panic!", timestamp.subsec_micros(),
timestamp.as_secs(), location,
timestamp.subsec_micros(), line,
); column,
} info.message().unwrap_or(&format_args!("")),
);
cpu::wait_forever() cpu::wait_forever()
} }

@ -313,7 +313,7 @@ for each exception yet, a default handler is provided:
/// Prints verbose information about the exception and then panics. /// Prints verbose information about the exception and then panics.
fn default_exception_handler(exc: &ExceptionContext) { fn default_exception_handler(exc: &ExceptionContext) {
panic!( panic!(
"\n\nCPU Exception!\n\ "CPU Exception!\n\n\
{}", {}",
exc exc
); );
@ -413,33 +413,37 @@ Minipush 1.0
[MP] ⏩ Pushing 64 KiB =========================================🦀 100% 0 KiB/s Time: 00:00:00 [MP] ⏩ Pushing 64 KiB =========================================🦀 100% 0 KiB/s Time: 00:00:00
[ML] Loaded! Executing the payload now [ML] Loaded! Executing the payload now
[ 0.789853] mingo version 0.11.0 [ 0.787414] mingo version 0.11.0
[ 0.790060] Booting on: Raspberry Pi 3 [ 0.787621] Booting on: Raspberry Pi 3
[ 0.790515] MMU online. Special regions: [ 0.788076] MMU online. Special regions:
[ 0.790992] 0x00080000 - 0x0008ffff | 64 KiB | C RO PX | Kernel code and RO data [ 0.788553] 0x00080000 - 0x0008ffff | 64 KiB | C RO PX | Kernel code and RO data
[ 0.792010] 0x3f000000 - 0x4000ffff | 16 MiB | Dev RW PXN | Device MMIO [ 0.789571] 0x3f000000 - 0x4000ffff | 16 MiB | Dev RW PXN | Device MMIO
[ 0.792899] Current privilege level: EL1 [ 0.790460] Current privilege level: EL1
[ 0.793375] Exception handling state: [ 0.790936] Exception handling state:
[ 0.793819] Debug: Masked [ 0.791380] Debug: Masked
[ 0.794209] SError: Masked [ 0.791770] SError: Masked
[ 0.794599] IRQ: Masked [ 0.792160] IRQ: Masked
[ 0.794989] FIQ: Masked [ 0.792550] FIQ: Masked
[ 0.795379] Architectural timer resolution: 52 ns [ 0.792940] Architectural timer resolution: 52 ns
[ 0.795954] Drivers loaded: [ 0.793514] Drivers loaded:
[ 0.796289] 1. BCM GPIO [ 0.793850] 1. BCM GPIO
[ 0.796647] 2. BCM PL011 UART [ 0.794208] 2. BCM PL011 UART
[ 0.797070] Timer test, spinning for 1 second [ 0.794630] Timer test, spinning for 1 second
[ 1.797600] [ 1.795161]
[ 1.797604] Trying to read from address 8 GiB... [ 1.795165] Trying to read from address 8 GiB...
[ 1.798154] ************************************************ [ 1.795715] ************************************************
[ 1.798846] Whoa! We recovered from a synchronous exception! [ 1.796407] Whoa! We recovered from a synchronous exception!
[ 1.799539] ************************************************ [ 1.797100] ************************************************
[ 1.800233] [ 1.797794]
[ 1.800406] Let's try again [ 1.797967] Let's try again
[ 1.800742] Trying to read from address 9 GiB... [ 1.798303] Trying to read from address 9 GiB...
[ 1.801306] Kernel panic: [ 1.798867] Kernel panic!
Panic location:
File 'src/_arch/aarch64/exception.rs', line 58, column 5
CPU Exception! CPU Exception!
ESR_EL1: 0x96000004 ESR_EL1: 0x96000004
Exception Class (EC) : 0x25 - Data Abort, current EL Exception Class (EC) : 0x25 - Data Abort, current EL
Instr Specific Syndrome (ISS): 0x4 Instr Specific Syndrome (ISS): 0x4
@ -459,21 +463,21 @@ SPSR_EL1: 0x600003c5
ELR_EL1: 0x0000000000082194 ELR_EL1: 0x0000000000082194
General purpose register: General purpose register:
x0 : 0x0000000000000000 x1 : 0x000000000008555f x0 : 0x0000000000000000 x1 : 0x0000000000085517
x2 : 0x0000000000000027 x3 : 0x000000000008435c x2 : 0x0000000000000027 x3 : 0x0000000000084380
x4 : 0x0000000000000006 x5 : 0x3f27329c00000000 x4 : 0x0000000000000006 x5 : 0xfb5f341800000000
x6 : 0x0000000000000000 x7 : 0xd3d1b900228f0241 x6 : 0x0000000000000000 x7 : 0x7f91bc012b2b0209
x8 : 0x0000000240000000 x9 : 0x000000000008555f x8 : 0x0000000240000000 x9 : 0x0000000000085517
x10: 0x0000000000000443 x11: 0x000000003f201000 x10: 0x0000000000000443 x11: 0x000000003f201000
x12: 0x0000000000000019 x13: 0x00000000ffffd8f0 x12: 0x0000000000000019 x13: 0x00000000ffffd8f0
x14: 0x000000000000147b x15: 0x00000000ffffff9c x14: 0x000000000000147b x15: 0x00000000ffffff9c
x16: 0x000000000007fd38 x17: 0x0000000005f5e0ff x16: 0x000000000007fd38 x17: 0x0000000005f5e0ff
x18: 0x0000000000000034 x19: 0x0000000000090008 x18: 0x0000000000000030 x19: 0x0000000000090008
x20: 0x0000000000085398 x21: 0x000000003b9aca00 x20: 0x0000000000085350 x21: 0x000000003b9aca00
x22: 0x0000000000082e30 x23: 0x0000000000082308 x22: 0x0000000000082e4c x23: 0x0000000000082308
x24: 0x0000000010624dd3 x25: 0xffffffffc4653600 x24: 0x0000000010624dd3 x25: 0xffffffffc4653600
x26: 0x00000000000866b8 x27: 0x0000000000085458 x26: 0x0000000000086638 x27: 0x0000000000085410
x28: 0x0000000000084fe0 x29: 0x0000000000086770 x28: 0x0000000000084f90 x29: 0x0000000000086538
lr : 0x0000000000082188 lr : 0x0000000000082188
``` ```
@ -546,7 +550,7 @@ diff -uNr 10_virtual_mem_part1_identity_mapping/src/_arch/aarch64/exception.rs 1
+/// Prints verbose information about the exception and then panics. +/// Prints verbose information about the exception and then panics.
+fn default_exception_handler(exc: &ExceptionContext) { +fn default_exception_handler(exc: &ExceptionContext) {
+ panic!( + panic!(
+ "\n\nCPU Exception!\n\ + "CPU Exception!\n\n\
+ {}", + {}",
+ exc + exc
+ ); + );

@ -56,7 +56,7 @@ struct ExceptionContext {
/// Prints verbose information about the exception and then panics. /// Prints verbose information about the exception and then panics.
fn default_exception_handler(exc: &ExceptionContext) { fn default_exception_handler(exc: &ExceptionContext) {
panic!( panic!(
"\n\nCPU Exception!\n\ "CPU Exception!\n\n\
{}", {}",
exc exc
); );

@ -64,21 +64,22 @@ fn panic(info: &PanicInfo) -> ! {
panic_prevent_reenter(); panic_prevent_reenter();
let timestamp = crate::time::time_manager().uptime(); let timestamp = crate::time::time_manager().uptime();
let (location, line, column) = match info.location() {
if let Some(args) = info.message() { Some(loc) => (loc.file(), loc.line(), loc.column()),
panic_println!( _ => ("???", 0, 0),
"[ {:>3}.{:06}] Kernel panic: {}", };
timestamp.as_secs(),
timestamp.subsec_micros(), panic_println!(
args, "[ {:>3}.{:06}] Kernel panic!\n\n\
); Panic location:\n File '{}', line {}, column {}\n\n\
} else { {}",
panic_println!( timestamp.as_secs(),
"[ {:>3}.{:06}] Kernel panic!", timestamp.subsec_micros(),
timestamp.as_secs(), location,
timestamp.subsec_micros(), line,
); column,
} info.message().unwrap_or(&format_args!("")),
);
cpu::wait_forever() cpu::wait_forever()
} }

@ -856,10 +856,14 @@ Compiling integration test(s) - rpi3
🦀 Testing synchronous exception handling by causing a page fault 🦀 Testing synchronous exception handling by causing a page fault
------------------------------------------------------------------- -------------------------------------------------------------------
[ 0.163030] Writing beyond mapped area to address 9 GiB... [ 0.132792] Writing beyond mapped area to address 9 GiB...
[ 0.164791] Kernel panic: [ 0.134563] Kernel panic!
Panic location:
File 'src/_arch/aarch64/exception.rs', line 58, column 5
CPU Exception! CPU Exception!
ESR_EL1: 0x96000004 ESR_EL1: 0x96000004
Exception Class (EC) : 0x25 - Data Abort, current EL Exception Class (EC) : 0x25 - Data Abort, current EL
[...] [...]
@ -1753,9 +1757,9 @@ diff -uNr 11_exceptions_part1_groundwork/src/panic_wait.rs 12_integrated_testing
} }
#[panic_handler] #[panic_handler]
@@ -80,5 +97,5 @@ @@ -81,5 +98,5 @@
); info.message().unwrap_or(&format_args!("")),
} );
- cpu::wait_forever() - cpu::wait_forever()
+ _panic_exit() + _panic_exit()

@ -56,7 +56,7 @@ struct ExceptionContext {
/// Prints verbose information about the exception and then panics. /// Prints verbose information about the exception and then panics.
fn default_exception_handler(exc: &ExceptionContext) { fn default_exception_handler(exc: &ExceptionContext) {
panic!( panic!(
"\n\nCPU Exception!\n\ "CPU Exception!\n\n\
{}", {}",
exc exc
); );

@ -81,21 +81,22 @@ fn panic(info: &PanicInfo) -> ! {
panic_prevent_reenter(); panic_prevent_reenter();
let timestamp = crate::time::time_manager().uptime(); let timestamp = crate::time::time_manager().uptime();
let (location, line, column) = match info.location() {
if let Some(args) = info.message() { Some(loc) => (loc.file(), loc.line(), loc.column()),
panic_println!( _ => ("???", 0, 0),
"[ {:>3}.{:06}] Kernel panic: {}", };
timestamp.as_secs(),
timestamp.subsec_micros(), panic_println!(
args, "[ {:>3}.{:06}] Kernel panic!\n\n\
); Panic location:\n File '{}', line {}, column {}\n\n\
} else { {}",
panic_println!( timestamp.as_secs(),
"[ {:>3}.{:06}] Kernel panic!", timestamp.subsec_micros(),
timestamp.as_secs(), location,
timestamp.subsec_micros(), line,
); column,
} info.message().unwrap_or(&format_args!("")),
);
_panic_exit() _panic_exit()
} }

@ -57,7 +57,7 @@ struct ExceptionContext {
/// Prints verbose information about the exception and then panics. /// Prints verbose information about the exception and then panics.
fn default_exception_handler(exc: &ExceptionContext) { fn default_exception_handler(exc: &ExceptionContext) {
panic!( panic!(
"\n\nCPU Exception!\n\ "CPU Exception!\n\n\
{}", {}",
exc exc
); );

@ -83,21 +83,22 @@ fn panic(info: &PanicInfo) -> ! {
panic_prevent_reenter(); panic_prevent_reenter();
let timestamp = crate::time::time_manager().uptime(); let timestamp = crate::time::time_manager().uptime();
let (location, line, column) = match info.location() {
if let Some(args) = info.message() { Some(loc) => (loc.file(), loc.line(), loc.column()),
panic_println!( _ => ("???", 0, 0),
"[ {:>3}.{:06}] Kernel panic: {}", };
timestamp.as_secs(),
timestamp.subsec_micros(), panic_println!(
args, "[ {:>3}.{:06}] Kernel panic!\n\n\
); Panic location:\n File '{}', line {}, column {}\n\n\
} else { {}",
panic_println!( timestamp.as_secs(),
"[ {:>3}.{:06}] Kernel panic!", timestamp.subsec_micros(),
timestamp.as_secs(), location,
timestamp.subsec_micros(), line,
); column,
} info.message().unwrap_or(&format_args!("")),
);
_panic_exit() _panic_exit()
} }

@ -57,7 +57,7 @@ struct ExceptionContext {
/// Prints verbose information about the exception and then panics. /// Prints verbose information about the exception and then panics.
fn default_exception_handler(exc: &ExceptionContext) { fn default_exception_handler(exc: &ExceptionContext) {
panic!( panic!(
"\n\nCPU Exception!\n\ "CPU Exception!\n\n\
{}", {}",
exc exc
); );

@ -83,21 +83,22 @@ fn panic(info: &PanicInfo) -> ! {
panic_prevent_reenter(); panic_prevent_reenter();
let timestamp = crate::time::time_manager().uptime(); let timestamp = crate::time::time_manager().uptime();
let (location, line, column) = match info.location() {
if let Some(args) = info.message() { Some(loc) => (loc.file(), loc.line(), loc.column()),
panic_println!( _ => ("???", 0, 0),
"[ {:>3}.{:06}] Kernel panic: {}", };
timestamp.as_secs(),
timestamp.subsec_micros(), panic_println!(
args, "[ {:>3}.{:06}] Kernel panic!\n\n\
); Panic location:\n File '{}', line {}, column {}\n\n\
} else { {}",
panic_println!( timestamp.as_secs(),
"[ {:>3}.{:06}] Kernel panic!", timestamp.subsec_micros(),
timestamp.as_secs(), location,
timestamp.subsec_micros(), line,
); column,
} info.message().unwrap_or(&format_args!("")),
);
_panic_exit() _panic_exit()
} }

@ -57,7 +57,7 @@ struct ExceptionContext {
/// Prints verbose information about the exception and then panics. /// Prints verbose information about the exception and then panics.
fn default_exception_handler(exc: &ExceptionContext) { fn default_exception_handler(exc: &ExceptionContext) {
panic!( panic!(
"\n\nCPU Exception!\n\ "CPU Exception!\n\n\
{}", {}",
exc exc
); );

@ -83,21 +83,22 @@ fn panic(info: &PanicInfo) -> ! {
panic_prevent_reenter(); panic_prevent_reenter();
let timestamp = crate::time::time_manager().uptime(); let timestamp = crate::time::time_manager().uptime();
let (location, line, column) = match info.location() {
if let Some(args) = info.message() { Some(loc) => (loc.file(), loc.line(), loc.column()),
panic_println!( _ => ("???", 0, 0),
"[ {:>3}.{:06}] Kernel panic: {}", };
timestamp.as_secs(),
timestamp.subsec_micros(), panic_println!(
args, "[ {:>3}.{:06}] Kernel panic!\n\n\
); Panic location:\n File '{}', line {}, column {}\n\n\
} else { {}",
panic_println!( timestamp.as_secs(),
"[ {:>3}.{:06}] Kernel panic!", timestamp.subsec_micros(),
timestamp.as_secs(), location,
timestamp.subsec_micros(), line,
); column,
} info.message().unwrap_or(&format_args!("")),
);
_panic_exit() _panic_exit()
} }

@ -57,7 +57,7 @@ struct ExceptionContext {
/// Prints verbose information about the exception and then panics. /// Prints verbose information about the exception and then panics.
fn default_exception_handler(exc: &ExceptionContext) { fn default_exception_handler(exc: &ExceptionContext) {
panic!( panic!(
"\n\nCPU Exception!\n\ "CPU Exception!\n\n\
{}", {}",
exc exc
); );

@ -83,21 +83,22 @@ fn panic(info: &PanicInfo) -> ! {
panic_prevent_reenter(); panic_prevent_reenter();
let timestamp = crate::time::time_manager().uptime(); let timestamp = crate::time::time_manager().uptime();
let (location, line, column) = match info.location() {
if let Some(args) = info.message() { Some(loc) => (loc.file(), loc.line(), loc.column()),
panic_println!( _ => ("???", 0, 0),
"[ {:>3}.{:06}] Kernel panic: {}", };
timestamp.as_secs(),
timestamp.subsec_micros(), panic_println!(
args, "[ {:>3}.{:06}] Kernel panic!\n\n\
); Panic location:\n File '{}', line {}, column {}\n\n\
} else { {}",
panic_println!( timestamp.as_secs(),
"[ {:>3}.{:06}] Kernel panic!", timestamp.subsec_micros(),
timestamp.as_secs(), location,
timestamp.subsec_micros(), line,
); column,
} info.message().unwrap_or(&format_args!("")),
);
_panic_exit() _panic_exit()
} }

Binary file not shown.

Binary file not shown.

@ -64,21 +64,22 @@ fn panic(info: &PanicInfo) -> ! {
panic_prevent_reenter(); panic_prevent_reenter();
let timestamp = crate::time::time_manager().uptime(); let timestamp = crate::time::time_manager().uptime();
let (location, line, column) = match info.location() {
if let Some(args) = info.message() { Some(loc) => (loc.file(), loc.line(), loc.column()),
panic_println!( _ => ("???", 0, 0),
"[ {:>3}.{:06}] Kernel panic: {}", };
timestamp.as_secs(),
timestamp.subsec_micros(), panic_println!(
args, "[ {:>3}.{:06}] Kernel panic!\n\n\
); Panic location:\n File '{}', line {}, column {}\n\n\
} else { {}",
panic_println!( timestamp.as_secs(),
"[ {:>3}.{:06}] Kernel panic!", timestamp.subsec_micros(),
timestamp.as_secs(), location,
timestamp.subsec_micros(), line,
); column,
} info.message().unwrap_or(&format_args!("")),
);
cpu::wait_forever() cpu::wait_forever()
} }

Loading…
Cancel
Save