diff options
author | Tom Cosgrove <tom@cvs.openbsd.org> | 2004-03-10 23:02:55 +0000 |
---|---|---|
committer | Tom Cosgrove <tom@cvs.openbsd.org> | 2004-03-10 23:02:55 +0000 |
commit | 269e9b0ceb4a217d7841ca9a9f66e153e6d6e863 (patch) | |
tree | 8a958e6662d220297278df0c8b847dea06484b5f /sys | |
parent | c70330c0f96146989bd785f685bb0199742c1a40 (diff) |
Ensure that we obey a user's ddb> boot reboot command even if the system
is cold (during startup).
This adds RB_USERREQ to sys/reboot.h, uses it in the ddb commands, and
ensures that */*/machdep.c:boot() won't set RB_HALT when cold if this
flag is set.
ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/alpha/alpha/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 9 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/machdep.c | 10 | ||||
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 9 | ||||
-rw-r--r-- | sys/arch/mac68k/mac68k/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/mvme68k/mvme68k/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/vax/vax/machdep.c | 6 | ||||
-rw-r--r-- | sys/ddb/db_command.c | 14 | ||||
-rw-r--r-- | sys/sys/reboot.h | 3 |
13 files changed, 61 insertions, 32 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index c864042f82f..cbe22050ad6 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.85 2004/01/22 17:47:27 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.86 2004/03/10 23:02:53 tom Exp $ */ /* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */ /*- @@ -1093,7 +1093,9 @@ boot(howto) /* If system is cold, just halt. */ if (cold) { - howto |= RB_HALT; + /* (Unless the user explicitly asked for reboot.) */ + if ((howto & RB_USERREQ) == 0) + howto |= RB_HALT; goto haltsys; } diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 8647733a6fb..5e83e689c60 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.20 2004/03/09 23:06:38 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.21 2004/03/10 23:02:53 tom Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -843,7 +843,12 @@ boot(int howto) { if (cold) { - howto |= RB_HALT; + /* + * If the system is cold, just halt, unless the user + * explicitly asked for reboot. + */ + if ((howto & RB_USERREQ) == 0) + howto |= RB_HALT; goto haltsys; } diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c index 7926c7c6397..a5869c12a58 100644 --- a/sys/arch/hp300/hp300/machdep.c +++ b/sys/arch/hp300/hp300/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.90 2004/02/19 18:46:18 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.91 2004/03/10 23:02:53 tom Exp $ */ /* $NetBSD: machdep.c,v 1.121 1999/03/26 23:41:29 mycroft Exp $ */ /* @@ -743,7 +743,9 @@ boot(howto) /* If system is cold, just halt. */ if (cold) { - howto |= RB_HALT; + /* (Unless the user explicitly asked for reboot.) */ + if ((howto & RB_USERREQ) == 0) + howto |= RB_HALT; goto haltsys; } diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index f7a6d1bb5f4..a2b12d6226c 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.124 2004/02/14 15:09:22 grange Exp $ */ +/* $OpenBSD: machdep.c,v 1.125 2004/03/10 23:02:53 tom Exp $ */ /* * Copyright (c) 1999-2002 Michael Shalayeff @@ -935,9 +935,11 @@ boot(howto) int howto; { /* If system is cold, just halt. */ - if (cold) - howto |= RB_HALT; - else { + if (cold) { + /* (Unless the user explicitly asked for reboot.) */ + if ((howto & RB_USERREQ) == 0) + howto |= RB_HALT; + } else { boothowto = howto | (boothowto & RB_HALT); diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 1b227149c41..aca1e054107 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.284 2004/02/27 21:46:44 grange Exp $ */ +/* $OpenBSD: machdep.c,v 1.285 2004/03/10 23:02:53 tom Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -2411,7 +2411,12 @@ boot(howto) int howto; { if (cold) { - howto |= RB_HALT; + /* + * If the system is cold, just halt, unless the user + * explicitly asked for reboot. + */ + if ((howto & RB_USERREQ) == 0) + howto |= RB_HALT; goto haltsys; } diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c index 8800b095479..f3b77460ead 100644 --- a/sys/arch/mac68k/mac68k/machdep.c +++ b/sys/arch/mac68k/mac68k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.111 2004/02/19 18:46:18 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.112 2004/03/10 23:02:53 tom Exp $ */ /* $NetBSD: machdep.c,v 1.207 1998/07/08 04:39:34 thorpej Exp $ */ /* @@ -624,7 +624,9 @@ boot(howto) /* If system is cold, just halt. */ if (cold) { - howto |= RB_HALT; + /* (Unless the user explicitly asked for reboot.) */ + if ((howto & RB_USERREQ) == 0) + howto |= RB_HALT; goto haltsys; } diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c index 37878ce5651..e0d7f2ab9dd 100644 --- a/sys/arch/mvme68k/mvme68k/machdep.c +++ b/sys/arch/mvme68k/mvme68k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.82 2004/03/02 22:55:55 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.83 2004/03/10 23:02:54 tom Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -683,7 +683,9 @@ boot(howto) { /* If system is cold, just halt. */ if (cold) { - howto |= RB_HALT; + /* (Unless the user explicitly asked for reboot.) */ + if ((howto & RB_USERREQ) == 0) + howto |= RB_HALT; goto haltsys; } diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 4f30213e7d2..65da1b0b1e2 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.135 2004/02/19 15:33:53 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.136 2004/03/10 23:02:54 tom Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -1017,7 +1017,9 @@ boot(howto) /* If system is cold, just halt. */ if (cold) { - howto |= RB_HALT; + /* (Unless the user explicitly asked for reboot.) */ + if ((howto & RB_USERREQ) == 0) + howto |= RB_HALT; goto haltsys; } diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c index 05ace2756b9..03f9989c08f 100644 --- a/sys/arch/sparc/sparc/machdep.c +++ b/sys/arch/sparc/sparc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.97 2004/02/19 18:46:18 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.98 2004/03/10 23:02:54 tom Exp $ */ /* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */ /* @@ -682,7 +682,9 @@ boot(howto) /* If system is cold, just halt. */ if (cold) { - howto |= RB_HALT; + /* (Unless the user explicitly asked for reboot.) */ + if ((howto & RB_USERREQ) == 0) + howto |= RB_HALT; goto haltsys; } diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index d0242b840ca..f51f2621dd9 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.66 2004/02/19 18:46:18 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.67 2004/03/10 23:02:54 tom Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -783,7 +783,9 @@ boot(howto) /* If system is cold, just halt. */ if (cold) { - howto |= RB_HALT; + /* (Unless the user explicitly asked for reboot.) */ + if ((howto & RB_USERREQ) == 0) + howto |= RB_HALT; goto haltsys; } diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c index b10ece186df..5f73af1cfbe 100644 --- a/sys/arch/vax/vax/machdep.c +++ b/sys/arch/vax/vax/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.69 2003/11/07 10:16:45 jmc Exp $ */ +/* $OpenBSD: machdep.c,v 1.70 2004/03/10 23:02:54 tom Exp $ */ /* $NetBSD: machdep.c,v 1.108 2000/09/13 15:00:23 thorpej Exp $ */ /* @@ -496,7 +496,9 @@ boot(howto) { /* If system is cold, just halt. */ if (cold) { - howto |= RB_HALT; + /* (Unless the user explicitly asked for reboot.) */ + if ((howto & RB_USERREQ) == 0) + howto |= RB_HALT; goto haltsys; } diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index 3674e9088e9..819985b2553 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_command.c,v 1.32 2003/12/03 12:50:33 markus Exp $ */ +/* $OpenBSD: db_command.c,v 1.33 2004/03/10 23:02:53 tom Exp $ */ /* $NetBSD: db_command.c,v 1.20 1996/03/30 22:30:05 christos Exp $ */ /* @@ -611,7 +611,7 @@ db_boot_sync_cmd(addr, haddr, count, modif) db_expr_t count; char *modif; { - boot(RB_AUTOBOOT | RB_TIMEBAD); + boot(RB_AUTOBOOT | RB_TIMEBAD | RB_USERREQ); } void @@ -621,7 +621,7 @@ db_boot_crash_cmd(addr, haddr, count, modif) db_expr_t count; char *modif; { - boot(RB_NOSYNC | RB_DUMP | RB_TIMEBAD); + boot(RB_NOSYNC | RB_DUMP | RB_TIMEBAD | RB_USERREQ); } void @@ -631,7 +631,7 @@ db_boot_dump_cmd(addr, haddr, count, modif) db_expr_t count; char *modif; { - boot(RB_DUMP | RB_TIMEBAD); + boot(RB_DUMP | RB_TIMEBAD | RB_USERREQ); } void @@ -641,7 +641,7 @@ db_boot_halt_cmd(addr, haddr, count, modif) db_expr_t count; char *modif; { - boot(RB_NOSYNC | RB_HALT | RB_TIMEBAD); + boot(RB_NOSYNC | RB_HALT | RB_TIMEBAD | RB_USERREQ); } void @@ -651,7 +651,7 @@ db_boot_reboot_cmd(addr, haddr, count, modif) db_expr_t count; char *modif; { - boot(RB_AUTOBOOT | RB_NOSYNC | RB_TIMEBAD); + boot(RB_AUTOBOOT | RB_NOSYNC | RB_TIMEBAD | RB_USERREQ); } void @@ -661,7 +661,7 @@ db_boot_poweroff_cmd(addr, haddr, count, modif) db_expr_t count; char *modif; { - boot(RB_NOSYNC | RB_HALT | RB_POWERDOWN | RB_TIMEBAD); + boot(RB_NOSYNC | RB_HALT | RB_POWERDOWN | RB_TIMEBAD | RB_USERREQ); } void diff --git a/sys/sys/reboot.h b/sys/sys/reboot.h index a727a0c00c3..2385035731d 100644 --- a/sys/sys/reboot.h +++ b/sys/sys/reboot.h @@ -1,4 +1,4 @@ -/* $OpenBSD: reboot.h,v 1.12 2003/06/02 23:28:21 millert Exp $ */ +/* $OpenBSD: reboot.h,v 1.13 2004/03/10 23:02:53 tom Exp $ */ /* $NetBSD: reboot.h,v 1.9 1996/04/22 01:23:25 christos Exp $ */ /* @@ -52,6 +52,7 @@ #define RB_TIMEBAD 0x0800 /* don't call resettodr() in boot() */ #define RB_POWERDOWN 0x1000 /* attempt to power down machine */ #define RB_SERCONS 0x2000 /* use serial console if available */ +#define RB_USERREQ 0x4000 /* boot() called at user request (e.g. ddb) */ /* * Constants for converting boot-style device number to type, |