diff options
-rw-r--r-- | sys/arch/alpha/alpha/machdep.c | 27 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 25 | ||||
-rw-r--r-- | sys/arch/arm/arm/stubs.c | 16 | ||||
-rw-r--r-- | sys/arch/aviion/aviion/machdep.c | 14 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/machdep.c | 14 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/autoconf.c | 28 | ||||
-rw-r--r-- | sys/arch/hppa64/hppa64/autoconf.c | 28 | ||||
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 15 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/machdep.c | 14 | ||||
-rw-r--r-- | sys/arch/mac68k/mac68k/machdep.c | 14 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/machdep.c | 17 | ||||
-rw-r--r-- | sys/arch/mvme68k/mvme68k/machdep.c | 14 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 14 | ||||
-rw-r--r-- | sys/arch/mvmeppc/mvmeppc/autoconf.c | 16 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/machdep.c | 22 | ||||
-rw-r--r-- | sys/arch/sh/sh/sh_machdep.c | 20 | ||||
-rw-r--r-- | sys/arch/solbourne/solbourne/machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/machdep.c | 12 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/machdep.c | 12 | ||||
-rw-r--r-- | sys/arch/vax/vax/machdep.c | 21 |
20 files changed, 121 insertions, 226 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index b14871b78c0..d130bc4bea8 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.108 2007/05/26 20:26:50 pedro Exp $ */ +/* $OpenBSD: machdep.c,v 1.109 2007/05/29 20:36:47 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */ /*- @@ -1199,41 +1199,30 @@ cpu_dump() * reduce the chance that swapping trashes it. */ void -dumpconf() +dumpconf(void) { int nblks, dumpblks; /* size of dump area */ - int maj; - if (dumpdev == NODEV) - goto bad; - maj = major(dumpdev); - if (maj < 0 || maj >= nblkdev) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); - if (bdevsw[maj].d_psize == NULL) - goto bad; - nblks = (*bdevsw[maj].d_psize)(dumpdev); + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) + return; if (nblks <= ctod(1)) - goto bad; + return; dumpblks = cpu_dumpsize(); if (dumpblks < 0) - goto bad; + return; dumpblks += ctod(cpu_dump_mempagecnt()); /* If dump won't fit (incl. room for possible label), punt. */ if (dumpblks > (nblks - ctod(1))) - goto bad; + return; /* Put dump at end of partition */ dumplo = nblks - dumpblks; /* dumpsize is in page units, and doesn't include headers. */ dumpsize = cpu_dump_mempagecnt(); - return; - -bad: - dumpsize = 0; - return; } /* diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 823f5d96da0..ac74697d2ea 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.57 2007/05/26 20:26:50 pedro Exp $ */ +/* $OpenBSD: machdep.c,v 1.58 2007/05/29 20:36:47 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -863,39 +863,28 @@ cpu_dump(void) void dumpconf(void) { - const struct bdevsw *bdev; int nblks, dumpblks; /* size of dump area */ - if (dumpdev == NODEV) - goto bad; - bdev = &bdevsw[major(dumpdev)]; - - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); - if (bdev->d_psize == NULL) - goto bad; - nblks = (*bdev->d_psize)(dumpdev); + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) + return; if (nblks <= ctod(1)) - goto bad; + return; dumpblks = cpu_dumpsize(); if (dumpblks < 0) - goto bad; + return; dumpblks += ctod(cpu_dump_mempagecnt()); /* If dump won't fit (incl. room for possible label), punt. */ if (dumpblks > (nblks - ctod(1))) - goto bad; + return; /* Put dump at end of partition */ dumplo = nblks - dumpblks; /* dumpsize is in page units, and doesn't include headers. */ dumpsize = cpu_dump_mempagecnt(); - return; - - bad: - dumpsize = 0; } /* diff --git a/sys/arch/arm/arm/stubs.c b/sys/arch/arm/arm/stubs.c index 5d595a7568d..7565e137d38 100644 --- a/sys/arch/arm/arm/stubs.c +++ b/sys/arch/arm/arm/stubs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stubs.c,v 1.3 2007/05/19 15:49:05 miod Exp $ */ +/* $OpenBSD: stubs.c,v 1.4 2007/05/29 20:36:47 deraadt Exp $ */ /* $NetBSD: stubs.c,v 1.14 2003/07/15 00:24:42 lukem Exp $ */ /* @@ -80,19 +80,13 @@ struct pcb dumppcb; void dumpconf(void); void -dumpconf() +dumpconf(void) { - const struct bdevsw *bdev; - int block, nblks; + int nblks, block; - if (dumpdev == NODEV) - return; - bdev = bdevsw_lookup(dumpdev); - if (bdev == NULL) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); - if (bdev->d_psize == NULL) + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) return; - nblks = (*bdev->d_psize)(dumpdev); if (nblks <= ctod(1)) return; diff --git a/sys/arch/aviion/aviion/machdep.c b/sys/arch/aviion/aviion/machdep.c index 75cd1b4ddf5..55ed1f2843d 100644 --- a/sys/arch/aviion/aviion/machdep.c +++ b/sys/arch/aviion/aviion/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.8 2007/05/27 17:31:55 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.9 2007/05/29 20:36:47 deraadt Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -417,19 +417,13 @@ cpu_kcore_hdr_t cpu_kcore_hdr; * reduce the chance that swapping trashes it. */ void -dumpconf() +dumpconf(void) { int nblks; /* size of dump area */ - int maj; - if (dumpdev == NODEV) - return; - maj = major(dumpdev); - if (maj < 0 || maj >= nblkdev) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); - if (bdevsw[maj].d_psize == NULL) + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) return; - nblks = (*bdevsw[maj].d_psize)(dumpdev); if (nblks <= ctod(1)) return; diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c index 5726190a6d1..0feb6c02e46 100644 --- a/sys/arch/hp300/hp300/machdep.c +++ b/sys/arch/hp300/hp300/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.113 2007/05/27 17:31:56 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.114 2007/05/29 20:36:47 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.121 1999/03/26 23:41:29 mycroft Exp $ */ /* @@ -717,19 +717,13 @@ cpu_kcore_hdr_t cpu_kcore_hdr; * reduce the chance that swapping trashes it. */ void -dumpconf() +dumpconf(void) { int nblks; /* size of dump area */ - int maj; - if (dumpdev == NODEV) - return; - maj = major(dumpdev); - if (maj < 0 || maj >= nblkdev) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); - if (bdevsw[maj].d_psize == NULL) + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) return; - nblks = (*bdevsw[maj].d_psize)(dumpdev); if (nblks <= ctod(1)) return; diff --git a/sys/arch/hppa/hppa/autoconf.c b/sys/arch/hppa/hppa/autoconf.c index 09e7fbb5864..3bd841ab4ca 100644 --- a/sys/arch/hppa/hppa/autoconf.c +++ b/sys/arch/hppa/hppa/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.47 2007/05/04 19:30:55 deraadt Exp $ */ +/* $OpenBSD: autoconf.c,v 1.48 2007/05/29 20:36:47 deraadt Exp $ */ /* * Copyright (c) 1998-2003 Michael Shalayeff @@ -149,37 +149,27 @@ dumpconf(void) { extern int dumpsize; int nblks, dumpblks; /* size of dump area */ - int maj; - - if (dumpdev == NODEV) - goto bad; - maj = major(dumpdev); - if (maj < 0 || maj >= nblkdev) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); - if (bdevsw[maj].d_psize == NULL) - goto bad; - nblks = (*bdevsw[maj].d_psize)(dumpdev); + + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) + return; if (nblks <= ctod(1)) - goto bad; + return; + dumpblks = cpu_dumpsize(); if (dumpblks < 0) - goto bad; + return; dumpblks += ctod(physmem); /* If dump won't fit (incl. room for possible label), punt. */ if (dumpblks > (nblks - ctod(1))) - goto bad; + return; /* Put dump at end of partition */ dumplo = nblks - dumpblks; /* dumpsize is in page units, and doesn't include headers. */ dumpsize = physmem; - return; - -bad: - dumpsize = 0; - return; } void diff --git a/sys/arch/hppa64/hppa64/autoconf.c b/sys/arch/hppa64/hppa64/autoconf.c index 867c32f3876..b6157615ba7 100644 --- a/sys/arch/hppa64/hppa64/autoconf.c +++ b/sys/arch/hppa64/hppa64/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.7 2007/05/04 19:30:55 deraadt Exp $ */ +/* $OpenBSD: autoconf.c,v 1.8 2007/05/29 20:36:47 deraadt Exp $ */ /* * Copyright (c) 1998-2005 Michael Shalayeff @@ -180,37 +180,27 @@ dumpconf(void) { extern int dumpsize; int nblks, dumpblks; /* size of dump area */ - int maj; - - if (dumpdev == NODEV) - goto bad; - maj = major(dumpdev); - if (maj < 0 || maj >= nblkdev) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); - if (bdevsw[maj].d_psize == NULL) - goto bad; - nblks = (*bdevsw[maj].d_psize)(dumpdev); + + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) + return; if (nblks <= ctod(1)) - goto bad; + return; + dumpblks = cpu_dumpsize(); if (dumpblks < 0) - goto bad; + return; dumpblks += ctod(physmem); /* If dump won't fit (incl. room for possible label), punt. */ if (dumpblks > (nblks - ctod(1))) - goto bad; + return; /* Put dump at end of partition */ dumplo = nblks - dumpblks; /* dumpsize is in page units, and doesn't include headers. */ dumpsize = physmem; - return; - -bad: - dumpsize = 0; - return; } diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 225aca3a3c6..c0414bdadb0 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.395 2007/05/29 18:18:20 tom Exp $ */ +/* $OpenBSD: machdep.c,v 1.396 2007/05/29 20:36:47 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -2395,19 +2395,14 @@ haltsys: * reduce the chance that swapping trashes it. */ void -dumpconf() +dumpconf(void) { int nblks; /* size of dump area */ - int maj, i; + int i; - if (dumpdev == NODEV) - return; - maj = major(dumpdev); - if (maj < 0 || maj >= nblkdev) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); - if (bdevsw[maj].d_psize == NULL) + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) return; - nblks = (*bdevsw[maj].d_psize)(dumpdev); if (nblks <= ctod(1)) return; diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c index 0740740fc85..66f0ecfdf75 100644 --- a/sys/arch/luna88k/luna88k/machdep.c +++ b/sys/arch/luna88k/luna88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.42 2007/05/27 17:31:56 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.43 2007/05/29 20:36:47 deraadt Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -608,19 +608,13 @@ cpu_kcore_hdr_t cpu_kcore_hdr; * reduce the chance that swapping trashes it. */ void -dumpconf() +dumpconf(void) { int nblks; /* size of dump area */ - int maj; - if (dumpdev == NODEV) - return; - maj = major(dumpdev); - if (maj < 0 || maj >= nblkdev) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); - if (bdevsw[maj].d_psize == NULL) + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) return; - nblks = (*bdevsw[maj].d_psize)(dumpdev); if (nblks <= ctod(1)) return; diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c index 894a958c419..5c9ddc062cb 100644 --- a/sys/arch/mac68k/mac68k/machdep.c +++ b/sys/arch/mac68k/mac68k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.139 2007/05/27 17:31:56 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.140 2007/05/29 20:36:47 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.207 1998/07/08 04:39:34 thorpej Exp $ */ /* @@ -691,21 +691,15 @@ long dumplo = 0; /* blocks */ * that swapping trashes it. */ void -dumpconf() +dumpconf(void) { cpu_kcore_hdr_t *h = &cpu_kcore_hdr; int nblks; /* size of dump area */ - int maj; int i; - if (dumpdev == NODEV) - return; - maj = major(dumpdev); - if (maj < 0 || maj >= nblkdev) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); - if (bdevsw[maj].d_psize == NULL) + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) return; - nblks = (*bdevsw[maj].d_psize)(dumpdev); if (nblks <= ctod(1)) return; diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index d9f4d98be86..a287c034ca5 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.91 2007/05/26 20:26:51 pedro Exp $ */ +/* $OpenBSD: machdep.c,v 1.92 2007/05/29 20:36:47 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -734,27 +734,20 @@ long dumplo = -1; /* blocks */ * reduce the chance that swapping trashes it. */ void dumpconf(void); + void -dumpconf() +dumpconf(void) { int nblks; /* size of dump area */ - int maj; int i; - - if (dumpdev == NODEV) + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) return; - maj = major(dumpdev); - if (maj < 0 || maj >= nblkdev) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); - if (bdevsw[maj].d_psize == NULL) - return; - nblks = (*bdevsw[maj].d_psize)(dumpdev); if (nblks <= ctod(1)) return; /* Always skip the first block, in case there is a label there. */ - if (dumplo < ctod(1)) dumplo = ctod(1); diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c index 9e3f237df0c..678fcf0b11c 100644 --- a/sys/arch/mvme68k/mvme68k/machdep.c +++ b/sys/arch/mvme68k/mvme68k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.104 2007/05/29 18:10:43 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.105 2007/05/29 20:36:47 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -563,19 +563,13 @@ cpu_kcore_hdr_t cpu_kcore_hdr; * reduce the chance that swapping trashes it. */ void -dumpconf() +dumpconf(void) { int nblks; /* size of dump area */ - int maj; - if (dumpdev == NODEV) - return; - maj = major(dumpdev); - if (maj < 0 || maj >= nblkdev) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); - if (bdevsw[maj].d_psize == NULL) + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) return; - nblks = (*bdevsw[maj].d_psize)(dumpdev); if (nblks <= ctod(1)) return; diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index b9315357892..0b596a9f5ab 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.190 2007/05/27 17:31:57 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.191 2007/05/29 20:36:48 deraadt Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -531,19 +531,13 @@ cpu_kcore_hdr_t cpu_kcore_hdr; * reduce the chance that swapping trashes it. */ void -dumpconf() +dumpconf(void) { int nblks; /* size of dump area */ - int maj; - if (dumpdev == NODEV) - return; - maj = major(dumpdev); - if (maj < 0 || maj >= nblkdev) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); - if (bdevsw[maj].d_psize == NULL) + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) return; - nblks = (*bdevsw[maj].d_psize)(dumpdev); if (nblks <= ctod(1)) return; diff --git a/sys/arch/mvmeppc/mvmeppc/autoconf.c b/sys/arch/mvmeppc/mvmeppc/autoconf.c index f894373b15c..fafb7a88d12 100644 --- a/sys/arch/mvmeppc/mvmeppc/autoconf.c +++ b/sys/arch/mvmeppc/mvmeppc/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.16 2007/05/04 19:30:55 deraadt Exp $ */ +/* $OpenBSD: autoconf.c,v 1.17 2007/05/29 20:36:48 deraadt Exp $ */ /* * Copyright (c) 1996, 1997 Per Fogelstrom * Copyright (c) 1995 Theo de Raadt @@ -37,7 +37,7 @@ * from: Utah Hdr: autoconf.c 1.31 91/01/21 * * from: @(#)autoconf.c 8.1 (Berkeley) 6/10/93 - * $Id: autoconf.c,v 1.16 2007/05/04 19:30:55 deraadt Exp $ + * $Id: autoconf.c,v 1.17 2007/05/29 20:36:48 deraadt Exp $ */ /* @@ -126,19 +126,13 @@ long dumplo = -1; /* blocks */ */ #if 0 void -dumpconf() +dumpconf(void) { int nblks; /* size of dump area */ - int maj; - if (dumpdev == NODEV) + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) return; - maj = major(dumpdev); - if (maj < 0 || maj >= nblkdev) - panic("dumpconf: bad dumpdev=0x%x", dumpdev); - if (bdevsw[maj].d_psize == NULL) - return; - nblks = (*bdevsw[maj].d_psize)(dumpdev); if (nblks <= ctod(1)) return; diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c index 8dc772e5f39..7e73cb74824 100644 --- a/sys/arch/sgi/sgi/machdep.c +++ b/sys/arch/sgi/sgi/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.42 2007/05/27 17:31:57 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.43 2007/05/29 20:36:48 deraadt Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -942,18 +942,22 @@ int dumpsize = 0; /* also for savecore */ long dumplo = 0; void -dumpconf() +dumpconf(void) { int nblks; + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) + return; + if (nblks <= ctod(1)) + return; + dumpsize = ptoa(physmem); - if (dumpdev != NODEV && bdevsw[major(dumpdev)].d_psize) { - nblks = (*bdevsw[major(dumpdev)].d_psize)(dumpdev); - if (dumpsize > btoc(dbtob(nblks - dumplo))) - dumpsize = btoc(dbtob(nblks - dumplo)); - else if (dumplo == 0) - dumplo = nblks - btodb(ctob(physmem)); - } + if (dumpsize > btoc(dbtob(nblks - dumplo))) + dumpsize = btoc(dbtob(nblks - dumplo)); + else if (dumplo == 0) + dumplo = nblks - btodb(ctob(physmem)); + /* * Don't dump on the first page * in case the dump device includes a disk label. diff --git a/sys/arch/sh/sh/sh_machdep.c b/sys/arch/sh/sh/sh_machdep.c index bd90fafd92b..fbb17be337b 100644 --- a/sys/arch/sh/sh/sh_machdep.c +++ b/sys/arch/sh/sh/sh_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sh_machdep.c,v 1.14 2007/05/27 17:31:57 miod Exp $ */ +/* $OpenBSD: sh_machdep.c,v 1.15 2007/05/29 20:36:48 deraadt Exp $ */ /* $NetBSD: sh3_machdep.c,v 1.59 2006/03/04 01:13:36 uwe Exp $ */ /* @@ -368,26 +368,16 @@ allocsys(caddr_t v) } void -dumpconf() +dumpconf(void) { cpu_kcore_hdr_t *h = &cpu_kcore_hdr; u_int dumpextra, totaldumpsize; /* in disk blocks */ u_int seg, nblks; - int maj; - if (dumpdev == NODEV) - return; - - maj = major(dumpdev); - if (maj < 0 || maj >= nblkdev) { - printf("dumpconf: bad dumpdev=0x%x\n", dumpdev); - dumpdev = NODEV; - return; - } - if (bdevsw[maj].d_psize == NULL) + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) return; - nblks = (u_int)(*bdevsw[maj].d_psize)(dumpdev); - if (nblks <= btodb(1U)) + if (nblks <= ctod(1)) return; dumpsize = 0; diff --git a/sys/arch/solbourne/solbourne/machdep.c b/sys/arch/solbourne/solbourne/machdep.c index 7277e60a4c9..9fa6c9b9976 100644 --- a/sys/arch/solbourne/solbourne/machdep.c +++ b/sys/arch/solbourne/solbourne/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.3 2007/05/26 20:26:51 pedro Exp $ */ +/* $OpenBSD: machdep.c,v 1.4 2007/05/29 20:36:48 deraadt Exp $ */ /* OpenBSD: machdep.c,v 1.105 2005/04/11 15:13:01 deraadt Exp */ /* @@ -677,7 +677,7 @@ haltsys: /* XXX - needs to be written */ void -dumpconf() +dumpconf(void) { } diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c index 099d6bcddde..72a2514b88d 100644 --- a/sys/arch/sparc/sparc/machdep.c +++ b/sys/arch/sparc/sparc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.111 2007/05/26 20:26:51 pedro Exp $ */ +/* $OpenBSD: machdep.c,v 1.112 2007/05/29 20:36:48 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */ /* @@ -723,15 +723,15 @@ int dumpsize = 0; /* also for savecore */ long dumplo = 0; void -dumpconf() +dumpconf(void) { int nblks, dumpblks; - if (dumpdev == NODEV || bdevsw[major(dumpdev)].d_psize == 0) - /* No usable dump device */ + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) + return; + if (nblks <= ctod(1)) return; - - nblks = (*bdevsw[major(dumpdev)].d_psize)(dumpdev); dumpblks = ctod(physmem) + ctod(pmap_dumpsize()); if (dumpblks > (nblks - ctod(1))) diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index f0e910a0351..0962d15882a 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.89 2007/05/26 20:26:51 pedro Exp $ */ +/* $OpenBSD: machdep.c,v 1.90 2007/05/29 20:36:48 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -774,15 +774,15 @@ int dumpsize = 0; /* also for savecore */ long dumplo = 0; void -dumpconf() +dumpconf(void) { int nblks, dumpblks; - if (dumpdev == NODEV || bdevsw[major(dumpdev)].d_psize == 0) - /* No usable dump device */ + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) + return; + if (nblks <= ctod(1)) return; - - nblks = (*bdevsw[major(dumpdev)].d_psize)(dumpdev); dumpblks = ctod(physmem) + pmap_dumpsize(); if (dumpblks > (nblks - ctod(1))) diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c index 19b880d9196..c2ae7cfc0e0 100644 --- a/sys/arch/vax/vax/machdep.c +++ b/sys/arch/vax/vax/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.90 2007/05/27 17:31:57 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.91 2007/05/29 20:36:48 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.108 2000/09/13 15:00:23 thorpej Exp $ */ /* @@ -266,21 +266,24 @@ long dumplo = 0; cpu_kcore_hdr_t cpu_kcore_hdr; void -dumpconf() +dumpconf(void) { int nblks; + if (dumpdev == NODEV || + (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0) + return; + if (nblks <= ctod(1)) + return; + /* * XXX include the final RAM page which is not included in physmem. */ dumpsize = physmem + 1; - if (dumpdev != NODEV && bdevsw[major(dumpdev)].d_psize) { - nblks = (*bdevsw[major(dumpdev)].d_psize) (dumpdev); - if (dumpsize > btoc(dbtob(nblks - dumplo))) - dumpsize = btoc(dbtob(nblks - dumplo)); - else if (dumplo == 0) - dumplo = nblks - btodb(ctob(dumpsize)); - } + if (dumpsize > btoc(dbtob(nblks - dumplo))) + dumpsize = btoc(dbtob(nblks - dumplo)); + else if (dumplo == 0) + dumplo = nblks - btodb(ctob(dumpsize)); /* * Don't dump on the first block in case the dump |