Port-vax archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: disklabel MAXPARTITIONS reversal (was: installboot is broken)



On Fri, Mar 29, 2013 at 05:56:59PM +0100, Martin Husemann wrote:
> Ah great - that will not give us much more room, but I'll see if I can
> squeeze in one or two partitions more.

I may have done something wrong, but it does not work.

I changed the bootcode a bit (only code moving around a bit to get everything
between LABELSTART and the parameter block free) and also made the offset
of the parameter block calculated by as.

This works fine, as long as I do not move the parameter block. Moving
it back or forward two bytes make the boot fail imediately:

Loading boot code from vmb.exe
%BOOT-F-Unexpected Exceptio
HALT instruction, PC: 000004C7 (BLBS 549,4C6)

(This is with 1a0 instead of 19e).

Did I miss adjusting anything for it?

For ease of review I am attaching the full start.S as well as the complete
patch (including all other changes).

The other changes I did are in installboot, bootblock.h (split out the 
parameter block so it could move) and disklabel.h (make d_end_ calculated
correctly), and (for now) set MAXPARTITIONS to 10 but keep the same devnode
allocations that we used for 16 partitions.

This all works on a VS 4000, MikroVax 3900 and a 780 (the latter two in simh).

If we could make the parameter block realy movable, we'd end up with 12
partitions.

Martin
P.S.: there are a few minor optiomizations possible in the boot code, but
they don't seem to gain enough additional space for another partition, so
I left the code as it is.

P.P.S.: it would be realy cool if simh would not busy-poll stdin for console
input - this voids the effort spent on idle detection.
/*      $NetBSD: start.S,v 1.4 2005/12/11 12:19:34 christos Exp $ */
/*
 * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
 * All rights reserved.
 *
 * This code is derived from software contributed to Ludd by
 * Bertram Barth.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *      This product includes software developed at Ludd, University of 
 *      Lule}, Sweden and its contributors.
 * 4. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

 /* All bugs are subject to removal without further notice */
                

#define _LOCORE

#define __HAVE_OLD_DISKLABEL    /* not automatically added due to _LOCORE */
#define OMIT_DKTYPENUMS
#define OMIT_FSTYPENUMS
#include "sys/disklabel.h"

#include "../include/mtpr.h"
#include "../include/asm.h"             

_C_LABEL(_start):
_C_LABEL(start):
        .globl _C_LABEL(start)  # this is the symbolic name for the start
        .globl _C_LABEL(_start) # of code to be relocated. We can use this
                                # to get the actual/real address (pc-rel)
                                # or to get the relocated address (abs).

.org    0x00                    # uVAX booted from TK50 starts here
        brb     from_0x00       # continue behind dispatch-block

.org    0x02                    # information used by uVAX-ROM
        .byte   (pblock-.)/2+1  # 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

.org    0x08                    #
        brb     from_0x08       # skip ...

.org    0x0C                    # 11/750  & 8200 starts here
        movzbl  $1,_C_LABEL(from)# We booted from "old" rom.
        brw     cont_750

from_0x00:                      # uVAX from TK50 
        brw     start_uvax      # all uVAXen continue there

from_0x08:                      # Any machine from VMB
        movzbl  $4,_C_LABEL(from)               # Booted from full VMB
        /*
         * Read in block 1-15.
         */
        movl    52(%r11), %r7   # load iovec/bqo into %r7
        addl3   (%r7), %r7, %r6 # load qio into %r6
        pushl   %r11            # base of rpb
        pushl   $0              # virtual-flag 
        pushl   $33             # read-logical-block
        pushl   $1              # lbn to start reading
        pushl   $7680           # number of bytes to read
        pushab  start_uvax      # buffer-address 
        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.
 */
#define VOLINFO         0       /* 1=single-sided  81=double-sided volumes */
#define SISIZE          16      /* size in blocks of secondary image */
#define SILOAD          0       /* load offset (usually 0) from the default */
#define SIOFF           0x200   /* byte offset into secondary image */

