#include <stdio.h>
#include <string.h>
#ifdef KERNEL
+#include "threads/init.h"
#include "threads/interrupt.h"
#include "devices/serial.h"
#else
#ifdef KERNEL
serial_flush ();
- power_off ();
+ if (power_off_when_done)
+ power_off ();
+ for (;;);
#else
exit (1);
#endif
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);
#endif
/* Finish up. */
- if (do_power_off)
+ if (power_off_when_done)
power_off ();
else
thread_exit ();
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];
#define THREADS_INIT_H
#include <debug.h>
+#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
/* 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 */