Deal all shutdown cases with multiboot as either reset or poweroff depending on their type (contributed by Feiran 'Fam' Zheng)

This commit is contained in:
Erik van der Kouwe 2010-08-02 14:41:45 +00:00
parent ebec792700
commit 25397ef756

View file

@ -68,6 +68,7 @@ PUBLIC int cpu_has_tsc;
PUBLIC __dead void arch_shutdown(const int how) PUBLIC __dead void arch_shutdown(const int how)
{ {
static char mybuffer[sizeof(params_buffer)];
vm_stop(); vm_stop();
/* Mask all interrupts, including the clock. */ /* Mask all interrupts, including the clock. */
@ -97,7 +98,6 @@ PUBLIC __dead void arch_shutdown(const int how)
arch_set_params("", 1); arch_set_params("", 1);
if(minix_panicing) { if(minix_panicing) {
int source, dest; int source, dest;
static char mybuffer[sizeof(params_buffer)];
const char *lead = "echo \\n*** kernel messages:\\n"; const char *lead = "echo \\n*** kernel messages:\\n";
const int leadlen = strlen(lead); const int leadlen = strlen(lead);
strcpy(mybuffer, lead); strcpy(mybuffer, lead);
@ -129,8 +129,16 @@ PUBLIC __dead void arch_shutdown(const int how)
} }
if (mon_return) if (mon_return)
arch_monitor(); arch_monitor();
else {
mybuffer[0] = '\0';
arch_get_params(mybuffer,sizeof(mybuffer));
if (strstr(mybuffer, "boot") ||
strstr(mybuffer, "menu") ||
strstr(mybuffer, "reset"))
reset();
else else
arch_bios_poweroff(); arch_bios_poweroff();
}
} else { } else {
/* Reset the system by forcing a processor shutdown. First stop /* Reset the system by forcing a processor shutdown. First stop
* the BIOS memory test by setting a soft reset flag. * the BIOS memory test by setting a soft reset flag.