diff --git a/kernel/arch/i386/arch_reset.c b/kernel/arch/i386/arch_reset.c index c78e8746d..2b4fc7fed 100644 --- a/kernel/arch/i386/arch_reset.c +++ b/kernel/arch/i386/arch_reset.c @@ -84,13 +84,13 @@ void poweroff(void) { const char *shutdown_str; - + /* Bochs/QEMU poweroff */ shutdown_str = "Shutdown"; while (*shutdown_str) outb(0x8900, *(shutdown_str++)); - - /* fallback option: reset */ - reset(); + + /* fallback option: hang */ + for (; ; ) halt_cpu(); } __dead void arch_shutdown(int how) @@ -120,12 +120,12 @@ __dead void arch_shutdown(int how) switch (how) { case RBT_HALT: - /* Stop */ + /* Hang */ for (; ; ) halt_cpu(); NOT_REACHABLE; case RBT_POWEROFF: - /* Power off if possible, reset otherwise */ + /* Power off if possible, hang otherwise */ poweroff(); NOT_REACHABLE; diff --git a/kernel/main.c b/kernel/main.c index 48ac62368..87ec3523a 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -351,6 +351,8 @@ void minix_shutdown(timer_t *tp) * down MINIX. How to shutdown is in the argument: RBT_HALT (return to the * monitor), RBT_RESET (hard reset). */ + int how; + #ifdef CONFIG_SMP /* * FIXME @@ -364,7 +366,27 @@ void minix_shutdown(timer_t *tp) #endif hw_intr_disable_all(); stop_local_timer(); - arch_shutdown(tp ? tmr_arg(tp)->ta_int : RBT_PANIC); + + how = tp ? tmr_arg(tp)->ta_int : RBT_PANIC; + + /* Show shutdown message */ + direct_cls(); + switch(how) { + case RBT_HALT: + direct_print("MINIX has halted. " + "It is safe to turn off your computer.\n"); + break; + case RBT_POWEROFF: + direct_print("MINIX has halted and will now power off.\n"); + break; + case RBT_DEFAULT: + case RBT_REBOOT: + case RBT_RESET: + default: + direct_print("MINIX will now reset.\n"); + break; + } + arch_shutdown(how); } /*===========================================================================*