.org    0x19e
pblock:
        .byte   0x18            # must be 0x18 
        .byte   0x00            # must be 0x00 (MBZ) 
        .byte   0x00            # any value 
        .byte   0xFF - (0x18 + 0x00 + 0x00)     
                /* 4th byte holds 1s' complement of sum of previous 3 bytes */

        .byte   0x00            # must be 0x00 (MBZ) 
        .byte   VOLINFO
        .byte   0x00            # any value 
        .byte   0x00            # any value 

        .long   SISIZE          # size in blocks of secondary image 
        .long   SILOAD          # load offset (usually 0) 
        .long   SIOFF           # byte offset into secondary image 
        .long   (SISIZE + SILOAD + SIOFF)       # sum of previous 3 


        .align  2
        .globl  _C_LABEL(from)
_C_LABEL(from):
        .long   0


/*
 * After bootblock (LBN0) has been loaded into the first page 
 * of good memory by 11/750's ROM-code (transfer address
 * of bootblock-code is: base of good memory + 0x0C) registers
 * are initialized as:
 *      R0:     type of boot-device
 *                      0:      Massbus device
 *                      1:      RK06/RK07
 *                      2:      RL02
 *                      17:     UDA50
 *                      35:     TK50
 *                      64:     TU58
 *      R1:     (UBA) address of UNIBUS I/O-page
 *              (MBA) address of boot device's adapter
 *      R2:     (UBA) address of the boot device's CSR
 *              (MBA) controller number of boot device
 *      R6:     address of driver subroutine in ROM
 *
 * cont_750 reads in LBN1-15 for further execution.
 */
cont_750:
        movl    $_C_LABEL(start), %sp   # move stack to avoid clobbering the 
code
        pushr   $0x131          # save clobbered registers
        clrl    %r4             # %r4 == # of blocks transferred
        movab   _C_LABEL(start),%r5     # %r5 have base address for next 
transfer
        pushl   %r5             # ...on stack also (Why?)
1:      incl    %r4             # increment block count
        movl    %r4,%r8         # LBN is in %r8 for rom routine
        addl2   $0x200,%r5      # Increase address for next read
        cmpl    $16,%r4         # read 15 blocks?
        beql    2f              # Yep
        movl    %r5,(%sp)               # move address to stack also
        jsb     (%r6)           # read 512 bytes
        blbs    %r0,1b          # jump if read succeeded
        halt                    # otherwise die...
2:      tstl    (%sp)+          # remove boring arg from stack
        popr    $0x131          # restore clobbered registers
        brw     start_all       # Ok, continue...


/* uVAX main entry is at the start of the second disk block.  This is
 * needed for multi-arch CD booting where multiple architecture need
 * to shove stuff in boot block 0.
 */
        .org    0x200           # uVAX booted from disk starts here

start_uvax:
        movzbl  $2,_C_LABEL(from)       # Booted from subset-VMB
        brb     start_all

/*
 * start_all: stack already at RELOC, we save registers, move ourself
 * to RELOC and loads boot.
 */
start_all:
        movl    $_C_LABEL(start), %sp   # move stack to a better 
        pushr   $0x1fff                 # save all regs, used later.

        subl3   $_C_LABEL(start), $_C_LABEL(edata), %r0
                                        # get size of text+data (w/o bss)
        moval   _C_LABEL(start), %r1    # get actual base-address of code
        subl3   $_C_LABEL(start), $_C_LABEL(end), %r2
                                        # get complete size (incl. bss)
        movl    $_C_LABEL(start), %r3   # get relocated base-address of code
        movc5   %r0, (%r1), $0, %r2, (%r3)      # copy code to new location
        
        movpsl  -(%sp)
        movl    $relocated, -(%sp)      # return-address on top of stack 
        rei                             # can be replaced with new address
relocated:                              # now relocation is done !!!
        movl    %sp, _C_LABEL(bootregs)
        calls   $0, _C_LABEL(Xmain)     # call Xmain (gcc workaround)which is 
        halt                            # not intended to return ...

