[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
hurd-l4/wortel ia32-shutdown.c shutdown.c shutd...
From: |
Marcus Brinkmann |
Subject: |
hurd-l4/wortel ia32-shutdown.c shutdown.c shutd... |
Date: |
Sun, 07 Sep 2003 21:41:04 -0400 |
CVSROOT: /cvsroot/hurd
Module name: hurd-l4
Branch:
Changes by: Marcus Brinkmann <address@hidden> 03/09/07 21:41:04
Modified files:
wortel : ia32-shutdown.c shutdown.c shutdown.h wortel.c
wortel.h
Log message:
Add command line parsing.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/wortel/ia32-shutdown.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/wortel/shutdown.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/wortel/shutdown.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/wortel/wortel.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/wortel/wortel.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: hurd-l4/wortel/ia32-shutdown.c
diff -u hurd-l4/wortel/ia32-shutdown.c:1.1 hurd-l4/wortel/ia32-shutdown.c:1.2
--- hurd-l4/wortel/ia32-shutdown.c:1.1 Sun Sep 7 21:00:18 2003
+++ hurd-l4/wortel/ia32-shutdown.c Sun Sep 7 21:41:03 2003
@@ -27,20 +27,11 @@
#include "shutdown.h"
-void
-halt (void)
-{
- while (1)
- asm volatile ("hlt");
-}
-
-
/* There are three ways to reset an ia32 machine. The first way is to
make the corresponding BIOS call in real mode. The second way is
to program the keyboard controller to do it. The third way is to
triple fault the CPU by using an empty IDT and then causing a
fault. Any of these can fail on odd hardware. */
-
void
reset (void)
{
Index: hurd-l4/wortel/shutdown.c
diff -u hurd-l4/wortel/shutdown.c:1.1 hurd-l4/wortel/shutdown.c:1.2
--- hurd-l4/wortel/shutdown.c:1.1 Sun Sep 7 21:00:18 2003
+++ hurd-l4/wortel/shutdown.c Sun Sep 7 21:41:03 2003
@@ -22,6 +22,8 @@
#include <config.h>
#endif
+#include <l4.h>
+
#include "shutdown.h"
@@ -29,6 +31,13 @@
int shutdown_reset;
+void
+halt (void)
+{
+ l4_sleep (l4_never);
+}
+
+
void
shutdown (void)
{
Index: hurd-l4/wortel/shutdown.h
diff -u hurd-l4/wortel/shutdown.h:1.1 hurd-l4/wortel/shutdown.h:1.2
--- hurd-l4/wortel/shutdown.h:1.1 Sun Sep 7 21:00:18 2003
+++ hurd-l4/wortel/shutdown.h Sun Sep 7 21:41:03 2003
@@ -29,17 +29,18 @@
/* Reset the machine. */
void reset (void);
-/* Halt the machine. */
-void halt (void);
-
/* The generic code defines these functions. */
/* Reset the machine at failure, instead halting it. */
extern int shutdown_reset;
+/* Halt the machine. */
+void halt (void);
+
/* End the program with a failure. This can halt or reset the
system. */
void shutdown (void);
+
#endif /* _SHUTDOWN_H */
Index: hurd-l4/wortel/wortel.c
diff -u hurd-l4/wortel/wortel.c:1.1 hurd-l4/wortel/wortel.c:1.2
--- hurd-l4/wortel/wortel.c:1.1 Sun Sep 7 21:00:18 2003
+++ hurd-l4/wortel/wortel.c Sun Sep 7 21:41:03 2003
@@ -23,14 +23,105 @@
#include "wortel.h"
+
+/* True if debug mode is enabled. */
+int debug;
+
+
+static void
+parse_args (int argc, char *argv[])
+{
+ int i = 1;
+
+ while (i < argc)
+ {
+ if (!strcmp (argv[i], "--usage"))
+ {
+ i++;
+ printf ("Usage %s [OPTION...]\n", argv[0]);
+ printf ("Try `" PROGRAM_NAME " --help' for more information\n");
+ shutdown ();
+ }
+ else if (!strcmp (argv[i], "--help"))
+ {
+ struct output_driver **drv = output_drivers;
+
+ i++;
+ printf ("Usage: %s [OPTION...]\n"
+ "\n"
+ "Boot the Hurd system and wrap the L4 privileged system "
+ "calls.\n"
+ "\n"
+ " -o, --output DRV use output driver DRV\n"
+ " -D, --debug enable debug output\n"
+ " -h, --halt halt the system at error (default)\n"
+ " -r, --reboot reboot the system at error\n"
+ "\n"
+ " --usage print out some usage information and "
+ "exit\n"
+ " --help display this help and exit\n"
+ " --version output version information and exit\n"
+ "\n", argv[0]);
+
+ printf ("Valid output drivers are: ");
+ while (*drv)
+ {
+ printf ("%s", (*drv)->name);
+ if (drv == output_drivers)
+ printf (" (default)");
+ drv++;
+ if (*drv && (*drv)->name)
+ printf (", ");
+ else
+ printf (".\n\n");
+ }
+
+ printf ("Report bugs to " BUG_ADDRESS ".\n", argv[0]);
+ shutdown ();
+ }
+ else if (!strcmp (argv[i], "--version"))
+ {
+ i++;
+ printf (PROGRAM_NAME " " PACKAGE_VERSION "\n");
+ shutdown ();
+ }
+ else if (!strcmp (argv[i], "-o") || !strcmp (argv[i], "--output"))
+ {
+ i++;
+ if (!output_init (argv[i]))
+ panic ("Unknown output driver %s", argv[i]);
+ i++;
+ }
+ else if (!strcmp (argv[i], "-h") || !strcmp (argv[i], "--halt"))
+ {
+ i++;
+ shutdown_reset = 0;
+ }
+ else if (!strcmp (argv[i], "-r") || !strcmp (argv[i], "--reset"))
+ {
+ i++;
+ shutdown_reset = 1;
+ }
+ else if (!strcmp (argv[i], "-D") || !strcmp (argv[i], "--debug"))
+ {
+ i++;
+ debug = 1;
+ }
+ else if (argv[i][0] == '-')
+ panic ("Unsupported option %s", argv[i]);
+ else
+ panic ("Invalid non-option argument %s", argv[i]);
+ }
+}
-int debug = 1;
int
main (int argc, char *argv[])
{
- printf ("%s\n", PROGRAM_NAME);
+ parse_args (argc, argv);
+
+ debug (PROGRAM_NAME " " PACKAGE_VERSION "\n");
while (1)
l4_yield ();
Index: hurd-l4/wortel/wortel.h
diff -u hurd-l4/wortel/wortel.h:1.1 hurd-l4/wortel/wortel.h:1.2
--- hurd-l4/wortel/wortel.h:1.1 Sun Sep 7 21:00:18 2003
+++ hurd-l4/wortel/wortel.h Sun Sep 7 21:41:03 2003
@@ -25,6 +25,7 @@
#define PROGRAM_NAME "wortel"
+#define BUG_ADDRESS "<address@hidden>"
/* Print an error message and fail. */
#define panic(...) \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- hurd-l4/wortel ia32-shutdown.c shutdown.c shutd...,
Marcus Brinkmann <=