From 98563a4afa14923bbc5d1b6245d401431a0ec709 Mon Sep 17 00:00:00 2001 From: Tomas Hruby Date: Thu, 14 Jan 2010 09:46:16 +0000 Subject: [PATCH] Killing Minix by typing Q on serial console - if debugging on serial console is enabled typing Q kills the system. It is handy if the system gets locked up and the timer interrupts still work. Good for remote debugging. - NOT_REACHABLE reintroduced and fixed. It should be used for marking code which is not reachable because the previous code _should_ not return. Such places are not always obvious --- kernel/arch/i386/system.c | 3 +++ kernel/debug.h | 2 +- kernel/main.c | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/arch/i386/system.c b/kernel/arch/i386/system.c index d69b2af10..4a1a1979c 100644 --- a/kernel/arch/i386/system.c +++ b/kernel/arch/i386/system.c @@ -286,6 +286,9 @@ PRIVATE void ser_debug(int c) switch(c) { + case 'Q': + minix_shutdown(NULL); + NOT_REACHABLE; case '1': ser_dump_proc(); break; diff --git a/kernel/debug.h b/kernel/debug.h index b59e738a7..3b1863155 100644 --- a/kernel/debug.h +++ b/kernel/debug.h @@ -69,7 +69,7 @@ #define vmassert(t) { } #endif -#define NOT_REACHABLE(__x) do { \ +#define NOT_REACHABLE do { \ kprintf("NOT_REACHABLE at %s:%d\n", __FILE__, __LINE__); \ minix_panic("execution at an unexpected location\n", NO_NUM); \ for(;;); \ diff --git a/kernel/main.c b/kernel/main.c index 8a76110f7..988fb1f71 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -251,6 +251,7 @@ PUBLIC void main() #endif restart(); + NOT_REACHABLE; } /*===========================================================================* -- 2.44.0