/*
 * hoppabort() is called when jumping to the newly loaded program.
 */
ENTRY(hoppabort, 0)
        movl    4(%ap),%r6
        movl    _C_LABEL(rpb),%r11
        mnegl   $1,%ap          # Hack to figure out boot device.
        movpsl  -(%sp)
        pushab  2(%r6)
        mnegl   $1,_C_LABEL(vax_load_failure)
        rei
#       calls   $0,(%r6)
        halt

ENTRY(unit_init, R6|R7|R8|R9|R10|R11)
        mfpr    $17,%r7                 # Wanted bu KDB
        movl    4(%ap),%r0              # init routine address
        movl    8(%ap),%r9              # RPB in %r9
        movl    12(%ap),%r1             # VMB argument list
        callg   (%r1),(%r0)
        ret

# A bunch of functions unwanted in boot blocks.
ENTRY(getchar, 0)
        halt

#ifndef USE_PRINTF
ENTRY(putchar, 0)
        ret

ENTRY(printf, 0)
        ret
#endif

ENTRY(panic, 0)
        halt
Index: sys/sys/bootblock.h
===================================================================
RCS file: /cvsroot/src/sys/sys/bootblock.h,v
retrieving revision 1.54
diff -u -r1.54 bootblock.h
--- sys/sys/bootblock.h 2 Jul 2012 22:42:18 -0000       1.54
+++ sys/sys/bootblock.h 30 Mar 2013 17:17:49 -0000
@@ -1402,15 +1402,38 @@
  *     VAX boot block information
  */
 
