Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src Pull up following revision(s) (requested by martin in tic...
details: https://anonhg.NetBSD.org/src/rev/b5072a3e7cea
branches: netbsd-6
changeset: 775757:b5072a3e7cea
user: bouyer <bouyer%NetBSD.org@localhost>
date: Sat Apr 20 09:58:22 2013 +0000
description:
Pull up following revision(s) (requested by martin in ticket #865):
sys/arch/vax/include/disklabel.h: revision 1.7
sys/arch/vax/boot/xxboot/start.S: revision 1.5
sys/sys/bootblock.h: revision 1.55
sys/sys/disklabel.h: revision 1.113
usr.sbin/installboot/arch/vax.c: revision 1.14
usr.sbin/installboot/arch/vax.c: revision 1.15
sys/kern/sys_generic.c: revision 1.129
Revert VAX MAXPARTITION bump to 16, adjusting it to 12 instead. Fix bootblocks
and installboot for VAX 780 and other machines booting via VMB.EXE.
diffstat:
sys/arch/vax/boot/xxboot/start.S | 39 +++++++++-------
sys/arch/vax/include/disklabel.h | 14 ++++-
sys/kern/sys_generic.c | 45 +++++++++++++++++-
sys/sys/bootblock.h | 6 +-
sys/sys/disklabel.h | 4 +-
usr.sbin/installboot/arch/vax.c | 95 ++++++++++++++++-----------------------
6 files changed, 119 insertions(+), 84 deletions(-)
diffs (truncated from 456 to 300 lines):
diff -r b2d708d19690 -r b5072a3e7cea sys/arch/vax/boot/xxboot/start.S
--- a/sys/arch/vax/boot/xxboot/start.S Sat Apr 20 09:52:19 2013 +0000
+++ b/sys/arch/vax/boot/xxboot/start.S Sat Apr 20 09:58:22 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: start.S,v 1.4 2005/12/11 12:19:34 christos Exp $ */
+/* $NetBSD: start.S,v 1.4.118.1 2013/04/20 09:58:23 bouyer Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -38,6 +38,7 @@
#define _LOCORE
+#define __HAVE_OLD_DISKLABEL /* not automatically added due to _LOCORE */
#define OMIT_DKTYPENUMS
#define OMIT_FSTYPENUMS
#include "sys/disklabel.h"
@@ -55,8 +56,12 @@
.org 0x00 # uVAX booted from TK50 starts here
brb from_0x00 # continue behind dispatch-block
+# At offset 0x02 we have a dual used area: VMB.EXE starts execution here,
+# and uVAX-ROM looks for a pointer to a parameter block. We arrange for
+# the parameter block offset to disassmble as a CASEL instructions which
+# falls through to 0x08.
.org 0x02 # information used by uVAX-ROM
- .byte 0xcf # offset in words to identification area
+ .byte 0xcf # offset in words to identification area
.byte 1 # this byte must be 1
.word 0 # logical block number (word swapped)
.word 0 # of the secondary image
@@ -74,20 +79,6 @@
from_0x08: # Any machine from VMB
movzbl $4,_C_LABEL(from) # Booted from full VMB
- brw start_vmb
-
-# the complete area reserved for label
-# must be empty (i.e. filled with zeroes).
-# disklabel(8) checks that before installing
-# the bootblocks over existing label.
-
-.org LABELOFFSET
- .globl _C_LABEL(romlabel)
-_C_LABEL(romlabel):
- .long 0
-
-.org LABELOFFSET + d_end_
-start_vmb:
/*
* Read in block 1-15.
*/
@@ -102,6 +93,20 @@
calls $6, (%r6) # call the qio-routine
brw start_uvax
+# the complete area reserved for label
+# must be empty (i.e. filled with zeroes).
+# disklabel(8) checks that before installing
+# the bootblocks over existing label.
+
+.org LABELOFFSET
+ .globl _C_LABEL(romlabel)
+_C_LABEL(romlabel):
+ .long 0
+
+.org LABELOFFSET + d_end_
+# Make sure the parameter block is past the disklabel.
+# If not, the next .org would try to move backwards.
+
/*
* Parameter block for uVAX boot.
*/
@@ -110,7 +115,7 @@
#define SILOAD 0 /* load offset (usually 0) from the default */
#define SIOFF 0x200 /* byte offset into secondary image */
-.org 0x19e
+.org 0x19e # do not move, see comment earlier about CASEL
.byte 0x18 # must be 0x18
.byte 0x00 # must be 0x00 (MBZ)
.byte 0x00 # any value
diff -r b2d708d19690 -r b5072a3e7cea sys/arch/vax/include/disklabel.h
--- a/sys/arch/vax/include/disklabel.h Sat Apr 20 09:52:19 2013 +0000
+++ b/sys/arch/vax/include/disklabel.h Sat Apr 20 09:58:22 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disklabel.h,v 1.5.8.1 2012/07/05 18:16:14 riz Exp $ */
+/* $NetBSD: disklabel.h,v 1.5.8.2 2013/04/20 09:58:22 bouyer Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou
@@ -36,16 +36,24 @@
#define LABELUSESMBR 0 /* no MBR partitionning */
#define LABELSECTOR 0 /* sector containing label */
#define LABELOFFSET 64 /* offset of label in sector */
-#define MAXPARTITIONS 16 /* number of partitions */
+#define MAXPARTITIONS 12 /* number of partitions */
#define OLDMAXPARTITIONS 8 /* number of partitions before nb-6 */
#define RAW_PART 2 /* raw partition: xx?c */
+/*
+ * In NetBSD 6 we eroneously used a too large MAXPARTITIONS value (disklabel
+ * overlapped with important parts of the bootblocks and made some machines
+ * unbootable).
+ */
+#define __TMPBIGMAXPARTITIONS 16 /* compatibility with 6.0 installs */
/*
* We use the highest bit of the minor number for the partition number.
* This maintains backward compatibility with device nodes created before
* MAXPARTITIONS was increased.
+ * Temporarily MAXPARTITIONS was 16, so we use that to keep compatibility
+ * with existing installations.
*/
-#define __VAX_MAXDISKS ((1 << 20) / MAXPARTITIONS)
+#define __VAX_MAXDISKS ((1 << 20) / __TMPBIGMAXPARTITIONS)
#define DISKUNIT(dev) ((minor(dev) / OLDMAXPARTITIONS) % __VAX_MAXDISKS)
#define DISKPART(dev) ((minor(dev) % OLDMAXPARTITIONS) + \
((minor(dev) / (__VAX_MAXDISKS * OLDMAXPARTITIONS)) * OLDMAXPARTITIONS))
diff -r b2d708d19690 -r b5072a3e7cea sys/kern/sys_generic.c
--- a/sys/kern/sys_generic.c Sat Apr 20 09:52:19 2013 +0000
+++ b/sys/kern/sys_generic.c Sat Apr 20 09:58:22 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_generic.c,v 1.128 2012/01/25 00:28:36 christos Exp $ */
+/* $NetBSD: sys_generic.c,v 1.128.2.1 2013/04/20 09:58:23 bouyer Exp $ */
/*-
* Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_generic.c,v 1.128 2012/01/25 00:28:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_generic.c,v 1.128.2.1 2013/04/20 09:58:23 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -526,6 +526,12 @@
void *data, *memp;
#define STK_PARAMS 128
u_long stkbuf[STK_PARAMS/sizeof(u_long)];
+#if __TMPBIGMAXPARTITIONS > MAXPARTITIONS
+ size_t zero_last = 0;
+#define zero_size(SZ) ((SZ)+zero_last)
+#else
+#define zero_size(SZ) (SZ)
+#endif
memp = NULL;
alloc_size = 0;
@@ -563,7 +569,34 @@
* but only copyin/out the smaller amount.
*/
if (IOCGROUP(com) == 'd') {
+#if __TMPBIGMAXPARTITIONS > MAXPARTITIONS
+ u_long ocom = com;
+#endif
u_long ncom = com ^ (DIOCGDINFO ^ DIOCGDINFO32);
+
+#if __TMPBIGMAXPARTITIONS > MAXPARTITIONS
+ /*
+ * Userland might use struct disklabel that is bigger than the
+ * the kernel version (historic accident) - alloc userland
+ * size and zero unused part on copyout.
+ */
+#define DISKLABELLENDIFF (sizeof(struct partition) \
+ *(__TMPBIGMAXPARTITIONS-MAXPARTITIONS))
+#define IOCFIXUP(NIOC) ((NIOC&~(IOCPARM_MASK<<IOCPARM_SHIFT)) | \
+ (IOCPARM_LEN(NIOC)-DISKLABELLENDIFF)<<IOCPARM_SHIFT)
+
+ switch (IOCFIXUP(ocom)) {
+ case DIOCGDINFO:
+ case DIOCWDINFO:
+ case DIOCSDINFO:
+ case DIOCGDEFLABEL:
+ com = ncom = IOCFIXUP(ocom);
+ zero_last = DISKLABELLENDIFF;
+ size -= DISKLABELLENDIFF;
+ goto done;
+ }
+#endif
+
switch (ncom) {
case DIOCGDINFO:
case DIOCWDINFO:
@@ -574,6 +607,9 @@
alloc_size = IOCPARM_LEN(DIOCGDINFO);
break;
}
+#if __TMPBIGMAXPARTITIONS > MAXPARTITIONS
+ done: ;
+#endif
}
if (size > IOCPARM_MAX) {
error = ENOTTY;
@@ -615,7 +651,7 @@
* Zero the buffer so the user always
* gets back something deterministic.
*/
- memset(data, 0, size);
+ memset(data, 0, zero_size(size));
} else if (com&IOC_VOID) {
*(void **)data = SCARG(uap, data);
}
@@ -648,7 +684,8 @@
* already set and checked above.
*/
if (error == 0 && (com&IOC_OUT) && size) {
- error = copyout(data, SCARG(uap, data), size);
+ error = copyout(data, SCARG(uap, data),
+ zero_size(size));
ktrgenio(SCARG(uap, fd), UIO_READ, SCARG(uap, data),
size, error);
}
diff -r b2d708d19690 -r b5072a3e7cea sys/sys/bootblock.h
--- a/sys/sys/bootblock.h Sat Apr 20 09:52:19 2013 +0000
+++ b/sys/sys/bootblock.h Sat Apr 20 09:58:22 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bootblock.h,v 1.52.14.1 2012/07/05 18:16:15 riz Exp $ */
+/* $NetBSD: bootblock.h,v 1.52.14.2 2013/04/20 09:58:23 bouyer Exp $ */
/*-
* Copyright (c) 2002-2004 The NetBSD Foundation, Inc.
@@ -1389,7 +1389,7 @@
uint8_t bb_mbone; /* must be one */
uint16_t bb_lbn_hi; /* lbn (hi word) of bootstrap */
uint16_t bb_lbn_low; /* lbn (low word) of bootstrap */
- uint8_t pad1[460];
+ uint8_t pad1[406];
/* disklabel offset is 64 from base, or 56 from start of pad1 */
/* The rest of these fields are identification area and describe
@@ -1412,7 +1412,7 @@
/* The rest is unused.
*/
- uint8_t pad2[20];
+ uint8_t pad2[74];
} __packed;
#define VAX_BOOT_MAGIC1 0x18 /* size of BB info? */
diff -r b2d708d19690 -r b5072a3e7cea sys/sys/disklabel.h
--- a/sys/sys/disklabel.h Sat Apr 20 09:52:19 2013 +0000
+++ b/sys/sys/disklabel.h Sat Apr 20 09:58:22 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disklabel.h,v 1.112 2012/01/16 18:47:58 christos Exp $ */
+/* $NetBSD: disklabel.h,v 1.112.2.1 2013/04/20 09:58:23 bouyer Exp $ */
/*
* Copyright (c) 1987, 1988, 1993
@@ -267,7 +267,7 @@
.set d_ncylinders,52
.set d_secpercyl,56
.set d_secperunit,60
- .set d_end_,276 /* size of disk label */
+ .set d_end_,148+(MAXPARTITIONS*16)
#endif /* _LOCORE */
/*
diff -r b2d708d19690 -r b5072a3e7cea usr.sbin/installboot/arch/vax.c
--- a/usr.sbin/installboot/arch/vax.c Sat Apr 20 09:52:19 2013 +0000
+++ b/usr.sbin/installboot/arch/vax.c Sat Apr 20 09:58:22 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vax.c,v 1.13 2009/04/05 11:55:39 lukem Exp $ */
+/* $NetBSD: vax.c,v 1.13.8.1 2013/04/20 09:58:23 bouyer Exp $ */
/*-
* Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@@ -68,20 +68,26 @@
#include <sys/cdefs.h>
#if !defined(__lint)
-__RCSID("$NetBSD: vax.c,v 1.13 2009/04/05 11:55:39 lukem Exp $");
+__RCSID("$NetBSD: vax.c,v 1.13.8.1 2013/04/20 09:58:23 bouyer Exp $");
#endif /* !__lint */
#include <sys/param.h>
+#include <sys/disklabel.h>
#include <assert.h>
#include <err.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include "installboot.h"
+#ifndef __CTASSERT
+#define __CTASSERT(X)
+#endif
+
static int load_bootstrap(ib_params *, char **,
uint32_t *, uint32_t *, size_t *);
@@ -101,7 +107,7 @@
assert(params != NULL);
assert(params->fsfd != -1);
assert(params->filesystem != NULL);
- assert(sizeof(struct vax_boot_block) == VAX_BOOT_BLOCK_BLOCKSIZE);
Home |
Main Index |
Thread Index |
Old Index