BSD 4_3 release
[unix-history] / usr / src / sys / stand / bootrl.c
index 00ae481..1c98317 100644 (file)
@@ -1,4 +1,10 @@
-/*     bootrl.c        6.1     83/07/29        */
+/*
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)bootrl.c    7.1 (Berkeley) 6/5/86
+ */
 
 #include "../h/param.h"
 #include "../h/inode.h"
 
 #include "../h/param.h"
 #include "../h/inode.h"
@@ -8,7 +14,7 @@
 #include "saio.h"
 #include "../h/reboot.h"
 
 #include "saio.h"
 #include "../h/reboot.h"
 
-char bootprog[] = "rl(0,0)boot";
+char bootprog[20] = "rl(0,0)boot";
 
 /*
  * Boot program... arguments passed in r10 and r11
 
 /*
  * Boot program... arguments passed in r10 and r11
@@ -17,18 +23,30 @@ char bootprog[] = "rl(0,0)boot";
 
 main()
 {
 
 main()
 {
-       register howto, devtype;        /* howto=r11, devtype=r10 */
-       int io;
+       register unsigned howto, devtype;       /* howto=r11, devtype=r10 */
+       int io, unit, partition;
+       register char *cp;
 
 #ifdef lint
        howto = 0; devtype = 0;
 #endif
 
 #ifdef lint
        howto = 0; devtype = 0;
 #endif
-       printf("loading %s", bootprog);
+       unit = (devtype >> B_UNITSHIFT) & B_UNITMASK;
+       unit += 8 * ((devtype >> B_ADAPTORSHIFT) & B_ADAPTORMASK);
+       partition = (devtype >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
+       cp = bootprog + 3;
+       if (unit >= 10)
+               *cp++ = unit / 10 + '0';
+       *cp++ = unit % 10 + '0';
+       *cp++ = ',';
+       if (partition >= 10)
+               *cp++ = partition / 10 + '0';
+       *cp++ = partition % 10 + '0';
+       bcopy((caddr_t) ")boot", cp, 6);
+       printf("loading %s\n", bootprog);
        io = open(bootprog, 0);
        if (io >= 0)
                copyunix(howto, devtype, io);
        io = open(bootprog, 0);
        if (io >= 0)
                copyunix(howto, devtype, io);
-       printf("boot failed");
-       _exit();
+       _stop("boot failed\n");
 }
 
 /*ARGSUSED*/
 }
 
 /*ARGSUSED*/
@@ -60,7 +78,7 @@ copyunix(howto, devtype, io)
                *addr++ = 0;
        x.a_entry &= 0x7fffffff;
        (*((int (*)()) x.a_entry))();
                *addr++ = 0;
        x.a_entry &= 0x7fffffff;
        (*((int (*)()) x.a_entry))();
-       _exit();
+       return;
 shread:
        _stop("Short read\n");
 }
 shread:
        _stop("Short read\n");
 }