| plan 9 kernel history: overview | file list | diff list |
2002/0116/alphapc/main.c (diff list | history)
| 1999/0415/sys/src/9/alphapc/main.c:54,64 – 1999/0423/sys/src/9/alphapc/main.c:54,64 (short | long) | ||
| 1999/0415 | percpu[32] |= (0<<16); /* default action */ #endif | |
| 1999/0423 | pageinit(); | |
| 1999/0415 | swapinit(); userinit(); schedinit(); | |
| 1999/0423/sys/src/9/alphapc/main.c:274,279 – 1999/0504/sys/src/9/alphapc/main.c:274,280 (short | long) | ||
| 1999/0415 | { "ether0", "scsi0", | |
| 1999/0504 | "audio0", | |
| 1999/0415 | }; | |
| 1999/0423/sys/src/9/alphapc/main.c:281,286 – 1999/0504/sys/src/9/alphapc/main.c:282,288 | ||
| 1999/0415 | { "type=21140", "type=aic7xxx", | |
| 1999/0504 | "type=sb16", | |
| 1999/0415 | }; int nconf = nelem(confname); | |
| 1999/0504/sys/src/9/alphapc/main.c:274,279 – 1999/0507/sys/src/9/alphapc/main.c:274,281 (short | long) | ||
| 1999/0415 | { "ether0", "scsi0", | |
| 1999/0507 | "scsi1", "scsi2", | |
| 1999/0504 | "audio0", | |
| 1999/0415 | }; | |
| 1999/0504/sys/src/9/alphapc/main.c:280,287 – 1999/0507/sys/src/9/alphapc/main.c:282,291 | ||
| 1999/0415 | char *confval[] = { | |
| 1999/0507 | "type=2114x", "type=ata", "type=ata", "type=ata", | |
| 1999/0504 | "type=sb16", | |
| 1999/0415 | }; | |
| 1999/0507/sys/src/9/alphapc/main.c:234,241 – 1999/0511/sys/src/9/alphapc/main.c:234,240 (short | long) | ||
| 1999/0415 | if(cpuserver) conf.nproc = 500; | |
| 1999/0511 | conf.monitor = 1; /* BUG */ | |
| 1999/0415 | } void | |
| 1999/0511/sys/src/9/alphapc/main.c:27,32 – 1999/0514/sys/src/9/alphapc/main.c:27,33 (short | long) | ||
| 1999/0415 | confinit(); archinit(); savefpregs(&initfp); | |
| 1999/0514 | fpenab(0); | |
| 1999/0415 | mmuinit(); xinit(); printinit(); | |
| 1999/0511/sys/src/9/alphapc/main.c:273,282 – 1999/0514/sys/src/9/alphapc/main.c:274,281 | ||
| 1999/0415 | { "ether0", "scsi0", | |
| 1999/0507 |
| |
| 1999/0504 | "audio0", | |
| 1999/0415 | ||
| 1999/0514 | "ether1", | |
| 1999/0415 | }; char *confval[] = | |
| 1999/0511/sys/src/9/alphapc/main.c:283,291 – 1999/0514/sys/src/9/alphapc/main.c:282,289 | ||
| 1999/0415 | { | |
| 1999/0507 | "type=2114x", "type=ata", | |
| 1999/0504 | "type=sb16", | |
| 1999/0514 | "type=2114x", | |
| 1999/0415 | }; int nconf = nelem(confname); | |
| 1999/0514/sys/src/9/alphapc/main.c:15,20 – 1999/0515/sys/src/9/alphapc/main.c:15,21 (short | long) | ||
| 1999/0415 | Bootconf *bootconf; Conf conf; FPsave initfp; | |
| 1999/0515 | uvlong initfpcr = 0x2800800000000000LL; | |
| 1999/0415 | void main(void) | |
| 1999/0514/sys/src/9/alphapc/main.c:26,33 – 1999/0515/sys/src/9/alphapc/main.c:27,32 | ||
| 1999/0415 | clockinit(); confinit(); archinit(); | |
| 1999/0514 |
| |
| 1999/0415 | mmuinit(); xinit(); printinit(); | |
| 1999/0514/sys/src/9/alphapc/main.c:47,54 – 1999/0515/sys/src/9/alphapc/main.c:46,53 | ||
| 1999/0415 | #ifdef NEVER percpu = hwrpb + (hwrpb[40]>>2); | |
| 1999/0515 | // percpu[32] |= 2; /* restart capable */ percpu[32] &= ~1; /* boot in progress - not */ | |
| 1999/0415 | // percpu[32] |= (3<<16); /* warm boot requested */ // percpu[32] |= (2<<16); /* cold boot requested */ // percpu[32] |= (4<<16); /* stay halted */ | |
| 1999/0514/sys/src/9/alphapc/main.c:61,66 – 1999/0515/sys/src/9/alphapc/main.c:60,67 | ||
| 1999/0415 | chandevreset(); | |
| 1999/0423 | pageinit(); | |
| 1999/0415 | swapinit(); | |
| 1999/0515 | savefpregs(&initfp); initfp.fpstatus = 0x68028000; | |
| 1999/0415 | userinit(); schedinit(); } | |
| 1999/0514/sys/src/9/alphapc/main.c:131,139 – 1999/0515/sys/src/9/alphapc/main.c:132,138 | ||
| 1999/0415 | strcpy(p->text, "*init*"); strcpy(p->user, eve); | |
| 1999/0515 | procsetup(p); | |
| 1999/0415 | /* * Kernel Stack | |
| 1999/0514/sys/src/9/alphapc/main.c:168,173 – 1999/0515/sys/src/9/alphapc/main.c:167,210 | ||
| 1999/0415 | kunmap(k); ready(p); | |
| 1999/0515 | } void procsetup(Proc *p) { p->fpstate = FPinit; fpenab(0); } void procsave(Proc *p) { if(p->fpstate == FPactive){ if(p->state == Moribund) fpenab(0); else{ /* * Fpsave() stores without handling pending * unmasked exeptions. Postnote() can't be called * here as sleep() already has up->rlock, so * the handling of pending exceptions is delayed * until the process runs again and generates an * emulation fault to activate the FPU. */ savefpregs(&up->fpsave); //print("PS=%lux+", up->fpsave.fpstatus); } p->fpstate = FPinactive; } /* * Switch to the prototype page tables for this processor. * While this processor is in the scheduler, the process could run * on another processor and exit, returning the page tables to * the free list where they could be reallocated and overwritten. * When this processor eventually has to get an entry from the * trashed page tables it will crash. */ | |
| 1999/0415 | } void | |
| 1999/0515/sys/src/9/alphapc/main.c:29,41 – 2000/0108/sys/src/9/alphapc/main.c:29,47 (short | long) | ||
| 1999/0415 | archinit(); mmuinit(); xinit(); | |
| 2000/0108 | screeninit(); screenputs("Hello Squidboy\n", 15); { static Lock l; ilock(&l); xxfirmware(); iunlock(&l); } printinit(); | |
| 1999/0415 | /* console */ | |
| 2000/0108/sys/src/9/alphapc/main.c:33,44 – 2000/0111/sys/src/9/alphapc/main.c:33,38 (short | long) | ||
| 1999/0415 | arch->coreinit(); trapinit(); | |
| 2000/0108 | screeninit(); | |
| 1999/0415 | /* console */ | |
| 2000/0111/sys/src/9/alphapc/main.c:17,22 – 2000/0401/sys/src/9/alphapc/main.c:17,53 (short | long) | ||
| 1999/0415 | FPsave initfp; | |
| 1999/0515 | uvlong initfpcr = 0x2800800000000000LL; | |
| 1999/0415 | ||
| 2000/0401 | char bootargs[BOOTARGSLEN]; char *confname[MAXCONF]; char *confval[MAXCONF]; int nconf; static void options(void) { char *cp, *line[MAXCONF]; int i, n; cp = bootconf->bootargs; cp[BOOTARGSLEN-1] = 0; strcpy(bootargs, cp); n = getcfields(bootargs, line, MAXCONF, "\n"); for(i = 0; i < n; i++){ if(*line[i] == '#') continue; cp = strchr(line[i], '='); if(cp == 0) continue; *cp++ = 0; if(cp - line[i] >= NAMELEN+1) *(line[i]+NAMELEN-1) = 0; confname[nconf] = line[i]; confval[nconf] = cp; nconf++; } } | |
| 1999/0415 | void main(void) { | |
| 2000/0111/sys/src/9/alphapc/main.c:24,35 – 2000/0401/sys/src/9/alphapc/main.c:55,69 | ||
| 1999/0415 | hwrpb = (Hwrpb*)(KZERO|hwrpb->phys); arginit(); machinit(); | |
| 2000/0401 | ioinit(); options(); | |
| 1999/0415 | clockinit(); confinit(); archinit(); | |
| 2000/0401 | memholes(); mmuinit(); if(arch->coreinit) | |
| 1999/0415 | arch->coreinit(); trapinit(); | |
| 2000/0108 | screeninit(); | |
| 2000/0111/sys/src/9/alphapc/main.c:41,47 – 2000/0401/sys/src/9/alphapc/main.c:75,81 | ||
| 1999/0415 | kbdinit(); cpuidprint(); | |
| 2000/0401 | if(arch->corehello) | |
| 1999/0415 | arch->corehello(); #ifdef NEVER | |
| 2000/0111/sys/src/9/alphapc/main.c:87,92 – 2000/0401/sys/src/9/alphapc/main.c:121,127 | ||
| 1999/0415 | void init0(void) { | |
| 2000/0401 | int i; | |
| 1999/0415 | char buf[2*NAMELEN]; spllo(); | |
| 2000/0111/sys/src/9/alphapc/main.c:102,110 – 2000/0401/sys/src/9/alphapc/main.c:137,152 | ||
| 1999/0415 | if(!waserror()){ ksetenv("cputype", "alpha"); | |
| 2000/0401 | sprint(buf, "alpha %s alphapc", conffile); | |
| 1999/0415 | ksetenv("terminal", buf); ksetenv("sysname", sysname); | |
| 2000/0401 | if(cpuserver) ksetenv("service", "cpu"); else ksetenv("service", "terminal"); for(i = 0; i < nconf; i++) if(confname[i] && confname[i][0] != '*') ksetenv(confname[i], confval[i]); | |
| 1999/0415 | poperror(); } | |
| 2000/0111/sys/src/9/alphapc/main.c:223,229 – 2000/0401/sys/src/9/alphapc/main.c:265,271 | ||
| 1999/0415 | splhi(); delay(1000); /* give serial fifo time to finish flushing */ | |
| 2000/0401 | if(arch->coredetach) | |
| 1999/0415 | arch->coredetach(); firmware(); } | |
| 2000/0111/sys/src/9/alphapc/main.c:231,285 – 2000/0401/sys/src/9/alphapc/main.c:273,417 | ||
| 1999/0415 | void confinit(void) { | |
| 2000/0401 | ulong ktop, kpages; Bank *b, *eb; extern void _main(void); int userpcnt; char *p; | |
| 1999/0415 |
| |
| 2000/0401 | if(p = getconf("*kernelpercent")) userpcnt = 100 - strtol(p, 0, 0); else userpcnt = 0; | |
| 1999/0415 | /* | |
| 2000/0401 | * The console firmware divides memory into 1 or more banks. * FInd the bank with the kernel in it. | |
| 1999/0415 | */ | |
| 2000/0401 | b = bootconf->bank; eb = b+bootconf->nbank; ktop = PGROUND((ulong)end); ktop = PADDR(ktop); while(b < eb) { if(b->min < ktop && ktop < b->max) break; b++; } if(b == eb) panic("confinit"); /* * Split the bank of memory into 2 banks to fool the allocator into * allocating low memory pages from bank 0 for any peripherals * which only have a 24bit address counter. */ | |
| 1999/0415 | conf.npage0 = (8*1024*1024)/BY2PG; conf.base0 = 0; | |
| 2000/0401 | conf.npage1 = (b->max-8*1024*1024)/BY2PG; | |
| 1999/0415 | conf.base1 = 8*1024*1024; conf.npage = conf.npage0+conf.npage1; conf.upages = (conf.npage*70)/100; | |
| 2000/0401 | /* * Fix up the bank we found to be the remnant, below the kernel. * This, and the other banks, will be passed to xhole() later. * BUG: conf.upages needs to be adjusted, but how? In practice, * we only have 1 bank, and the remnant is small. */ b->max = (uvlong)_main & ~(BY2PG-1); | |
| 1999/0415 | conf.nmach = 1; | |
| 2000/0401 | conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5; if(cpuserver) conf.nproc *= 3; if(conf.nproc > 2000) conf.nproc = 2000; conf.nimage = 200; | |
| 1999/0415 | conf.nswap = conf.nproc*80; | |
| 2000/0401 | conf.nswppo = 4096; | |
| 1999/0415 | conf.copymode = 0; /* copy on write */ | |
| 2000/0401 | if(cpuserver) { if(userpcnt < 10) userpcnt = 70; kpages = conf.npage - (conf.npage*userpcnt)/100; /* * Hack for the big boys. Only good while physmem < 4GB. * Give the kernel a max. of 16MB + enough to allocate the * page pool. * This is an overestimate as conf.upages < conf.npages. * The patch of nimage is a band-aid, scanning the whole * page list in imagereclaim just takes too long. */ if(kpages > (16*MB + conf.npage*sizeof(Page))/BY2PG){ kpages = (16*MB + conf.npage*sizeof(Page))/BY2PG; conf.nimage = 2000; kpages += (conf.nproc*KSTACK)/BY2PG; } } else { if(userpcnt < 10) { if(conf.npage*BY2PG < 16*MB) userpcnt = 40; else userpcnt = 60; } kpages = conf.npage - (conf.npage*userpcnt)/100; /* * Make sure terminals with low memory get at least * 4MB on the first Image chunk allocation. */ if(conf.npage*BY2PG < 16*MB) imagmem->minarena = 4*1024*1024; } conf.upages = conf.npage - kpages; conf.ialloc = (kpages/2)*BY2PG; /* * Guess how much is taken by the large permanent * datastructures. Mntcache and Mntrpc are not accounted for * (probably ~300KB). */ kpages *= BY2PG; kpages -= conf.upages*sizeof(Page) + conf.nproc*sizeof(Proc) + conf.nimage*sizeof(Image) + conf.nswap + conf.nswppo*sizeof(Page); mainmem->maxsize = kpages; if(!cpuserver){ /* * give terminals lots of image memory, too; the dynamic * allocation will balance the load properly, hopefully. * be careful with 32-bit overflow. */ imagmem->maxsize = kpages; } | |
| 1999/0511 | conf.monitor = 1; /* BUG */ | |
| 1999/0415 | } void | |
| 2000/0401 | memholes(void) | |
| 1999/0415 | { | |
| 2000/0401 | Bank *b, *eb; b = bootconf->bank; eb = b+bootconf->nbank; while(b < eb) { if(b->min < (1LL<<32) && b->max < (1LL<<32)) xhole(b->min, b->max-b->min); b++; } | |
| 1999/0415 | } | |
| 2000/0401 | ||
| 1999/0415 | char *sp; char * | |
| 2000/0111/sys/src/9/alphapc/main.c:304,330 – 2000/0401/sys/src/9/alphapc/main.c:436,441 | ||
| 1999/0415 | *av = 0; } | |
| 1999/0504 |
| |
| 1999/0514 |
| |
| 1999/0415 |
| |
| 1999/0507 |
| |
| 1999/0504 |
| |
| 1999/0514 |
| |
| 1999/0415 |
| |
| 2000/0111/sys/src/9/alphapc/main.c:438,441 – 2000/0401/sys/src/9/alphapc/main.c:549,573 | ||
| 1999/0415 | } return 0; | |
| 2000/0401 | } int getcfields(char* lp, char** fields, int n, char* sep) { int i; for(i = 0; lp && *lp && i < n; i++){ while(*lp && strchr(sep, *lp) != 0) *lp++ = 0; if(*lp == 0) break; fields[i] = lp; while(*lp && strchr(sep, *lp) == 0){ if(*lp == '\\' && *(lp+1) == '\n') *lp++ = ' '; lp++; } } return i; | |
| 1999/0415 | } | |
| 2000/0401/sys/src/9/alphapc/main.c:131,136 – 2000/0422/sys/src/9/alphapc/main.c:131,138 (short | long) | ||
| 1999/0415 | * Then early kproc's will have a root and dot. */ up->slash = namec("#/", Atodir, 0, 0); | |
| 2000/0422 | cnameclose(up->slash->name); up->slash->name = newcname("/"); | |
| 1999/0415 | up->dot = cclone(up->slash, 0); chandevinit(); | |
| 2000/0422/sys/src/9/alphapc/main.c:15,21 – 2000/0929/sys/src/9/alphapc/main.c:15,22 (short | long) | ||
| 1999/0415 | Bootconf *bootconf; Conf conf; FPsave initfp; | |
| 1999/0515 |
| |
| 2000/0929 | /* setfcr(FPPDBL|FPRNR|FPINVAL|FPZDIV|FPOVFL) */ uvlong initfpcr = (1LL<62)|(1LL<61)|(1LL<60)|(2LL<<58)|(1LL<48); | |
| 1999/0415 | ||
| 2000/0401 | char bootargs[BOOTARGSLEN]; char *confname[MAXCONF]; | |
| 2000/0929/sys/src/9/alphapc/main.c:26,48 – 2001/0727/sys/src/9/alphapc/main.c:26,59 (short | long) | ||
| 2000/0401 | static void options(void) { | |
| 2001/0727 | long i, n; char *cp, *line[MAXCONF], *p, *q; | |
| 2000/0401 | cp = bootconf->bootargs; cp[BOOTARGSLEN-1] = 0; strcpy(bootargs, cp); | |
| 2001/0727 | /* * Strip out '\r', change '\t' -> ' '. */ p = cp; for(q = cp; *q; q++){ if(*q == '\r') continue; if(*q == '\t') *q = ' '; *p++ = *q; } *p = 0; n = getfields(cp, line, MAXCONF, 1, "\n"); | |
| 2000/0401 | for(i = 0; i < n; i++){ if(*line[i] == '#') continue; cp = strchr(line[i], '='); | |
| 2001/0727 | if(cp == nil) | |
| 2000/0401 | continue; | |
| 2001/0727 | *cp++ = '\0'; | |
| 2000/0401 | confname[nconf] = line[i]; confval[nconf] = cp; nconf++; | |
| 2000/0929/sys/src/9/alphapc/main.c:56,63 – 2001/0727/sys/src/9/alphapc/main.c:67,74 | ||
| 1999/0415 | hwrpb = (Hwrpb*)(KZERO|hwrpb->phys); arginit(); machinit(); | |
| 2000/0401 |
| |
| 2001/0727 | ioinit(); | |
| 1999/0415 | clockinit(); confinit(); archinit(); | |
| 2000/0929/sys/src/9/alphapc/main.c:69,79 – 2001/0727/sys/src/9/alphapc/main.c:80,88 | ||
| 1999/0415 | trapinit(); | |
| 2000/0108 | screeninit(); printinit(); | |
| 1999/0415 |
| |
| 2001/0727 | i8250console(); print("\nPlan 9\n"); | |
| 1999/0415 | cpuidprint(); | |
| 2000/0401 | if(arch->corehello) | |
| 2000/0929/sys/src/9/alphapc/main.c:123,130 – 2001/0727/sys/src/9/alphapc/main.c:132,141 | ||
| 1999/0415 | init0(void) { | |
| 2000/0401 | int i; | |
| 1999/0415 |
| |
| 2001/0727 | char tstr[32]; | |
| 1999/0415 | ||
| 2001/0727 | up->nerrlab = 0; | |
| 1999/0415 | spllo(); /* | |
| 2000/0929/sys/src/9/alphapc/main.c:134,148 – 2001/0727/sys/src/9/alphapc/main.c:145,158 | ||
| 1999/0415 | up->slash = namec("#/", Atodir, 0, 0); | |
| 2000/0422 | cnameclose(up->slash->name); up->slash->name = newcname("/"); | |
| 1999/0415 |
| |
| 2001/0727 | up->dot = cclone(up->slash); | |
| 1999/0415 | chandevinit(); if(!waserror()){ ksetenv("cputype", "alpha"); | |
| 2000/0401 |
| |
| 1999/0415 |
| |
| 2001/0727 | sprint(tstr, "alpha %s alphapc", conffile); ksetenv("terminal", tstr); | |
| 2000/0401 | if(cpuserver) ksetenv("service", "cpu"); else | |
| 2000/0929/sys/src/9/alphapc/main.c:174,181 – 2001/0727/sys/src/9/alphapc/main.c:184,192 | ||
| 1999/0415 | p->rgrp = newrgrp(); p->procmode = 0640; | |
| 2001/0727 | kstrdup(&eve, ""); kstrdup(&p->text, "*init*"); kstrdup(&p->user, eve); | |
| 1999/0415 | ||
| 1999/0515 | procsetup(p); | |
| 1999/0415 | ||
| 2000/0929/sys/src/9/alphapc/main.c:398,404 – 2001/0727/sys/src/9/alphapc/main.c:409,415 | ||
| 2000/0401 | imagmem->maxsize = kpages; } | |
| 1999/0511 |
| |
| 2001/0727 | // conf.monitor = 1; /* BUG */ | |
| 1999/0415 | } void | |
| 2000/0929/sys/src/9/alphapc/main.c:454,482 – 2001/0727/sys/src/9/alphapc/main.c:465,482 | ||
| 1999/0415 | int isaconfig(char *class, int ctlrno, ISAConf *isa) { | |
| 2001/0727 | char cc[32], *p; int i, n; | |
| 1999/0415 |
| |
| 2001/0727 | snprint(cc, sizeof cc, "%s%d", class, ctlrno); | |
| 1999/0415 | for(n = 0; n < nconf; n++){ | |
| 2001/0727 | if(cistrcmp(confname[n], cc) != 0) | |
| 1999/0415 | continue; | |
| 2001/0727 | isa->nopt = tokenize(confval[n], isa->opt, NISAOPT); for(i = 0; i < isa->nopt; i++){ p = isa->opt[i]; if(cistrncmp(p, "type=", 5) == 0) isa->type = p + 5; | |
| 1999/0415 | else if(cistrncmp(p, "port=", 5) == 0) isa->port = strtoul(p+5, &p, 0); else if(cistrncmp(p, "irq=", 4) == 0) | |
| 2000/0929/sys/src/9/alphapc/main.c:489,506 – 2001/0727/sys/src/9/alphapc/main.c:489,494 | ||
| 1999/0415 | isa->size = strtoul(p+5, &p, 0); else if(cistrncmp(p, "freq=", 5) == 0) isa->freq = strtoul(p+5, &p, 0); | |
| 2001/0727/sys/src/9/alphapc/main.c:29,37 – 2001/0728/sys/src/9/alphapc/main.c:29,37 (short | long) | ||
| 2001/0727 | long i, n; char *cp, *line[MAXCONF], *p, *q; | |
| 2000/0401 |
| |
| 2001/0728 | cp = bootargs; strncpy(cp, bootconf->bootargs, BOOTARGSLEN); | |
| 2000/0401 | cp[BOOTARGSLEN-1] = 0; | |
| 2001/0727 | /* * Strip out '\r', change '\t' -> ' '. | |
| 2001/0727/sys/src/9/alphapc/main.c:88,103 – 2001/0728/sys/src/9/alphapc/main.c:88,93 | ||
| 2000/0401 | if(arch->corehello) | |
| 1999/0415 | arch->corehello(); | |
| 1999/0515 |
| |
| 1999/0415 |
| |
| 2001/0727/sys/src/9/alphapc/main.c:118,123 – 2001/0728/sys/src/9/alphapc/main.c:108,114 | ||
| 1999/0415 | machinit(void) { int n; | |
| 2001/0728 | Hwcpu *cpu; | |
| 1999/0415 | icflush(); n = m->machno; | |
| 2001/0727/sys/src/9/alphapc/main.c:126,131 – 2001/0728/sys/src/9/alphapc/main.c:117,126 | ||
| 1999/0415 | active.exiting = 0; active.machs = 1; | |
| 2001/0728 | cpu = (Hwcpu*) ((ulong)hwrpb + hwrpb->cpuoff + n*hwrpb->cpulen); cpu->state &= ~1; /* boot in progress - not */ /* cpu->state |= (4<<16); /* stay halted */ | |
| 1999/0415 | } void | |
| 2001/0728/sys/src/9/alphapc/main.c:189,195 – 2001/0731/sys/src/9/alphapc/main.c:189,195 (short | long) | ||
| 1999/0415 | * Kernel Stack */ p->sched.pc = (ulong)init0; | |
| 2001/0731 | p->sched.sp = (ulong)p->kstack+KSTACK-MAXSYSARG*BY2WD; | |
| 1999/0415 | /* * User Stack, pass input arguments to boot process */ | |
| 2001/0731/sys/src/9/alphapc/main.c:145,160 – 2002/0109/sys/src/9/alphapc/main.c:145,160 (short | long) | ||
| 1999/0415 | chandevinit(); if(!waserror()){ | |
| 2002/0109 | ksetenv("cputype", "alpha", 0); | |
| 2001/0727 | sprint(tstr, "alpha %s alphapc", conffile); | |
| 2002/0109 | ksetenv("terminal", tstr, 0); | |
| 2000/0401 | if(cpuserver) | |
| 2002/0109 | ksetenv("service", "cpu", 0); | |
| 2000/0401 | else | |
| 2002/0109 | ksetenv("service", "terminal", 0); | |
| 2000/0401 | for(i = 0; i < nconf; i++) | |
| 2002/0109 | if(confname[i]) ksetenv(confname[i], confval[i], 1); | |
| 1999/0415 | poperror(); } | |
| 2001/0731/sys/src/9/alphapc/main.c:257,262 – 2002/0109/sys/src/9/alphapc/main.c:257,270 | ||
| 1999/0515 | * trashed page tables it will crash. */ | |
| 1999/0415 | } | |
| 2002/0109 | /* still too do */ void reboot(void*, void*, ulong) { exit(0); } | |
| 1999/0415 | void exit(int) | |
| 2002/0109/sys/src/9/alphapc/main.c:258,270 – 2002/0112/sys/src/9/alphapc/main.c:258,269 (short | long) | ||
|
Comment edit.
rsc Fri Mar 4 12:44:25 2005 | ||
| 1999/0515 | */ | |
| 1999/0415 | } | |
| 2002/0109 |
| |
| 2002/0112 | /* still to do */ | |
| 2002/0109 | void reboot(void*, void*, ulong) { exit(0); } | |
| 1999/0415 | void exit(int) | |
| 2002/0112/sys/src/9/alphapc/main.c:233,250 – 2002/0116/sys/src/9/alphapc/main.c:233,240 (short | long) | ||
|
Remove comment about fpsave. Call mmupark to switch to per-CPU page tables.
rsc Fri Mar 4 12:44:25 2005 | ||
| 1999/0515 | if(p->fpstate == FPactive){ if(p->state == Moribund) fpenab(0); | |
| 2002/0116 | else | |
| 1999/0515 | savefpregs(&up->fpsave); | |
| 2002/0112/sys/src/9/alphapc/main.c:256,261 – 2002/0116/sys/src/9/alphapc/main.c:246,252 | ||
| 1999/0515 | * When this processor eventually has to get an entry from the * trashed page tables it will crash. */ | |
| 2002/0116 | mmupark(); | |
| 1999/0415 | } | |
| 2002/0109 | ||
| 2002/0112 | /* still to do */ | |
| 2002/0116/sys/src/9/alphapc/main.c:82,87 – 2002/0217/sys/src/9/alphapc/main.c:82,88 (short | long) | ||
|
Add quotefmtinstall.
rsc Fri Mar 4 12:44:25 2005 | ||
| 2000/0108 | printinit(); | |
| 1999/0415 | kbdinit(); | |
| 2001/0727 | i8250console(); | |
| 2002/0217 | quotefmtinstall(); | |
| 2001/0727 | print("\nPlan 9\n"); | |
| 1999/0415 | cpuidprint(); | |
| 2002/0217/sys/src/9/alphapc/main.c:154,161 – 2002/0323/sys/src/9/alphapc/main.c:154,164 (short | long) | ||
| 2000/0401 | else | |
| 2002/0109 | ksetenv("service", "terminal", 0); | |
| 2000/0401 | for(i = 0; i < nconf; i++) | |
| 2002/0109 |
| |
| 2002/0323 | if(confname[i]){ if(confname[i][0] != '*') ksetenv(confname[i], confval[i], 0); | |
| 2002/0109 | ksetenv(confname[i], confval[i], 1); | |
| 2002/0323 | } | |
| 1999/0415 | poperror(); } | |
| 2002/0323/sys/src/9/alphapc/main.c:91,96 – 2002/0410/sys/src/9/alphapc/main.c:91,97 (short | long) | ||
| 1999/0415 | procinit0(); initseg(); | |
| 2002/0410 | timersinit(); | |
| 1999/0415 | links(); chandevreset(); | |
| 1999/0423 | pageinit(); | |
| 2002/0410/sys/src/9/alphapc/main.c:32,37 – 2002/1130/sys/src/9/alphapc/main.c:32,38 (short | long) | ||
| 2001/0728 | cp = bootargs; strncpy(cp, bootconf->bootargs, BOOTARGSLEN); | |
| 2000/0401 | cp[BOOTARGSLEN-1] = 0; | |
| 2002/1130 | /* can't print in this routine, see below in main() */ | |
| 2000/0401 | ||
| 2001/0727 | /* * Strip out '\r', change '\t' -> ' '. | |
| 2002/0410/sys/src/9/alphapc/main.c:60,65 – 2002/1130/sys/src/9/alphapc/main.c:61,78 | ||
| 2000/0401 | } } | |
| 2002/1130 | /* debugging only */ static void dumpopts(void) { int i; print("dumpopts: found /alpha/conf options at 0x%lux\n", bootconf->bootargs); for(i = 0; i < nconf; i++) print("dumpopts: read %s=%s\n", confname[i], confval[i]); } | |
| 1999/0415 | void main(void) { | |
| 2002/0410/sys/src/9/alphapc/main.c:80,85 – 2002/1130/sys/src/9/alphapc/main.c:93,100 | ||
| 1999/0415 | trapinit(); | |
| 2000/0108 | screeninit(); printinit(); | |
| 2002/1130 | /* it's now safe to print */ /* dumpopts(); /* DEBUG */ | |
| 1999/0415 | kbdinit(); | |
| 2001/0727 | i8250console(); | |
| 2002/0217 | quotefmtinstall(); | |
| 2002/0410/sys/src/9/alphapc/main.c:102,107 – 2002/1130/sys/src/9/alphapc/main.c:117,142 | ||
| 1999/0415 | schedinit(); } | |
| 2002/1130 | /* cpu->state bits */ enum { Cpubootinprog = 1, /* boot in progress */ Cpucanrestart = 2, /* restart possible */ Cpuavail = 4, /* processor available */ Cpuexists = 8, /* processor present */ Cpuuserhalted = 0x10, /* user halted */ Cpuctxtokay = 0x20, /* context valid */ Cpupalokay = 0x40, /* PALcode valid */ Cpupalmemokay = 0x80, /* PALcode memory valid */ Cpupalloaded = 0x100, /* PALcode loaded */ Cpuhaltmask = 0xff0000, /* halt request mask */ Cpuhaltdflt = 0, Cpuhaltsaveexit = 0x10000, Cpuhaltcoldboot = 0x20000, Cpuhaltwarmboot = 0x30000, Cpuhaltstayhalted = 0x40000, Cpumustbezero = 0xffffffffff000000, /* 24:63 -- must be zero */ }; | |
| 1999/0415 | /* * initialize a processor's mach structure. each processor does this * for itself. | |
| 2002/0410/sys/src/9/alphapc/main.c:121,128 – 2002/1130/sys/src/9/alphapc/main.c:156,164 | ||
| 1999/0415 | active.machs = 1; | |
| 2001/0728 | cpu = (Hwcpu*) ((ulong)hwrpb + hwrpb->cpuoff + n*hwrpb->cpulen); | |
| 2002/1130 | cpu->state &= ~Cpubootinprog; if (0) cpu->state |= Cpuhaltstayhalted; | |
| 1999/0415 | } void | |
| 2002/0410/sys/src/9/alphapc/main.c:129,135 – 2002/1130/sys/src/9/alphapc/main.c:165,171 | ||
| 1999/0415 | init0(void) { | |
| 2000/0401 | int i; | |
| 2001/0727 |
| |
| 2002/1130 | char buf[2*KNAMELEN]; | |
| 1999/0415 | ||
| 2001/0727 | up->nerrlab = 0; | |
| 2002/0410/sys/src/9/alphapc/main.c:147,155 – 2002/1130/sys/src/9/alphapc/main.c:183,191 | ||
| 1999/0415 | chandevinit(); if(!waserror()){ | |
| 2002/1130 | snprint(buf, sizeof(buf), "alpha %s alphapc", conffile); ksetenv("terminal", buf, 0); | |
| 2002/0109 | ksetenv("cputype", "alpha", 0); | |
| 2001/0727 |
| |
| 2002/0109 |
| |
| 2000/0401 | if(cpuserver) | |
| 2002/0109 | ksetenv("service", "cpu", 0); | |
| 2000/0401 | else | |
| 2002/0410/sys/src/9/alphapc/main.c:254,268 – 2002/1130/sys/src/9/alphapc/main.c:290,393 | ||
| 2002/0116 | mmupark(); | |
| 1999/0415 | } | |
| 2002/0109 | ||
| 2002/0112 |
| |
| 2002/0109 | void | |
| 2002/1130 | setupboot(int halt) | |
| 2002/0109 | { | |
| 2002/1130 | int n = 0; // cpu id of primary cpu, not just m->machno Hwcpu *cpu = (Hwcpu*)((ulong)hwrpb + hwrpb->cpuoff + n*hwrpb->cpulen); cpu->state &= ~(Cpucanrestart | Cpuhaltmask); cpu->state |= (halt? Cpuhaltstayhalted: Cpuhaltwarmboot); } /* from ../pc */ static void shutdown(int ispanic) { int ms, once; lock(&active); if(ispanic) active.ispanic = ispanic; else if(m->machno == 0 && (active.machs & (1<<m->machno)) == 0) active.ispanic = 0; once = active.machs & (1<<m->machno); active.machs &= ~(1<<m->machno); active.exiting = 1; unlock(&active); if(once) print("cpu%d: exiting\n", m->machno); spllo(); for(ms = 5*1000; ms > 0; ms -= TK2MS(2)){ delay(TK2MS(2)); if(active.machs == 0 && consactive() == 0) break; } if(active.ispanic && m->machno == 0) { if(cpuserver) delay(10000); else for (;;) continue; } else delay(1000); } /* from ../pc: */ void reboot(void *entry, void *code, ulong size) { // writeconf(); // pass kernel environment to next kernel 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(); #ifdef FUTURE { ulong *pdb; /* * 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 */ { void (*f)(ulong, ulong, ulong) = (void*)REBOOTADDR; memmove(f, rebootcode, sizeof(rebootcode)); #else USED(entry, code, size); #endif print("rebooting...\n"); #ifdef FUTURE /* off we go - never to return */ (*f)(PADDR(entry), PADDR(code), size); } #endif setupboot(0); // reboot, don't halt | |
| 2002/0109 | exit(0); } | |
| 1999/0415 | void | |
| 2002/1130 | exit(int ispanic) | |
| 1999/0415 | { canlock(&active); active.machs &= ~(1<<m->machno); | |
| 2002/0410/sys/src/9/alphapc/main.c:277,285 – 2002/1130/sys/src/9/alphapc/main.c:402,422 | ||
| 1999/0415 | splhi(); delay(1000); /* give serial fifo time to finish flushing */ | |
| 2002/1130 | if (getconf("*debug") != nil) { USED(ispanic); delay(60*1000); /* give us time to read the screen */ } | |
| 2000/0401 | if(arch->coredetach) | |
| 1999/0415 | arch->coredetach(); | |
| 2002/1130 | setupboot(1); // set up to halt for (; ; ) firmware(); // on PC is just: if (0) { shutdown(ispanic); // arch->reset(); } | |
| 1999/0415 | } void | |
| 2002/0410/sys/src/9/alphapc/main.c:414,420 – 2002/1130/sys/src/9/alphapc/main.c:551,557 | ||
| 2000/0401 | memholes(void) | |
| 1999/0415 | { | |
| 2000/0401 | Bank *b, *eb; | |
| 2002/1130 | ||
| 2000/0401 | b = bootconf->bank; eb = b+bootconf->nbank; while(b < eb) { | |
| 2002/0410/sys/src/9/alphapc/main.c:453,462 – 2002/1130/sys/src/9/alphapc/main.c:590,599 | ||
| 1999/0415 | { int n; | |
| 2002/1130 | for(n = 0; n < nconf; n++) if(cistrcmp(confname[n], name) == 0) { | |
| 1999/0415 | return confval[n]; | |
| 2002/1130 | } | |
| 1999/0415 | return 0; } | |
| 2002/0410/sys/src/9/alphapc/main.c:501,507 – 2002/1130/sys/src/9/alphapc/main.c:638,644 | ||
| 1999/0415 | for(;;){ ac = *a++; bc = *b++; | |
| 2002/1130 | ||
| 1999/0415 | if(ac >= 'A' && ac <= 'Z') ac = 'a' + (ac - 'A'); if(bc >= 'A' && bc <= 'Z') | |