From: Ben Pfaff <blp@cs.stanford.edu>
Date: Sun, 9 Nov 2008 23:40:18 +0000 (-0800)
Subject: Mark shutdown_reboot() and shutdown_power_off() as NO_RETURN.
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=253a082737f2cb56bbbef10263c5600eda1c4645;p=pintos-anon

Mark shutdown_reboot() and shutdown_power_off() as NO_RETURN.

Also, make shutdown_reboot() actually behave that way, by trying to reboot
forever instead of giving up after some number of tries.
---

diff --git a/src/devices/shutdown.c b/src/devices/shutdown.c
index fbc662b..4c978f9 100644
--- a/src/devices/shutdown.c
+++ b/src/devices/shutdown.c
@@ -23,19 +23,17 @@ static void print_stats (void);
 void
 shutdown_reboot (void)
 {
-  int i;
-
   printf ("Rebooting...\n");
 
     /* See [kbd] for details on how to program the keyboard
      * controller. */
-  for (i = 0; i < 100; i++)
+  for (;;)
     {
-      int j;
+      int i;
 
       /* Poll keyboard controller's status byte until
        * 'input buffer empty' is reported. */
-      for (j = 0; j < 0x10000; j++)
+      for (i = 0; i < 0x10000; i++)
         {
           if ((inb (CONTROL_REG) & 0x02) == 0)
             break;
diff --git a/src/devices/shutdown.h b/src/devices/shutdown.h
index 0bc5657..7bcef19 100644
--- a/src/devices/shutdown.h
+++ b/src/devices/shutdown.h
@@ -1,7 +1,9 @@
 #ifndef DEVICES_SHUTDOWN_H
 #define DEVICES_SHUTDOWN_H
 
-void shutdown_reboot (void);
-void shutdown_power_off (void);
+#include <debug.h>
+
+void shutdown_reboot (void) NO_RETURN;
+void shutdown_power_off (void) NO_RETURN;
 
 #endif /* devices/shutdown.h */