diff options
author | 2019-04-01 07:00:51 +0000 | |
---|---|---|
committer | 2019-04-01 07:00:51 +0000 | |
commit | 3c291078035c1a12e25bf03c18ca7b6280ff4755 (patch) | |
tree | 7b2eb1d3f59fdecb16c445c53ed06730f594caab /sys | |
parent | catch/hide errors from ifconfig carp in case there is no carp. (diff) | |
download | wireguard-openbsd-3c291078035c1a12e25bf03c18ca7b6280ff4755.tar.xz wireguard-openbsd-3c291078035c1a12e25bf03c18ca7b6280ff4755.zip |
fast track ddb> reboot command to skip anything which might panic again.
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 | 6 | ||||
-rw-r--r-- | sys/arch/arm64/arm64/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/armv7/armv7/armv7_machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/landisk/landisk/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/loongson/loongson/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/octeon/octeon/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/machdep.c | 9 | ||||
-rw-r--r-- | sys/arch/socppc/socppc/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/machdep.c | 6 | ||||
-rw-r--r-- | sys/ddb/db_command.c | 5 | ||||
-rw-r--r-- | sys/sys/reboot.h | 3 |
16 files changed, 77 insertions, 18 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index c35aadda31d..3a9d701e868 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.186 2018/07/10 04:19:59 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.187 2019/04/01 07:00:51 tedu Exp $ */ /* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */ /*- @@ -964,6 +964,9 @@ boot(int howto) int i; #endif + if ((howto & RB_RESET) != 0) + goto doreset; + if (cold) { if ((howto & RB_USERREQ) == 0) howto |= RB_HALT; @@ -1033,6 +1036,7 @@ haltsys: (*platform.powerdown)(); printf("WARNING: powerdown failed!\n"); } +doreset: printf("%s\n\n", (howto & RB_HALT) != 0 ? "halted." : "rebooting..."); prom_halt((howto & RB_HALT) != 0); diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 1481f230e33..d6a126b94fe 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.255 2019/02/18 08:26:20 yasuoka Exp $ */ +/* $OpenBSD: machdep.c,v 1.256 2019/04/01 07:00:51 tedu Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -827,6 +827,9 @@ boot(int howto) if ((howto & RB_POWERDOWN) != 0) lid_action = 0; + if ((howto & RB_RESET) != 0) + goto doreset; + if (cold) { if ((howto & RB_USERREQ) == 0) howto |= RB_HALT; @@ -878,6 +881,7 @@ haltsys: cnpollc(0); } +doreset: printf("rebooting...\n"); if (cpureset_delay > 0) delay(cpureset_delay * 1000); diff --git a/sys/arch/arm64/arm64/machdep.c b/sys/arch/arm64/arm64/machdep.c index 331c6c3c8d3..1ac2e03c4b7 100644 --- a/sys/arch/arm64/arm64/machdep.c +++ b/sys/arch/arm64/arm64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.37 2019/01/31 14:35:06 patrick Exp $ */ +/* $OpenBSD: machdep.c,v 1.38 2019/04/01 07:00:51 tedu Exp $ */ /* * Copyright (c) 2014 Patrick Wildt <patrick@blueri.se> * @@ -369,6 +369,9 @@ int waittime = -1; __dead void boot(int howto) { + if ((howto & RB_RESET) != 0) + goto doreset; + if (cold) { if ((howto & RB_USERREQ) == 0) howto |= RB_HALT; @@ -412,6 +415,7 @@ haltsys: cngetc(); } +doreset: printf("rebooting...\n"); delay(500000); if (cpuresetfn) diff --git a/sys/arch/armv7/armv7/armv7_machdep.c b/sys/arch/armv7/armv7/armv7_machdep.c index d9d512d990d..11db647cfc2 100644 --- a/sys/arch/armv7/armv7/armv7_machdep.c +++ b/sys/arch/armv7/armv7/armv7_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: armv7_machdep.c,v 1.56 2018/10/26 20:28:40 kettenis Exp $ */ +/* $OpenBSD: armv7_machdep.c,v 1.57 2019/04/01 07:00:51 tedu Exp $ */ /* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */ /* @@ -221,6 +221,9 @@ void (*powerdownfn)(void); __dead void boot(int howto) { + if ((howto & RB_RESET) != 0) + goto doreset; + if (cold) { if ((howto & RB_USERREQ) == 0) howto |= RB_HALT; @@ -268,6 +271,7 @@ haltsys: cngetc(); } +doreset: printf("rebooting...\n"); delay(500000); if (cpuresetfn) diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index 659f6d8772b..8d90b560c11 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.254 2018/07/20 01:30:30 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.255 2019/04/01 07:00:51 tedu Exp $ */ /* * Copyright (c) 1999-2003 Michael Shalayeff @@ -876,6 +876,9 @@ int waittime = -1; __dead void boot(int howto) { + if ((howto & RB_RESET) != 0) + goto doreset; + /* * On older systems without software power control, prevent mi code * from spinning disks off, in case the operator changes his mind @@ -936,6 +939,7 @@ haltsys: __asm volatile("stwas %0, 0(%1)" :: "r" (CMD_STOP), "r" (HPPA_LBCAST + iomod_command)); } else { +doreset: printf("rebooting..."); DELAY(2000000); diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index dcd73684aae..6519d8823e1 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.629 2019/01/19 20:45:06 tedu Exp $ */ +/* $OpenBSD: machdep.c,v 1.630 2019/04/01 07:00:51 tedu Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -2682,6 +2682,9 @@ boot(int howto) if ((howto & RB_POWERDOWN) != 0) lid_action = 0; + if ((howto & RB_RESET) != 0) + goto doreset; + if (cold) { if ((howto & RB_USERREQ) == 0) howto |= RB_HALT; @@ -2758,6 +2761,7 @@ haltsys: cnpollc(0); } +doreset: printf("rebooting...\n"); cpu_reset(); for (;;) diff --git a/sys/arch/landisk/landisk/machdep.c b/sys/arch/landisk/landisk/machdep.c index 9df9c4ee79a..48de8c85ee4 100644 --- a/sys/arch/landisk/landisk/machdep.c +++ b/sys/arch/landisk/landisk/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.46 2017/12/11 05:27:40 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.47 2019/04/01 07:00:52 tedu Exp $ */ /* $NetBSD: machdep.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */ /*- @@ -194,6 +194,9 @@ landisk_startup(int howto, char *_esym) __dead void boot(int howto) { + if ((howto & RB_RESET) != 0) + goto doreset; + if (cold) { if ((howto & RB_USERREQ) == 0) howto |= RB_HALT; @@ -238,6 +241,7 @@ haltsys: cnpollc(0); } +doreset: printf("rebooting...\n"); machine_reset(); diff --git a/sys/arch/loongson/loongson/machdep.c b/sys/arch/loongson/loongson/machdep.c index f7074a8c817..3e7d797f10b 100644 --- a/sys/arch/loongson/loongson/machdep.c +++ b/sys/arch/loongson/loongson/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.85 2019/03/17 05:06:36 visa Exp $ */ +/* $OpenBSD: machdep.c,v 1.86 2019/04/01 07:00:52 tedu Exp $ */ /* * Copyright (c) 2009, 2010, 2014 Miodrag Vallat. @@ -1050,6 +1050,9 @@ int waittime = -1; __dead void boot(int howto) { + if ((howto & RB_RESET) != 0) + goto doreset; + if (curproc) savectx(curproc->p_addr, 0); @@ -1095,6 +1098,7 @@ haltsys: } else printf("System Halt.\n"); } else { +doreset: void (*__reset)(void) = (void (*)(void))RESET_EXC_VEC; printf("System restart.\n"); if (sys_platform->reset != NULL) diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c index 89bc6e4d497..fbac67c917d 100644 --- a/sys/arch/luna88k/luna88k/machdep.c +++ b/sys/arch/luna88k/luna88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.127 2017/12/11 05:27:40 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.128 2019/04/01 07:00:52 tedu Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -418,6 +418,9 @@ cpu_startup() __dead void boot(int howto) { + if ((howto & RB_RESET) != 0) + goto doreset; + if (curproc && curproc->p_addr) savectx(curpcb); @@ -459,6 +462,7 @@ haltsys: if ((howto & RB_HALT) != 0) { printf("halted\n\n"); } else { +doreset: /* Reset all cpus, which causes reboot */ *((volatile uint32_t *)RESET_CPU_ALL) = 0; } diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index 796fab837ef..41bd8bed371 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.184 2018/07/10 04:19:59 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.185 2019/04/01 07:00:52 tedu Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -733,6 +733,9 @@ boot(int howto) { static int syncing; + if ((howto & RB_RESET) != 0) + goto doreset; + if (cold) { if ((howto & RB_USERREQ) == 0) howto |= RB_HALT; @@ -775,6 +778,7 @@ haltsys: printf("halted\n\n"); OF_exit(); } +doreset: printf("rebooting\n\n"); #if NADB > 0 diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c index b2258c9b1a8..2715a82630a 100644 --- a/sys/arch/octeon/octeon/machdep.c +++ b/sys/arch/octeon/octeon/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.108 2018/12/18 14:24:02 visa Exp $ */ +/* $OpenBSD: machdep.c,v 1.109 2019/04/01 07:00:52 tedu Exp $ */ /* * Copyright (c) 2009, 2010 Miodrag Vallat. @@ -764,6 +764,9 @@ int waittime = -1; __dead void boot(int howto) { + if ((howto & RB_RESET) != 0) + goto doreset; + if (curproc) savectx(curproc->p_addr, 0); @@ -803,6 +806,7 @@ haltsys: else printf("System Halt.\n"); } else { +doreset: printf("System restart.\n"); (void)disableintr(); tlb_set_wired(0); diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c index 272883332c8..1efaad2d35d 100644 --- a/sys/arch/sgi/sgi/machdep.c +++ b/sys/arch/sgi/sgi/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.159 2019/03/17 05:06:36 visa Exp $ */ +/* $OpenBSD: machdep.c,v 1.160 2019/04/01 07:00:52 tedu Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -822,6 +822,9 @@ int waittime = -1; __dead void boot(int howto) { + if ((howto & RB_RESET) != 0) + goto doreset; + if (curproc) savectx(curproc->p_addr, 0); @@ -859,8 +862,10 @@ haltsys: printf("System Power Down.\n"); else printf("System Halt.\n"); - } else + } else { +doreset: printf("System restart.\n"); + } delay(1000000); md_halt(howto); diff --git a/sys/arch/socppc/socppc/machdep.c b/sys/arch/socppc/socppc/machdep.c index 3d85b121358..c5e39b94d31 100644 --- a/sys/arch/socppc/socppc/machdep.c +++ b/sys/arch/socppc/socppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.76 2018/07/16 08:53:44 jsg Exp $ */ +/* $OpenBSD: machdep.c,v 1.77 2019/04/01 07:00:52 tedu Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -648,6 +648,9 @@ boot(int howto) { static int syncing; + if ((howto & RB_RESET) != 0) + goto doreset; + if (cold) { if ((howto & RB_USERREQ) == 0) howto |= RB_HALT; @@ -687,6 +690,7 @@ haltsys: continue; /* NOTREACHED */ } +doreset: printf("rebooting\n\n"); { diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index 9deec63d527..ab10aedb977 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.190 2018/07/10 04:19:59 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.191 2019/04/01 07:00:52 tedu Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -596,6 +596,9 @@ boot(int howto) int i; static char str[128]; + if ((howto & RB_RESET) != 0) + goto doreset; + if (cold) { if ((howto & RB_USERREQ) == 0) howto |= RB_HALT; @@ -650,6 +653,7 @@ haltsys: panic("PROM exit failed"); } +doreset: printf("rebooting\n\n"); #if 0 if (user_boot_string && *user_boot_string) { diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index 4f9244cdb9d..d1eccefdfa4 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_command.c,v 1.84 2018/09/18 18:36:27 anton Exp $ */ +/* $OpenBSD: db_command.c,v 1.85 2019/04/01 07:00:52 tedu Exp $ */ /* $NetBSD: db_command.c,v 1.20 1996/03/30 22:30:05 christos Exp $ */ /* @@ -105,6 +105,7 @@ void db_boot_crash_cmd(db_expr_t, int, db_expr_t, char *); void db_boot_dump_cmd(db_expr_t, int, db_expr_t, char *); void db_boot_halt_cmd(db_expr_t, int, db_expr_t, char *); void db_boot_reboot_cmd(db_expr_t, int, db_expr_t, char *); +void db_boot_reset_cmd(db_expr_t, int, db_expr_t, char *); void db_boot_poweroff_cmd(db_expr_t, int, db_expr_t, char *); void db_stack_trace_cmd(db_expr_t, int, db_expr_t, char *); void db_dmesg_cmd(db_expr_t, int, db_expr_t, char *); @@ -812,7 +813,7 @@ db_boot_halt_cmd(db_expr_t addr, int haddr, db_expr_t count, char *modif) void db_boot_reboot_cmd(db_expr_t addr, int haddr, db_expr_t count, char *modif) { - db_reboot(RB_AUTOBOOT | RB_NOSYNC | RB_TIMEBAD | RB_USERREQ); + boot(RB_RESET | RB_AUTOBOOT | RB_NOSYNC | RB_TIMEBAD | RB_USERREQ); } void diff --git a/sys/sys/reboot.h b/sys/sys/reboot.h index f82d87a8e9d..492b554c1d2 100644 --- a/sys/sys/reboot.h +++ b/sys/sys/reboot.h @@ -1,4 +1,4 @@ -/* $OpenBSD: reboot.h,v 1.17 2014/07/11 14:36:44 uebayasi Exp $ */ +/* $OpenBSD: reboot.h,v 1.18 2019/04/01 07:00:52 tedu Exp $ */ /* $NetBSD: reboot.h,v 1.9 1996/04/22 01:23:25 christos Exp $ */ /* @@ -56,6 +56,7 @@ #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) */ +#define RB_RESET 0x8000 /* just reset, no cleanup */ /* * Constants for converting boot-style device number to type, |