alloc: Yield on a panic If we panic we need ot yield to ensure any remaining prints are printed by the kernel. This helps with debugging. We use future::pending() instead of syscalls::raw::yieldk() to reduce the amount of unsafe code. Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
diff --git a/src/alloc.rs b/src/alloc.rs index ee3de18..523cb64 100644 --- a/src/alloc.rs +++ b/src/alloc.rs
@@ -8,6 +8,7 @@ use core::executor; use core::ptr; use core::ptr::NonNull; +use futures::future; use linked_list_allocator::Heap; pub static mut HEAP: Heap = Heap::empty(); @@ -40,6 +41,8 @@ if let (Ok(leds_driver), Ok(timer_driver)) = (leds_driver, timer_driver) { let _ = cycle_all_leds(&leds_driver, &timer_driver).await; + } else { + future::pending::<()>().await } loop {} })