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

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

1990/0709/sys/src/9/gnot/mmu.c:12,171990/0921/sys/src/9/gnot/mmu.c:12,28 (short | long | prev | next)
1990/06021    
	KMap	arena[4*1024*1024/BY2PG];	/* kernel mmu maps up to 4MB */ 
}kmapalloc; 
 
1990/0921    
void 
putxmmu(ulong tlbvirt, ulong tlbphys, int pid) 
{ 
	if(pid != u->p->pid) 
		panic("putxmmu %ld %ld\n", pid, u->p->pid); 
	if(tlbvirt&KZERO) 
		panic("putmmu"); 
	tlbphys |= VTAG(tlbvirt)<<24; 
	UMAP[(tlbvirt&0x003FE000L)>>2] = tlbphys; 
} 
 
1990/03091    
/* 
 * Called splhi, not in Running state 
 */ 
1990/0709/sys/src/9/gnot/mmu.c:19,241990/0921/sys/src/9/gnot/mmu.c:30,36
1990/03091    
mapstack(Proc *p) 
{ 
	ulong tlbvirt, tlbphys; 
1990/0921    
	ulong i; 
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/0709/sys/src/9/gnot/mmu.c:27,321990/0921/sys/src/9/gnot/mmu.c:39,52
1990/03091    
	putkmmu(tlbvirt, tlbphys); 
	flushmmu(); 
	u = (User*)USERADDR; 
1990/0921    
 
	if(u->mc.next >= NMMU){ 
		u->mc.next &= NMMU - 1; 
		for(i = u->mc.next; i < NMMU; i++) 
			putxmmu(u->mc.mmu[i].va, u->mc.mmu[i].pa, u->mc.mmu[i].pid); 
	} 
	for(i = 0; i < u->mc.next; i++) 
		putxmmu(u->mc.mmu[i].va, u->mc.mmu[i].pa, u->mc.mmu[i].pid);/**/ 
1990/03091    
} 
 
void 
1990/0709/sys/src/9/gnot/mmu.c:43,481990/0921/sys/src/9/gnot/mmu.c:63,76
1990/03091    
{ 
	if(tlbvirt&KZERO) 
		panic("putmmu"); 
1990/0921    
	if(u){ 
		MMU *mp; 
		mp = &(u->mc.mmu[u->mc.next&(NMMU-1)]); 
		mp->pa = tlbphys; 
		mp->va = tlbvirt; 
		mp->pid = u->p->pid; 
		u->mc.next++; 
	}/**/ 
1990/03091    
	tlbphys |= VTAG(tlbvirt)<<24; 
	UMAP[(tlbvirt&0x003FE000L)>>2] = tlbphys; 
} 
1990/0709/sys/src/9/gnot/mmu.c:53,581990/0921/sys/src/9/gnot/mmu.c:81,102
1990/03091    
	flushcpucache(); 
	*PARAM &= ~TLBFLUSH_; 
	*PARAM |= TLBFLUSH_; 
1990/0921    
} 
 
void 
flushmmucache(void) 
{ 
	if(u == 0) 
		panic("flushmmucache"); 
	u->mc.next = 0; 
} 
 
void 
clearmmucache(void) 
{ 
	if(u == 0) 
		panic("clearmmucache"); 
	memset(&u->mc, 0, sizeof u->mc); 
1990/06021    
} 
 
void 


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