Skip to content

Commit fd0d9bf

Browse files
committed
wiop
1 parent 04a61b1 commit fd0d9bf

5 files changed

Lines changed: 9 additions & 2 deletions

File tree

kernel/src/loader.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ const START_INFO: &StartInfo = &StartInfo {
2323
sys_print: |bytes| {
2424
println!("{}", core::str::from_utf8(bytes).unwrap());
2525
},
26+
sys_panic: || {
27+
error!("server panicked");
28+
crate::scheduler::return_to_user();
29+
},
2630
};
2731

2832
fn load_elf(elf_file: &[u8]) {

libs/rust/ftl_server/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use core::sync::atomic::Ordering;
1010
pub mod print;
1111

1212
pub mod start;
13-
mod supercall;
1413

1514
#[cfg(not(feature = "kernel"))]
1615
mod panic;

libs/rust/ftl_server/src/panic.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
use crate::start::start_info;
2+
13
#[cfg(target_os = "none")]
24
#[panic_handler]
35
fn panic(info: &core::panic::PanicInfo) -> ! {
4-
error!("server panic: {info:?}");
6+
error!("server panic: {info}");
7+
(start_info().sys_panic)();
58
loop {}
69
}

libs/rust/ftl_server/src/start.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ static START_INFO: AtomicUsize = AtomicUsize::new(0);
55

66
pub struct StartInfo {
77
pub sys_print: extern "Rust" fn(bytes: &[u8]),
8+
pub sys_panic: extern "Rust" fn(),
89
}
910

1011
pub fn start_info() -> &'static StartInfo {

libs/rust/ftl_server/src/supercall.rs

Whitespace-only changes.

0 commit comments

Comments
 (0)