| plan 9 kernel history: overview | file list | diff list |
1990/0504/power/bboot.c (diff list | history)
| 1990/0430/sys/src/9/power/bboot.c:19,25 – 1990/0504/sys/src/9/power/bboot.c:19,24 (short | long | prev | next) | ||
| 1990/0427 | int cfd; int efd; | |
| 1990/0424 | typedef struct address { char *name; | |
| 1990/0430/sys/src/9/power/bboot.c:65,74 – 1990/0504/sys/src/9/power/bboot.c:64,74 | ||
| 1990/0427 | char *lookup(char *); int readseg(int, int, long, long, int); int readkernel(int); | |
| 1990/0504 | int readconf(int); | |
| 1990/0427 | int outin(char *, char *, char *, int); void prerror(char *); void error(char *); | |
| 1990/0504 | void boot(int, char *); | |
| 1990/0427 | /* * usage: 9b [-a] [server] [file] | |
| 1990/0430/sys/src/9/power/bboot.c:78,88 – 1990/0504/sys/src/9/power/bboot.c:78,91 | ||
| 1990/0427 | main(int argc, char *argv[]) | |
| 1990/0424 | { | |
| 1990/0427 | int i; | |
| 1990/0504 | char *sysname; | |
| 1990/0424 | ||
| 1990/0427 | open("#c/cons", 0); open("#c/cons", 1); open("#c/cons", 1); | |
| 1990/0424 | ||
| 1990/0504 | sysname = argv[0]; | |
| 1990/0427 | argv++; argc--; while(argc > 0){ | |
| 1990/0430/sys/src/9/power/bboot.c:105,111 – 1990/0504/sys/src/9/power/bboot.c:108,114 | ||
| 1990/0427 | break; } | |
| 1990/0424 | ||
| 1990/0427 |
| |
| 1990/0504 | boot(0, sysname); | |
| 1990/0427 | for(;;){ if(fd > 0) close(fd); | |
| 1990/0430/sys/src/9/power/bboot.c:114,127 – 1990/0504/sys/src/9/power/bboot.c:117,131 | ||
| 1990/0427 | if(efd > 0) close(efd); fd = cfd = efd = 0; | |
| 1990/0504 | boot(1, sysname); | |
| 1990/0427 | } | |
| 1990/0424 | } | |
| 1990/0427 | void | |
| 1990/0504 | boot(int ask, char *addr) | |
| 1990/0424 | { | |
| 1990/0427 | int n; | |
| 1990/0504 | char conffile[128]; | |
| 1990/0424 | ||
| 1990/0427 | if(ask){ outin("bootfile", bootfile, bbuf, sizeof(bbuf)); | |
| 1990/0430/sys/src/9/power/bboot.c:140,146 – 1990/0504/sys/src/9/power/bboot.c:144,149 | ||
| 1990/0427 | return; } | |
| 1990/0424 | ||
| 1990/0427 |
| |
| 1990/0424 | /* | |
| 1990/0427 | * for the bit, we skip all the ether goo | |
| 1990/0430/sys/src/9/power/bboot.c:252,260 – 1990/0504/sys/src/9/power/bboot.c:255,272 | ||
| 1990/0427 | } | |
| 1990/0424 | close(fd); | |
| 1990/0504 | sprint(conffile, "/mips/conf/%s", addr); print("%s...", conffile); while((fd = open(conffile, OREAD)) < 0){ outin("conffile", conffile, conffile, sizeof(conffile)); } if(readconf(fd) < 0) prerror("readconf"); close(fd); print("%s...", bootfile); | |
| 1990/0427 | while((fd = open(bootfile, OREAD)) < 0){ | |
| 1990/0504 | outin("bootfile", bootfile, bbuf, sizeof(bbuf)); | |
| 1990/0427 | bootfile = bbuf; } | |
| 1990/0424 | readkernel(fd); | |
| 1990/0430/sys/src/9/power/bboot.c:336,341 – 1990/0504/sys/src/9/power/bboot.c:348,397 | ||
| 1990/0427 | } /* | |
| 1990/0504 | * set a configuration value */ /* * read the configuration */ int readconf(int fd) { int bfd; int n; long x; /* * read the config file */ n = read(fd, buf, sizeof(buf)-1); if(n <= 0) return -1; buf[n] = 0; /* * write into 4 meg - 4k */ bfd = open("#b/mem", OWRITE); if(bfd < 0){ prerror("can't open #b/mem"); return; } x = 0x80000000 | 4*1024*1024 - 4*1024; if(seek(bfd, x, 0) != x){ close(bfd); return -1; } if(write(bfd, buf, n+1) != n+1){ close(bfd); return -1; } close(bfd); return 0; } /* | |
| 1990/0427 | * read the kernel into memory and jump to it */ int | |
| 1990/0430/sys/src/9/power/bboot.c:369,375 – 1990/0504/sys/src/9/power/bboot.c:425,431 | ||
| 1990/0427 | close(bfd); return; } | |
| 1990/0504 | print("+%d", a_out.bss); | |
| 1990/0427 | close(bfd); bfd = open("#b/boot", OWRITE); | |
| 1990/0430/sys/src/9/power/bboot.c:378,384 – 1990/0504/sys/src/9/power/bboot.c:434,440 | ||
| 1990/0427 | return; } | |
| 1990/0504 | print(" entry: 0x%ux\n", a_out.entryva); | |
| 1990/0427 | sleep(1000); if(write(bfd, &a_out.entryva, sizeof a_out.entryva) != sizeof a_out.entryva){ prerror("can't start kernel"); | |