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

1990/1004/gnot/mmu.c (diff list | history)

1990/0928/sys/src/9/gnot/mmu.c:19,251990/1004/sys/src/9/gnot/mmu.c:19,26 (short | long | prev | next)
1990/03091    
mapstack(Proc *p) 
{ 
	ulong tlbvirt, tlbphys; 
1990/0921    
	ulong i; 
1990/1004    
	ulong next; 
	MMU *mm, *mn, *me; 
1990/03091    
 
	if(p->upage->va != (USERADDR|(p->pid&0xFFFF))) 
		panic("mapstack %d 0x%lux 0x%lux", p->pid, p->upage->pa, p->upage->va); 
1990/0928/sys/src/9/gnot/mmu.c:26,331990/1004/sys/src/9/gnot/mmu.c:27,55
1990/03091    
	tlbvirt = USERADDR; 
	tlbphys = PPN(p->upage->pa) | PTEVALID | PTEKERNEL; 
	putkmmu(tlbvirt, tlbphys); 
	flushmmu(); 
	u = (User*)USERADDR; 
1990/1004    
 
	/* 
	 *  if not a kernel process and this process was not the  
	 *  last process on this machine, flush & preload mmu 
	 */ 
	if(!p->kp && p!=m->lproc){ 
		flushmmu(); 
 
		/* 
		 *  preload the MMU with the last (up to) NMMU user entries 
		 *  previously faulted into it for this process. 
		 */ 
		mn = &u->mc.mmu[u->mc.next&(NMMU-1)]; 
		me = &u->mc.mmu[NMMU]; 
		if(u->mc.next >= NMMU){ 
			for(mm = mn; mm < me; mm++) 
				UMAP[mm->va] = mm->pa; 
		} 
		for(mm = u->mc.mmu; mm < mn; mm++) 
			UMAP[mm->va] = mm->pa; 
 
		m->lproc = p; 
	} 
1990/03091    
} 
 
void 
1990/0928/sys/src/9/gnot/mmu.c:45,511990/1004/sys/src/9/gnot/mmu.c:67,85
1990/03091    
	if(tlbvirt&KZERO) 
		panic("putmmu"); 
	tlbphys |= VTAG(tlbvirt)<<24; 
	UMAP[(tlbvirt&0x003FE000L)>>2] = tlbphys; 
1990/1004    
	tlbvirt = (tlbvirt&0x003FE000L)>>2; 
	if(u){ 
		MMU *mp; 
		int s; 
 
		s = splhi(); 
		mp = &(u->mc.mmu[u->mc.next&(NMMU-1)]); 
		mp->pa = tlbphys; 
		mp->va = tlbvirt; 
		u->mc.next++; 
		splx(s); 
	} 
	UMAP[tlbvirt] = tlbphys; 
1990/03091    
} 
 
void 
1990/0928/sys/src/9/gnot/mmu.c:54,591990/1004/sys/src/9/gnot/mmu.c:88,101
1990/03091    
	flushcpucache(); 
	*PARAM &= ~TLBFLUSH_; 
	*PARAM |= TLBFLUSH_; 
1990/1004    
} 
 
void 
clearmmucache(void) 
{ 
	if(u == 0) 
		panic("flushmmucache"); 
	u->mc.next = 0; 
1990/06021    
} 
 
void 


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