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

1990/1211/port/proc.c (diff list | history)

1990/1124/sys/src/9/port/proc.c:52,581990/1211/sys/src/9/port/proc.c:52,58 (short | long | prev | next)
Add invalidateu function, save, restore, clearmmucache.
rsc Mon Mar 20 17:14:06 2006
1990/0227    
	if(u){ 
		m->proc = 0; 
		p = u->p; 
		puttlbx(0, KZERO | PTEPID(0), 0);	/* safety first */ 
1990/1211    
		invalidateu();	/* safety first */ 
1990/0227    
		u = 0; 
		if(p->state == Running) 
			ready(p); 
1990/1124/sys/src/9/port/proc.c:76,811990/1211/sys/src/9/port/proc.c:76,82
1990/0227    
void 
sched(void) 
{ 
1990/1211    
	uchar procstate[64];		/* sleeze for portability */ 
1990/0227    
	Proc *p; 
	ulong tlbvirt, tlbphys; 
1990/0731    
	void (*f)(ulong, ulong); 
1990/1124/sys/src/9/port/proc.c:82,921990/1211/sys/src/9/port/proc.c:83,95
1990/0227    
 
	if(u){ 
		splhi(); 
1990/1211    
		save(procstate, sizeof(procstate)); 
1990/0227    
		if(setlabel(&u->p->sched)){	/* woke up */ 
			p = u->p; 
			p->state = Running; 
			p->mach = m; 
			m->proc = p; 
1990/1211    
			restore(p, procstate); 
1990/0227    
			spllo(); 
			return; 
		} 
1990/1124/sys/src/9/port/proc.c:132,1381990/1211/sys/src/9/port/proc.c:135,141
1990/0227    
 
loop: 
	while(runq.head == 0) 
		for(i=0; i<10; i++) 
1990/1211    
		for(i=0; i<10; i++)	/* keep out of shared memory for a while */ 
1990/0227    
			; 
	splhi(); 
	lock(&runq); 
1990/1124/sys/src/9/port/proc.c:573,5781990/1211/sys/src/9/port/proc.c:576,582
1990/0227    
	/* 
	 * Save time: only copy u-> data and useful stack 
	 */ 
1990/1211    
	clearmmucache(); 
1990/0617    
	memcpy(up, u, sizeof(User)); 
1990/0227    
	n = USERADDR+BY2PG - (ulong)&lastvar; 
	n = (n+32) & ~(BY2WD-1);	/* be safe & word align */ 


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