From: Ben Pfaff Date: Thu, 9 Dec 2004 19:50:39 +0000 (+0000) Subject: Rename do_power_off to power_off_when_done. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=937fd062e13d932444e5068d3d57e5a3a0c8707f;p=pintos-anon Rename do_power_off to power_off_when_done. Only power off on kernel panic if power_off_when_done set. --- diff --git a/src/lib/debug.c b/src/lib/debug.c index 7d52063..6d75e7a 100644 --- a/src/lib/debug.c +++ b/src/lib/debug.c @@ -5,6 +5,7 @@ #include #include #ifdef KERNEL +#include "threads/init.h" #include "threads/interrupt.h" #include "devices/serial.h" #else @@ -89,7 +90,9 @@ debug_panic (const char *file, int line, const char *function, #ifdef KERNEL serial_flush (); - power_off (); + if (power_off_when_done) + power_off (); + for (;;); #else exit (1); #endif diff --git a/src/threads/init.c b/src/threads/init.c index ef67071..741f0e4 100644 --- a/src/threads/init.c +++ b/src/threads/init.c @@ -49,8 +49,8 @@ static bool format_filesys; static char *initial_program; #endif -/* -q: Power off after running requested actions? */ -static bool do_power_off; +/* -q: Power off after kernel tasks complete? */ +bool power_off_when_done; static void ram_init (void); static void paging_init (void); @@ -133,7 +133,7 @@ main (void) #endif /* Finish up. */ - if (do_power_off) + if (power_off_when_done) power_off (); else thread_exit (); @@ -225,7 +225,7 @@ argv_init (void) else if (!strcmp (argv[i], "-d")) debug_enable (argv[++i]); else if (!strcmp (argv[i], "-q")) - do_power_off = true; + power_off_when_done = true; #ifdef USERPROG else if (!strcmp (argv[i], "-ex")) initial_program = argv[++i]; diff --git a/src/threads/init.h b/src/threads/init.h index 555804a..a6fec05 100644 --- a/src/threads/init.h +++ b/src/threads/init.h @@ -2,6 +2,7 @@ #define THREADS_INIT_H #include +#include #include #include @@ -11,6 +12,9 @@ extern size_t ram_pages; /* Page directory with kernel mappings only. */ extern uint32_t *base_page_dir; +/* -q: Power off when kernel tasks complete? */ +extern bool power_off_when_done; + void power_off (void) NO_RETURN; #endif /* threads/init.h */