-struct vax_boot_block {
+#define        VAX_BOOT_MAGIC1                 0x18    /* size of BB info? */
+#define        VAX_BOOT_VOLINFO_NONE           0x00    /* no special info */
+#define        VAX_BOOT_VOLINFO_SS             0x01    /* single sided */
+#define        VAX_BOOT_VOLINFO_DS             0x81    /* double sided */
+
+#define        VAX_BOOT_SIZE                   15      /* 15 blocks */
+#define        VAX_BOOT_LOAD                   0       /* no load offset */
+#define        VAX_BOOT_ENTRY                  0x200   /* one block in */
+
+#define        VAX_BOOT_BLOCK_OFFSET           0
+#define        VAX_BOOT_BLOCK_BLOCKSIZE        512
+
+union vax_boot_block {
+       struct {
 /* Note that these don't overlap any of the pmax boot block */
-       uint8_t         pad0[2];
-       uint8_t         bb_id_offset;   /* offset in words to id (magic1)*/
-       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];
-       /* disklabel offset is 64 from base, or 56 from start of pad1 */
+               uint8_t         pad0[2];
+               uint8_t         bb_id_offset;   /* offset in words to id 
(magic1)*/
+               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 
*/
+               /* disklabel offset is 64 from base */
+       } bb;
+       char raw[VAX_BOOT_BLOCK_BLOCKSIZE];
+};
+
+/*
+ * This block resides inside the vax boot block, at a "variable"
+ * offset at bb_id_offset*2.
+ * Installboot(8) assumes there is no relevant code/data beween
+ * LABELOFFSET (64) and the start of this block.
+ */
+struct vax_boot_param_block {
 
        /* The rest of these fields are identification area and describe
         * the secondary block for uVAX VMB.
@@ -1435,18 +1458,6 @@
        uint8_t         pad2[20];
 } __packed;
 
-#define        VAX_BOOT_MAGIC1                 0x18    /* size of BB info? */
-#define        VAX_BOOT_VOLINFO_NONE           0x00    /* no special info */
-#define        VAX_BOOT_VOLINFO_SS             0x01    /* single sided */
-#define        VAX_BOOT_VOLINFO_DS             0x81    /* double sided */
-
-#define        VAX_BOOT_SIZE                   15      /* 15 blocks */
-#define        VAX_BOOT_LOAD                   0       /* no load offset */
-#define        VAX_BOOT_ENTRY                  0x200   /* one block in */
-
-#define        VAX_BOOT_BLOCK_OFFSET           0
-#define        VAX_BOOT_BLOCK_BLOCKSIZE        512
-
 
 /* ------------------------------------------
  * x68k
Index: sys/sys/disklabel.h
===================================================================
RCS file: /cvsroot/src/sys/sys/disklabel.h,v
retrieving revision 1.112
diff -u -r1.112 disklabel.h
--- sys/sys/disklabel.h 16 Jan 2012 18:47:58 -0000      1.112
+++ sys/sys/disklabel.h 30 Mar 2013 17:17:49 -0000
@@ -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 */
 
 /*
Index: usr.sbin/installboot/arch/vax.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/installboot/arch/vax.c,v
retrieving revision 1.13
diff -u -r1.13 vax.c
--- usr.sbin/installboot/arch/vax.c     5 Apr 2009 11:55:39 -0000       1.13
+++ usr.sbin/installboot/arch/vax.c     30 Mar 2013 17:17:49 -0000
@@ -72,12 +72,14 @@
 #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"
@@ -95,13 +97,13 @@
 static int
 vax_clearboot(ib_params *params)
 {
-       struct vax_boot_block   bb;
+       union vax_boot_block    bb;
+       struct vax_boot_param_block *bp;
        ssize_t                 rv;
 
        assert(params != NULL);
        assert(params->fsfd != -1);
        assert(params->filesystem != NULL);
-       assert(sizeof(struct vax_boot_block) == VAX_BOOT_BLOCK_BLOCKSIZE);
 
        rv = pread(params->fsfd, &bb, sizeof(bb), VAX_BOOT_BLOCK_OFFSET);
        if (rv == -1) {
@@ -112,17 +114,20 @@
                return (0);
        }
 
-       if (bb.bb_id_offset * 2 != offsetof(struct vax_boot_block, bb_magic1)
-           || bb.bb_magic1 != VAX_BOOT_MAGIC1) {
+       bp = NULL;
+       if (bb.bb.bb_id_offset*2+sizeof(*bp) <= VAX_BOOT_BLOCK_BLOCKSIZE)
+               bp = (struct vax_boot_param_block*)
+                   &bb.raw[bb.bb.bb_id_offset*2];
+       if (bp == NULL || bp->bb_magic1 != VAX_BOOT_MAGIC1) {
                warnx(
                    "Old boot block magic number invalid; boot block invalid");
                return (0);
        }
 
-       bb.bb_id_offset = 1;
-       bb.bb_mbone = 0;
-       bb.bb_lbn_hi = 0;
-       bb.bb_lbn_low = 0;
+       bb.bb.bb_id_offset = 1;
+       bb.bb.bb_mbone = 0;
+       bb.bb.bb_lbn_hi = 0;
+       bb.bb.bb_lbn_low = 0;
 
        if (params->flags & IB_SUNSUM) {
                uint16_t        sum;
@@ -154,10 +159,11 @@
 vax_setboot(ib_params *params)
 {
        struct stat             bootstrapsb;
-       struct vax_boot_block   bb;
+       union vax_boot_block    *bb;
+       struct vax_boot_param_block *bp;
        uint32_t                startblock;
        int                     retval;
-       char                    *bootstrapbuf;
+       char                    *bootstrapbuf, oldbb[VAX_BOOT_BLOCK_BLOCKSIZE];
        size_t                  bootstrapsize;
        uint32_t                bootstrapload, bootstrapexec;
        ssize_t                 rv;
@@ -167,8 +173,8 @@
        assert(params->filesystem != NULL);
        assert(params->s1fd != -1);
        assert(params->stage1 != NULL);
-       assert(sizeof(struct vax_boot_block) == VAX_BOOT_BLOCK_BLOCKSIZE);
 
+       startblock = 0;
        retval = 0;
        bootstrapbuf = NULL;
 
@@ -184,16 +190,30 @@
            &bootstrapexec, &bootstrapsize))
                goto done;
 
-       rv = pread(params->fsfd, &bb, sizeof(bb), VAX_BOOT_BLOCK_OFFSET);
+       /* read old boot block */
+       rv = pread(params->fsfd, oldbb, sizeof(oldbb), VAX_BOOT_BLOCK_OFFSET);
        if (rv == -1) {
                warn("Reading `%s'", params->filesystem);
                goto done;
-       } else if (rv != sizeof(bb)) {
+       } else if (rv != sizeof(oldbb)) {
                warnx("Reading `%s': short read", params->filesystem);
                goto done;
        }
 
-               /* fill in the updated boot block fields */
+       /* bootstrpbuf starts with a valid boot block */
+       bb = (union vax_boot_block*)bootstrapbuf;
+       /*
+        * Copy disklabel from old boot block to new.
+        * Assume everything between LABELOFFSET and the start of
+        * the param block is scratch area and can be copied over.
+        */
+       memcpy(bootstrapbuf+LABELOFFSET,
+           oldbb+LABELOFFSET, bb->bb.bb_id_offset*2-LABELOFFSET);
+
+       /* adapt pointer to new copy */
+       bp = (struct vax_boot_param_block*)(bootstrapbuf+bb->bb.bb_id_offset*2);
+
+       /* fill in the updated boot block fields */
        if (params->flags & IB_APPEND) {
                struct stat     filesyssb;
 
@@ -209,46 +229,21 @@
                }
                startblock = howmany(filesyssb.st_size,
                    VAX_BOOT_BLOCK_BLOCKSIZE);
-       } else if (params->flags & IB_STAGE1START) {
-               startblock = params->s1start;
-       } else {
-               startblock = VAX_BOOT_BLOCK_OFFSET / VAX_BOOT_BLOCK_BLOCKSIZE
-                   + 1;
+               bb->bb.bb_lbn_hi = htole16((uint16_t) (startblock >> 16));
+               bb->bb.bb_lbn_low = htole16((uint16_t) (startblock >>  0));
        }
 
