Annotation of 3BSD/sys/stand/boot.c, revision 1.1.1.1

1.1       root        1: #include "../h/param.h"
                      2: #include "../h/ino.h"
                      3: #include "../h/inode.h"
                      4: #include "../h/filsys.h"
                      5: #include "../h/dir.h"
                      6: #include "../h/vm.h"
                      7: #include <a.out.h>
                      8: #include "saio.h"
                      9: 
                     10: char line[100];
                     11: 
                     12: main()
                     13: {
                     14:        int i;
                     15: 
                     16:        printf("\nBoot\n");
                     17:        do {
                     18:                printf(": "); gets(line);
                     19:                i = open(line,0);
                     20:        } while (i < 0);
                     21: 
                     22:        copyunix(i);
                     23: }
                     24: 
                     25: copyunix(io)
                     26: register io;
                     27: {
                     28:        struct exec x;
                     29:        register int i;
                     30:        char *addr;
                     31: 
                     32:        i = read(io, (char *)&x, sizeof x);
                     33:        if (i != sizeof x || x.a_magic != 0410)
                     34:                _stop("Bad format\n");
                     35:        printf("%d", x.a_text);
                     36:        if (read(io, (char *)0, x.a_text) != x.a_text)
                     37:                goto shread;
                     38:        addr = (char *)x.a_text;
                     39:        while ((int)addr & CLOFSET)
                     40:                *addr++ = 0;
                     41:        printf("+%d", x.a_data);
                     42:        if (read(io, addr, x.a_data) != x.a_data)
                     43:                goto shread;
                     44:        addr += x.a_data;
                     45:        printf("+%d", x.a_bss);
                     46:        x.a_bss += 128*512;     /* slop */
                     47:        for (i = 0; i < x.a_bss; i++)
                     48:                *addr++ = 0;
                     49:        x.a_entry &= 0x7fffffff;
                     50:        printf(" start 0x%x\n", x.a_entry);
                     51:        (*((int (*)()) x.a_entry))();
                     52:        _exit();
                     53: shread:
                     54:        _stop("Short read\n");
                     55: }

unix.superglobalmegacorp.com

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