From: Tulio A M Mendes Date: Fri, 6 Feb 2026 11:42:43 +0000 (-0300) Subject: shell: make panic command deterministic (ud2 on x86) X-Git-Url: https://projects.tadryanom.me/?a=commitdiff_plain;h=c93496895afaf8388cd08fe461e57fa1b3c5d557;p=AdrOS.git shell: make panic command deterministic (ud2 on x86) --- diff --git a/src/kernel/shell.c b/src/kernel/shell.c index c710020..f00050b 100644 --- a/src/kernel/shell.c +++ b/src/kernel/shell.c @@ -9,6 +9,7 @@ #include "heap.h" #include "hal/system.h" +#include "hal/cpu.h" #define MAX_CMD_LEN 256 static char cmd_buffer[MAX_CMD_LEN]; @@ -79,7 +80,14 @@ void execute_command(char* cmd) { uart_print(" Total RAM: [TODO] MB\n"); } else if (strcmp(cmd, "panic") == 0) { - int a = 1; int b = 0; int c = a / b; (void)c; +#if defined(__i386__) || defined(__x86_64__) + __asm__ volatile("cli"); + __asm__ volatile("ud2"); +#else + for(;;) { + hal_cpu_idle(); + } +#endif } else if (strcmp(cmd, "reboot") == 0) { hal_system_reboot();