char *plan9inistr;
Plan9ini plan9ini[MAXCONF];
int nconf;
Conf conf;
FPsave initfp;
Lock testlock;
static void plan9iniinit(void);
char *
cpuid(void)
{
char *id;
id = "unknown PowerPC";
switch(m->cputype) {
case 8:
id = "PowerPC 750";
break;
case 9:
id = "PowerPC 604e";
break;
case 0x81:
id = "PowerPC 8260";
break;
case 0x8081:
id = "PowerPC 826xA";
break;
default:
break;
}
return id;
}
void
cpuidprint(void)
{
print("cpu0: %s, rev 0x%lux, cpu hz %lld, bus hz %ld\n",
cpuid(), getpvr()&0xffff, m->cpuhz, m->bushz);
}
/*
* 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.
*/
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;
}
}
static int
getcfields(char* lp, char** fields, int n, char* sep)
{
int i;