Annotation of 43BSDReno/sys/vaxstand/bootxx.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1982, 1986 Regents of the University of California.
        !             3:  * All rights reserved.  The Berkeley software License Agreement
        !             4:  * specifies the terms and conditions for redistribution.
        !             5:  *
        !             6:  *     @(#)bootxx.c    7.5 (Berkeley) 4/4/90
        !             7:  */
        !             8: 
        !             9: #include "param.h"
        !            10: #include "vm.h"
        !            11: #include "reboot.h"
        !            12: #include <a.out.h>
        !            13: #include "saio.h"
        !            14: 
        !            15: char bootprog[] = "boot";
        !            16: extern unsigned opendev;
        !            17: 
        !            18: /*
        !            19:  * Boot program... arguments passed in r10 and r11
        !            20:  * are passed through to the full boot program.
        !            21:  */
        !            22: 
        !            23: main()
        !            24: {
        !            25:        register unsigned howto, devtype;       /* howto=r11, devtype=r10 */
        !            26:        int io, unit, partition;
        !            27:        register char *cp;
        !            28: 
        !            29: #ifdef lint
        !            30:        howto = 0; devtype = 0; devtype = devtype;
        !            31: #endif
        !            32:        printf("loading %s\n", bootprog);
        !            33:        io = open(bootprog, 0);
        !            34:        if (io >= 0)
        !            35:                copyunix(howto, opendev, io);
        !            36:        _stop("boot failed\n");
        !            37: }
        !            38: 
        !            39: /*ARGSUSED*/
        !            40: copyunix(howto, devtype, io)
        !            41:        register howto, devtype, io;    /* howto=r11, devtype=r10 */
        !            42: {
        !            43:        struct exec x;
        !            44:        register int i;
        !            45:        char *addr;
        !            46: 
        !            47:        i = read(io, (char *)&x, sizeof x);
        !            48:        if (i != sizeof x || N_BADMAG(x))
        !            49:                _stop("Bad format\n");
        !            50:        if ((x.a_magic == ZMAGIC || x.a_magic == NMAGIC) &&
        !            51:            lseek(io, 0x400, L_SET) == -1)
        !            52:                goto shread;
        !            53:        if (read(io, (char *)0, x.a_text) != x.a_text)
        !            54:                goto shread;
        !            55:        addr = (char *)x.a_text;
        !            56:        if (x.a_magic == ZMAGIC || x.a_magic == NMAGIC)
        !            57:                while ((int)addr & CLOFSET)
        !            58:                        *addr++ = 0;
        !            59:        if (read(io, addr, x.a_data) != x.a_data)
        !            60:                goto shread;
        !            61:        addr += x.a_data;
        !            62:        x.a_bss += 128*512;     /* slop */
        !            63:        for (i = 0; i < x.a_bss; i++)
        !            64:                *addr++ = 0;
        !            65:        x.a_entry &= 0x7fffffff;
        !            66:        (*((int (*)()) x.a_entry))();
        !            67:        return;
        !            68: shread:
        !            69:        _stop("Short read\n");
        !            70: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.