| plan 9 kernel history: overview | file list | diff list |
2002/0109/pc/main.c (diff list | history)
| 2001/1011/sys/src/9/pc/main.c:7,33 – 2002/0109/sys/src/9/pc/main.c:7,34 (short | long | prev | next) | ||
| 1991/0716 | #include "ureg.h" #include "init.h" | |
| 1997/1101 | #include "pool.h" | |
| 2002/0109 | #include "reboot.h" | |
| 1991/0629 | ||
| 1997/0327 | Mach *m; | |
| 1992/0904 | ||
| 1997/0327 |
| |
| 1992/0903 | ||
| 1997/0327 | /* * Where configuration info is left for the loaded programme. * This will turn into a structure as more is done by the boot loader * (e.g. why parse the .ini file twice?). | |
| 2000/0721 |
| |
| 2002/0109 | * There are 3584 bytes available at CONFADDR. | |
| 1997/0327 | */ | |
| 1997/0329 | #define BOOTLINE ((char*)CONFADDR) | |
| 1997/0327 | #define BOOTLINELEN 64 #define BOOTARGS ((char*)(CONFADDR+BOOTLINELEN)) | |
| 2000/0721 | #define BOOTARGSLEN (4096-0x200-BOOTLINELEN) | |
| 1993/0330 |
| |
| 2002/0109 | #define MAXCONF 64 | |
| 1993/0330 | ||
| 2001/0527 | char bootdisk[KNAMELEN]; | |
| 2002/0109 | Conf conf; | |
| 1993/0330 | char *confname[MAXCONF]; char *confval[MAXCONF]; int nconf; | |
| 2002/0109 | uchar *sp; /* user stack of init proc */ | |
| 1993/0330 | ||
| 1997/0327 | static void | |
| 1997/0403 | options(void) | |
| 2001/1011/sys/src/9/pc/main.c:71,88 – 2002/0109/sys/src/9/pc/main.c:72,87 | ||
| 1991/0716 | void | |
| 1991/0702 | main(void) | |
| 1991/0625 | { | |
| 1997/0327 |
| |
| 1997/1101 |
| |
| 1991/0711 |
| |
| 1991/1113 |
| |
| 1997/0327 |
| |
| 2002/0109 | mach0init(); | |
| 1997/0403 | options(); | |
| 2001/0527 | ioinit(); i8250console(); | |
| 2002/0109 | ||
| 2001/0527 | print("\nPlan 9\n"); | |
| 2002/0109 | ||
| 1997/0327 | cpuidentify(); | |
| 2001/0527 | screeninit(); | |
| 2002/0109 | meminit(); | |
| 1991/0711 | confinit(); | |
| 1997/0329 | archinit(); | |
| 1992/0625 | xinit(); | |
| 2001/1011/sys/src/9/pc/main.c:108,113 – 2002/0109/sys/src/9/pc/main.c:107,125 | ||
| 1991/0712 | } | |
| 1991/0706 | ||
| 1991/0716 | void | |
| 2002/0109 | mach0init(void) { conf.nmach = 1; MACHP(0) = (Mach*)CPU0MACH; m->pdb = (ulong*)CPU0PDB; machinit(); active.machs = 1; active.exiting = 0; } void | |
| 1991/0716 | machinit(void) | |
| 1991/0712 | { | |
| 1997/0327 | int machno; | |
| 2001/1011/sys/src/9/pc/main.c:129,147 – 2002/0109/sys/src/9/pc/main.c:141,150 | ||
| 1991/0625 | } | |
| 1991/0716 | void | |
| 1993/1013 |
| |
| 2001/0527 |
| |
| 1993/1013 |
| |
| 1991/0716 | init0(void) | |
| 1991/0712 | { | |
| 1993/0330 | int i; | |
| 1992/0918 |
| |
| 2002/0109 | char buf[2*KNAMELEN]; | |
| 1992/0918 | ||
| 1993/0915 | up->nerrlab = 0; | |
| 1991/0712 | ||
| 2001/1011/sys/src/9/pc/main.c:159,175 – 2002/0109/sys/src/9/pc/main.c:162,176 | ||
| 1991/0716 | chandevinit(); | |
| 1991/0926 | if(!waserror()){ | |
| 1992/0923 |
| |
| 1992/0918 |
| |
| 1991/0927 |
| |
| 2002/0109 | snprint(buf, sizeof(buf), "%s %s", arch->id, conffile); ksetenv("terminal", buf, 0); ksetenv("cputype", "386", 0); | |
| 1997/0329 | if(cpuserver) | |
| 2002/0109 | ksetenv("service", "cpu", 0); | |
| 1997/0329 | else | |
| 2002/0109 | ksetenv("service", "terminal", 0); | |
| 1993/0915 | for(i = 0; i < nconf; i++) | |
| 1997/0329 |
| |
| 1993/0915 |
| |
| 2002/0109 | ksetenv(confname[i], confval[i], 1); | |
| 1991/0926 | poperror(); } | |
| 1993/0915 | kproc("alarm", alarmkproc, 0); | |
| 2001/1011/sys/src/9/pc/main.c:260,265 – 2002/0109/sys/src/9/pc/main.c:261,268 | ||
| 1992/0323 | ac = 0; | |
| 1994/0219 | av[ac++] = pusharg("/386/9dos"); | |
| 2002/0109 | /* when boot is changed to only use rc, this code can go away */ | |
| 1997/0327 | cp[BOOTLINELEN-1] = 0; | |
| 1993/0915 | buf[0] = 0; | |
| 2000/0518 | if(strncmp(cp, "fd", 2) == 0){ | |
| 2001/1011/sys/src/9/pc/main.c:270,282 – 2002/0109/sys/src/9/pc/main.c:273,278 | ||
| 1993/0915 | av[ac++] = pusharg(buf); | |
| 2000/0531 | } else if(strncmp(cp, "ether", 5) == 0) | |
| 1994/1111 | av[ac++] = pusharg("-n"); | |
| 1993/0915 |
| |
| 1992/0323 | /* 4 byte word align stack */ sp = (uchar*)((ulong)sp & ~3); | |
| 2001/1011/sys/src/9/pc/main.c:290,307 – 2002/0109/sys/src/9/pc/main.c:286,291 | ||
| 1992/0323 | sp += (USTKTOP - BY2PG) - base - sizeof(ulong); | |
| 1991/0711 | } | |
| 1991/0716 |
| |
| 1991/0711 |
| |
| 1993/0915 |
| |
| 2001/1011/sys/src/9/pc/main.c:313,336 – 2002/0109/sys/src/9/pc/main.c:297,343 | ||
| 1993/0915 | return 0; } | |
| 2002/0109 | static void writeconf(void) { char *p, *q; int n; p = getconfenv(); if(waserror()) { free(p); nexterror(); } /* convert to name=value\n format */ for(q=p; *q; q++) { q += strlen(q); *q = '='; q += strlen(q); *q = '\n'; } n = q - p + 1; if(n >= BOOTARGSLEN) error("kernel configuration too large"); memset(BOOTLINE, 0, BOOTLINELEN); memmove(BOOTARGS, p, n); poperror(); free(p); } | |
| 1994/1210 | void | |
| 1991/0711 | confinit(void) { | |
| 1997/0403 | char *p; | |
| 1999/1109 | int userpcnt; | |
| 1998/1120 |
| |
| 2002/0109 | ulong kpages; | |
| 1991/0711 | ||
| 1997/0403 |
| |
| 1998/1120 | userpcnt = 100 - strtol(p, 0, 0); | |
| 1997/0403 | else | |
| 1998/1120 | userpcnt = 0; | |
| 1994/0814 | ||
| 1997/0329 |
| |
| 1993/0915 | ||
| 1991/0711 | conf.npage = conf.npage0 + conf.npage1; | |
| 1998/1124 | conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5; | |
| 2001/1011/sys/src/9/pc/main.c:556,563 – 2002/0109/sys/src/9/pc/main.c:563,570 | ||
| 1998/0605 | mmuflushtlb(PADDR(m->pdb)); | |
| 1991/0712 | } | |
| 1991/0716 |
| |
| 1997/0327 |
| |
| 2002/0109 | static void shutdown(int ispanic) | |
| 1991/0712 | { | |
| 1997/0327 | int ms, once; | |
| 1991/0712 | ||
| 2001/1011/sys/src/9/pc/main.c:588,594 – 2002/0109/sys/src/9/pc/main.c:595,650 | ||
| 1997/0327 | } else | |
| 1996/01171 | delay(1000); | |
| 2002/0109 | } | |
| 1992/0903 | ||
| 2002/0109 | void reboot(void *entry, void *code, ulong size) { void (*f)(ulong, ulong, ulong); ulong *pdb; writeconf(); shutdown(0); /* * should be the only processor running now */ print("shutting down...\n"); delay(200); splhi(); /* turn off buffered serial console */ serialoq = nil; /* shutdown devices */ chandevshutdown(); /* * Modify the machine page table to directly map the low 4MB of memory * This allows the reboot code to turn off the page mapping */ pdb = m->pdb; pdb[PDX(0)] = pdb[PDX(KZERO)]; mmuflushtlb(PADDR(pdb)); /* setup reboot trampoline function */ f = (void*)REBOOTADDR; memmove(f, rebootcode, sizeof(rebootcode)); print("rebooting...\n"); /* off we go - never to return */ (*f)(PADDR(entry), PADDR(code), size); } void exit(int ispanic) { shutdown(ispanic); | |
| 1997/0327 | arch->reset(); | |
| 1991/0803 | } | |
| 2001/1011/sys/src/9/pc/main.c:596,628 – 2002/0109/sys/src/9/pc/main.c:652,683 | ||
| 1993/0915 | isaconfig(char *class, int ctlrno, ISAConf *isa) { | |
| 2001/0527 | char cc[32], *p; | |
| 2002/0109 | int i; | |
| 1993/0915 | ||
| 2001/0527 | snprint(cc, sizeof cc, "%s%d", class, ctlrno); | |
| 1993/0915 |
| |
| 2001/0527 |
| |
| 1993/0915 |
| |
| 2001/0527 |
| |
| 1997/0327 |
| |
| 1993/0915 |
| |
| 1997/0327 |
| |
| 1993/0915 |
| |
| 1997/0327 |
| |
| 1996/0425 |
| |
| 1997/0327 |
| |
| 1993/0915 |
| |
| 1997/0327 |
| |
| 1993/0915 |
| |
| 1997/0327 |
| |
| 1994/0823 |
| |
| 1993/0915 |
| |
| 2002/0109 | p = getconf(cc); if(p == nil) return 0; isa->nopt = tokenize(p, isa->opt, NISAOPT); for(i = 0; i < isa->nopt; i++){ p = isa->opt[i]; if(cistrncmp(p, "type=", 5) == 0) isa->type = p + 5; else if(cistrncmp(p, "port=", 5) == 0) isa->port = strtoul(p+5, &p, 0); else if(cistrncmp(p, "irq=", 4) == 0) isa->irq = strtoul(p+4, &p, 0); else if(cistrncmp(p, "dma=", 4) == 0) isa->dma = strtoul(p+4, &p, 0); else if(cistrncmp(p, "mem=", 4) == 0) isa->mem = strtoul(p+4, &p, 0); else if(cistrncmp(p, "size=", 5) == 0) isa->size = strtoul(p+5, &p, 0); else if(cistrncmp(p, "freq=", 5) == 0) isa->freq = strtoul(p+5, &p, 0); | |
| 1993/0915 | } | |
| 2002/0109 | return 1; | |
| 1991/0803 | } | |
| 1995/0222 | int | |