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

1990/1211/gnot/main.c (diff list | history)

1990/1128/sys/src/9/gnot/main.c:7,121990/1211/sys/src/9/gnot/main.c:7,15 (short | long | prev | next)
1990/03091    
#include	"ureg.h" 
#include	"init.h" 
 
1990/1211    
#include	<libg.h> 
#include	<gnot.h> 
 
1990/0613    
typedef struct Boot Boot; 
 
struct Boot 
1990/1128/sys/src/9/gnot/main.c:103,1091990/1211/sys/src/9/gnot/main.c:106,117
1990/03091    
{ 
1990/0613    
	Chan *c; 
 
1990/1004    
	restore(); 
1990/1211    
	u->nerrlab = 0; 
	m->proc = u->p; 
	u->p->state = Running; 
	u->p->mach = m; 
	spllo(); 
 
1990/03091    
	chandevinit(); 
	 
	u->slash = (*devtab[0].attach)(0); 
1990/1128/sys/src/9/gnot/main.c:137,1421990/1211/sys/src/9/gnot/main.c:145,151
1990/03091    
	p->pgrp = newpgrp(); 
	strcpy(p->text, "*init*"); 
1990/11211    
	strcpy(p->pgrp->user, user); 
1990/1211    
	p->fpstate = FPinit; 
1990/03091    
 
	/* 
	 * Kernel Stack 
1990/1128/sys/src/9/gnot/main.c:177,1831990/1211/sys/src/9/gnot/main.c:186,191
1990/03091    
	s->minva = UTZERO; 
	s->maxva = UTZERO+BY2PG; 
 
1990/1004    
	m->proc = p; 
1990/03091    
	ready(p); 
} 
 
1990/1128/sys/src/9/gnot/main.c:300,3051990/1211/sys/src/9/gnot/main.c:308,314
1990/06021    
	conf.npage1 = (bank[1]*1024*1024)/BY2PG; 
	conf.base1 = 16*1024*1024; 
	conf.npage = conf.npage0+conf.npage1; 
1990/1211    
	conf.maxialloc = (4*1024*1024-256*1024-BY2PG); 
1990/0612    
	mul = 1 + (conf.npage1>0); 
1990/0721    
	conf.nproc = 50*mul; 
1990/0709    
	conf.npgrp = 12*mul; 
1990/1128/sys/src/9/gnot/main.c:330,3331990/1211/sys/src/9/gnot/main.c:339,411
1990/1006    
	conf.npipe = conf.nstream/2; 
1990/1115    
	conf.nservice = 3*mul;			/* was conf.nproc/5 */ 
1990/1110    
	conf.nfsyschan = 31 + conf.nchan/20; 
1990/1211    
} 
 
/* 
 *  set up floating point for a new process 
 */ 
void 
setup(Proc *p) 
{ 
	long fpnull; 
 
	fpnull = 0; 
	splhi(); 
	m->fpstate = FPinit; 
	p->fpstate = FPinit; 
	fprestore((FPsave*)&fpnull); 
	spllo(); 
} 
 
/* 
 * Save the part of the process state. 
 */ 
void 
save(uchar *state, int len) 
{ 
	Balu *balu; 
 
	if(len < sizeof(Balu)) 
		panic("save state too small"); 
	balu = (Balu *)state; 
	fpsave(&u->fpsave); 
	if(u->fpsave.type){ 
		if(u->fpsave.size > sizeof u->fpsave.junk) 
			panic("fpsize %d max %d\n", u->fpsave.size, sizeof u->fpsave.junk); 
		fpregsave(u->fpsave.reg); 
		u->p->fpstate = FPactive; 
		m->fpstate = FPdirty; 
	} 
	if(BALU->cr0 != 0xFFFFFFFF)	/* balu busy */ 
		memcpy(balu, BALU, sizeof(Balu)); 
	else{ 
		balu->cr0 = 0xFFFFFFFF; 
		BALU->cr0 = 0xFFFFFFFF; 
	} 
} 
 
/* 
 *  Restore what save() saves 
 * 
 *  Save() makes sure that what state points to is long enough 
 */ 
void 
restore(Proc *p, uchar *state) 
{ 
	Balu *balu; 
 
	balu = (Balu *)state; 
	if(p->fpstate != m->fpstate){ 
		if(p->fpstate == FPinit){ 
			u->p->fpstate = FPinit; 
			fprestore(&initfp); 
			m->fpstate = FPinit; 
		}else{ 
			fpregrestore(u->fpsave.reg); 
			fprestore(&u->fpsave); 
			m->fpstate = FPdirty; 
		} 
	} 
	if(balu->cr0 != 0xFFFFFFFF)	/* balu busy */ 
		memcpy(BALU, balu, sizeof balu); 
1990/03091    
} 


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