-       bb.bb_id_offset = offsetof(struct vax_boot_block, bb_magic1) / 2;
-       bb.bb_mbone = 1;
-       bb.bb_lbn_hi = htole16((uint16_t) (startblock >> 16));
-       bb.bb_lbn_low = htole16((uint16_t) (startblock >>  0));
-       /*
-        * Now the identification block
-        */
-       bb.bb_magic1 = VAX_BOOT_MAGIC1;
-       bb.bb_mbz1 = 0;
-       bb.bb_sum1 = ~(bb.bb_magic1 + bb.bb_mbz1 + bb.bb_pad1);
-
-       bb.bb_mbz2 = 0;
-       bb.bb_volinfo = VAX_BOOT_VOLINFO_NONE;
-       bb.bb_pad2a = 0;
-       bb.bb_pad2b = 0;
-
-       bb.bb_size = htole32(bootstrapsize / VAX_BOOT_BLOCK_BLOCKSIZE);
-       bb.bb_load = htole32(VAX_BOOT_LOAD);
-       bb.bb_entry = htole32(VAX_BOOT_ENTRY);
-       bb.bb_sum3 = htole32(le32toh(bb.bb_size) + le32toh(bb.bb_load) \
-           + le32toh(bb.bb_entry));
-
        if (params->flags & IB_SUNSUM) {
                uint16_t        sum;
 
-               sum = compute_sunsum((uint16_t *)&bb);
-               if (! set_sunsum(params, (uint16_t *)&bb, sum))
+               sum = compute_sunsum((uint16_t *)bb);
+               if (! set_sunsum(params, (uint16_t *)bb, sum))
                        goto done;
        }
 
        if (params->flags & IB_VERBOSE) {
                printf("Bootstrap start sector: %u\n", startblock);
-               printf("Bootstrap sector count: %u\n", le32toh(bb.bb_size));
+               printf("Bootstrap sector count: %u\n", le32toh(bp->bb_size));
                printf("%sriting bootstrap\n",
                    (params->flags & IB_NOWRITE) ? "Not w" : "W");
        }
