plan 9 kernel history: overview | file list | diff list

1991/0711/pc/main.c (diff list | history)

1991/0709/sys/src/9/pc/main.c:5,211991/0711/sys/src/9/pc/main.c:5,36 (short | long | prev | next)
1991/0702    
#include	"fns.h" 
1991/0706    
#include	"io.h" 
1991/0629    
 
1991/0711    
 
char sysname[NAMELEN]; 
Conf	conf; 
char	user[NAMELEN] = "bootes"; 
 
extern ulong edata; 
 
1991/0702    
main(void) 
1991/0625    
{ 
1991/0711    
	int i; 
 
	machinit(); 
	confinit(); 
1991/0703    
	screeninit(); 
1991/0711    
	print("%d pages in bank0, %d pages in bank1\n", conf.npage0, conf.npage1); 
	print("edata == %lux, end == %lux\n", &edata, &end); 
1991/0703    
	trapinit(); 
1991/0711    
	mmuinit(); 
	clockinit(); 
	alarminit(); 
1991/0703    
	kbdinit(); 
1991/0706    
	clockinit(); 
	mmuinit(); 
	floppyinit(); 
1991/0705    
	spllo(); 
1991/0709    
	floppystart(0); 
1991/0706    
	for(;;){ 
1991/0711    
 
	for(i=0; i<100; i++){ 
1991/0706    
		int c; 
 
		c = getc(&kbdq); 
1991/0709/sys/src/9/pc/main.c:22,461991/0711/sys/src/9/pc/main.c:37,155
1991/0706    
		if(c!=-1) 
			screenputc(c); 
		idle(); 
1991/0709    
		if((TK2SEC(m->ticks)%5)==0) 
			if((TK2SEC(m->ticks)%10)==0) 
				floppystop(0); 
			else 
				floppystart(0); 
1991/0711    
		floppyseek(0, 0); 
		floppyseek(0, 18*512*20); 
1991/0706    
	} 
1991/0711    
	for(;;); 
1991/0625    
} 
 
1991/0629    
void 
1991/0711    
machinit(void) 
{ 
	int n; 
 
	n = m->machno; 
	memset(m, 0, sizeof(Mach)); 
	m->machno = n; 
	m->mmask = 1<<m->machno; 
	active.machs = 1; 
} 
 
void 
1991/0702    
delay(int l) 
1991/0625    
{ 
1991/0702    
	int i; 
1991/0625    
 
1991/0702    
	while(--l){ 
1991/0706    
		for(i=0; i < 100; i++) 
1991/0711    
		for(i=0; i < 404; i++) 
1991/0702    
			; 
	} 
1991/0625    
} 
 
1991/0711    
void 
confinit(void) 
{ 
	long x, i, j, *l; 
	int mul; 
 
	/* 
	 *  size memory 
	 */ 
	x = 0x12345678; 
	for(i=1; i<16; i++){ 
		/* 
		 *  write the word 
		 */ 
		l = (long*)(KZERO|(i*1024L*1024L)); 
		*l = x; 
		/* 
		 *  take care of wraps 
		 */ 
		for(j = 0; j < i; j++){ 
			l = (long*)(KZERO|(j*1024L*1024L)); 
			*l = 0; 
		} 
		/* 
		 *  check 
		 */ 
		l = (long*)(KZERO|(i*1024L*1024L)); 
		if(*l != x) 
			break; 
		x += 0x3141526; 
	} 
 
	/* 
	 *  the first 640k is the standard useful memory 
	 */ 
	conf.npage0 = 640/4; 
	conf.base0 = 0; 
 
	/* 
	 *  the last 128k belongs to the roms 
	 */ 
	conf.npage1 = (i)*1024/4; 
	conf.base1 = 1024/4; 
 
	conf.npage = conf.npage0 + conf.npage1; 
	conf.maxialloc = (640*1024-256*1024-BY2PG); 
 
	mul = 1; 
	conf.nproc = 20 + 50*mul; 
	conf.npgrp = conf.nproc/2; 
	conf.nseg = conf.nproc*3; 
	conf.npagetab = (conf.nseg*14)/10; 
	conf.nswap = conf.nproc*80; 
	conf.nimage = 50; 
	conf.nalarm = 1000; 
	conf.nchan = 4*conf.nproc; 
	conf.nenv = 4*conf.nproc; 
	conf.nenvchar = 8000*mul; 
	conf.npgenv = 200*mul; 
	conf.nmtab = 50*mul; 
	conf.nmount = 80*mul; 
	conf.nmntdev = 15*mul; 
	conf.nmntbuf = conf.nmntdev+3; 
	conf.nmnthdr = 2*conf.nmntdev; 
	conf.nsrv = 16*mul;			/* was 32 */ 
	conf.nbitmap = 512*mul; 
	conf.nbitbyte = conf.nbitmap*1024*screenbits(); 
	conf.nfont = 10*mul; 
	conf.nnoifc = 1; 
	conf.nnoconv = 32; 
	conf.nurp = 32; 
	conf.nasync = 1; 
	conf.nstream = (conf.nproc*3)/2; 
	conf.nqueue = 5 * conf.nstream; 
	conf.nblock = 24 * conf.nstream; 
	conf.npipe = conf.nstream/2; 
	conf.copymode = 0;			/* copy on write */ 
	conf.ipif = 8; 
	conf.ip = 64; 
	conf.arp = 32; 
	conf.frag = 32; 
	conf.cntrlp = 0; 
} 
 
1991/0702    
int 
sprint(char *s, char *fmt, ...) 
1991/0625    
{ 
1991/0709/sys/src/9/pc/main.c:73,791991/0711/sys/src/9/pc/main.c:182,231
1991/0706    
		idle(); 
1991/0705    
} 
 
1991/0711    
int 
kbdputc(IOQ* q, int c) 
{ 
	if(c==0x10) 
		panic("^p"); 
	putc(q, c); 
} 
 
struct Palloc palloc; 
 
void* 
ialloc(ulong n, int align) 
{ 
	ulong p; 
 
	if(palloc.active && n!=0) 
		print("ialloc bad\n"); 
	if(palloc.addr == 0) 
		palloc.addr = ((ulong)&end)&~KZERO; 
	if(align) 
		palloc.addr = PGROUND(palloc.addr); 
 
	memset((void*)(palloc.addr|KZERO), 0, n); 
	p = palloc.addr; 
	palloc.addr += n; 
	if(align) 
		palloc.addr = PGROUND(palloc.addr); 
 
	if(palloc.addr >= conf.maxialloc) 
		panic("keep bill joy away"); 
 
	return (void*)(p|KZERO); 
} 
 
1991/0705    
void 
sched(void) 
1991/0711    
{ } 
 
void 
ready(Proc*p) 
{ } 
 
int 
postnote(Proc*p, int x, char* y, int z) 
1991/0705    
{ 
1991/0711    
	panic("postnote"); 
1991/0702    
} 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)