From 43fcc1ca57149c5a87502f0c23a2c85e4d28264a Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Thu, 20 Jul 2017 09:25:18 +0200 Subject: kernel_panic while shutting down does not result in endless loops anymore --- src/kernel/kernel.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c index 4314ca8..9bb1054 100644 --- a/src/kernel/kernel.c +++ b/src/kernel/kernel.c @@ -105,6 +105,12 @@ void kernel_main( void ) // exit point in case of kernel panic, do this as soon as // possible, as soon we have an early console we can croak on if( setjmp( panic_jmp_buf ) > 0 ) { + // reset the panic jump point to the really end to avoid + // endless loops when something bad happens while shutting + // down + if( setjmp( panic_jmp_buf ) > 0 ) { + goto ABORT; + } goto TERMINATE; } @@ -121,12 +127,6 @@ void kernel_main( void ) puts( "Initializing drivers" ); driver_manager_init( &global_context.driver_manager ); - // exit point in case of kernel panic, do this as soon as - // possible - if( setjmp( panic_jmp_buf ) > 0 ) { - goto TERMINATE; - } - // hard-wired drivers global_context.keyboard = (keyboard_t *)malloc( sizeof( keyboard_t ) ); @@ -173,6 +173,7 @@ TERMINATE: driver_manager_deinit( &global_context.driver_manager ); +ABORT: puts( "Kernel terminated" ); } -- cgit v1.2.3-54-g00ecf