@@ -256,8 +251,7 @@
                retval = 1;
                goto done;
        }
-       rv = pwrite(params->fsfd, bootstrapbuf, bootstrapsize,
-            startblock * VAX_BOOT_BLOCK_BLOCKSIZE);
+       rv = pwrite(params->fsfd, bootstrapbuf, bootstrapsize, 0);
        if (rv == -1) {
                warn("Writing `%s'", params->filesystem);
                goto done;
@@ -265,19 +259,7 @@
                warnx("Writing `%s': short write", params->filesystem);
                goto done;
        }
-
-       if (params->flags & IB_VERBOSE)
-               printf("Writing boot block\n");
-       rv = pwrite(params->fsfd, &bb, sizeof(bb), VAX_BOOT_BLOCK_OFFSET);
-       if (rv == -1) {
-               warn("Writing `%s'", params->filesystem);
-               goto done;
-       } else if (rv != sizeof(bb)) {
-               warnx("Writing `%s': short write", params->filesystem);
-               goto done;
-       } else {
-               retval = 1;
-       }
+       retval = 1;
 
  done:
        if (bootstrapbuf)
Index: sys/arch/vax/include/disklabel.h
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/include/disklabel.h,v
retrieving revision 1.6
diff -u -r1.6 disklabel.h
--- sys/arch/vax/include/disklabel.h    2 Jul 2012 22:42:18 -0000       1.6
+++ sys/arch/vax/include/disklabel.h    30 Mar 2013 17:17:49 -0000
@@ -36,16 +36,19 @@
 #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           10      /* number of partitions */
 #define        OLDMAXPARTITIONS        8       /* number of partitions before 
nb-6 */
 #define        RAW_PART                2       /* raw partition: xx?c */
+#define        __VAX_TMPMAXPARTITIONS  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) / __VAX_TMPMAXPARTITIONS)
 #define DISKUNIT(dev)  ((minor(dev) / OLDMAXPARTITIONS) % __VAX_MAXDISKS)
 #define DISKPART(dev)  ((minor(dev) % OLDMAXPARTITIONS) + \
     ((minor(dev) / (__VAX_MAXDISKS * OLDMAXPARTITIONS)) * OLDMAXPARTITIONS))
Index: sys/arch/vax/boot/xxboot/start.S
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/boot/xxboot/start.S,v
retrieving revision 1.4
diff -u -r1.4 start.S
--- sys/arch/vax/boot/xxboot/start.S    11 Dec 2005 12:19:34 -0000      1.4
+++ sys/arch/vax/boot/xxboot/start.S    30 Mar 2013 17:17:49 -0000
@@ -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"
@@ -56,7 +57,7 @@
        brb     from_0x00       # continue behind dispatch-block
 
 .org   0x02                    # information used by uVAX-ROM
-       .byte   0xcf            # offset in words to identification area 
+       .byte   (pblock-.)/2+1  # 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
@@ -68,26 +69,11 @@
        movzbl  $1,_C_LABEL(from)# We booted from "old" rom.
        brw     cont_750
 
-
 from_0x00:                     # uVAX from TK50 
        brw     start_uvax      # all uVAXen continue there
 
 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 +88,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.
  */
@@ -111,6 +111,7 @@
 #define SIOFF          0x200   /* byte offset into secondary image */
 
 .org   0x19e
+pblock:
        .byte   0x18            # must be 0x18 
        .byte   0x00            # must be 0x00 (MBZ) 
        .byte   0x00            # any value 
@@ -133,6 +134,7 @@
 _C_LABEL(from):
        .long   0
 
+
 /*
  * After bootblock (LBN0) has been loaded into the first page 
  * of good memory by 11/750's ROM-code (transfer address
@@ -172,6 +174,7 @@
        popr    $0x131          # restore clobbered registers
        brw     start_all       # Ok, continue...
 
+
 /* uVAX main entry is at the start of the second disk block.  This is
  * needed for multi-arch CD booting where multiple architecture need
  * to shove stuff in boot block 0.


Home | Main Index | Thread Index | Old Index