From 337b8bb36be5d7c0758fe83a12ba037869346bce Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Thu, 31 Aug 2023 19:43:26 -0700 Subject: [PATCH] [panic] Don't spin the CPU in panic While waiting for the main panicing CPU to finish, don't spin the CPU without using `asm("pause")` to lower power consumption. Some panics can get stuck in this state and oh man do my fans spin up. --- src/kernel/panic.serial/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kernel/panic.serial/main.cpp b/src/kernel/panic.serial/main.cpp index c5e1833..5ca49ff 100644 --- a/src/kernel/panic.serial/main.cpp +++ b/src/kernel/panic.serial/main.cpp @@ -30,7 +30,7 @@ void panic_handler(const cpu_state *regs) // If we're not running on the CPU that panicked, wait // for it to finish if (!panic) { - while (!main_cpu_done); + while (!main_cpu_done) asm ("pause"); } else { new (&com1) panicking::serial_port {panicking::COM1}; new (&syms) panicking::symbol_table {panic->symbol_data};