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

1991/0821/gnot/mmu.c (diff list | history)

1991/0817/sys/src/9/gnot/mmu.c:9,151991/0821/sys/src/9/gnot/mmu.c:9,15 (short | long | prev | next)
1990/06021    
	Lock; 
	int	init; 
	KMap	*free; 
	KMap	arena[4*1024*1024/BY2PG];	/* kernel mmu maps up to 4MB */ 
1991/0821    
	KMap	arena[MB4/BY2PG];	/* kernel mmu maps up to 4MB */ 
1990/06021    
}kmapalloc; 
 
1990/03091    
/* 
1991/0817/sys/src/9/gnot/mmu.c:120,1341991/0821/sys/src/9/gnot/mmu.c:120,137
1990/06021    
 
	if(kmapalloc.init == 0){ 
		k = &kmapalloc.arena[0]; 
1990/0709    
		k->va = KZERO|(4*1024*1024-256*1024-BY2PG); 
1991/0821    
		k->va = KZERO|(MB4-256*1024-BY2PG); 
1990/06021    
		k->next = 0; 
		kmapalloc.free = k; 
		kmapalloc.init = 1; 
		return; 
	} 
	e = (4*1024*1024 - 256*1024)/BY2PG;	/* screen lives at top 256K */ 
1991/0821    
 
	e = (MB4 - 256*1024)/BY2PG;	/* screen lives at top 256K */ 
1991/0802    
	i = PGROUND(((ulong)ialloc(0, 0))&~KZERO)/BY2PG; 
1991/0821    
 
1990/0709    
	print("%lud free map registers\n", e-i); 
1991/0821    
 
1990/06021    
	kmapalloc.free = 0; 
	for(k=&kmapalloc.arena[i]; i<e; i++,k++){ 
		k->va = i*BY2PG|KZERO; 
1991/0817/sys/src/9/gnot/mmu.c:140,1511991/0821/sys/src/9/gnot/mmu.c:143,149
1990/06021    
kmap(Page *pg) 
{ 
	KMap *k; 
1991/0817    
	int s; 
1990/06021    
 
1991/0817    
	if(u && u->p){ 
		s = u->p->state; 
		u->p->state = MMUing; 
	} 
1990/06021    
	lock(&kmapalloc); 
	k = kmapalloc.free; 
1990/0709    
	if(k == 0){ 
1991/0817/sys/src/9/gnot/mmu.c:154,1631991/0821/sys/src/9/gnot/mmu.c:152,160
1990/0709    
	} 
1990/06021    
	kmapalloc.free = k->next; 
	unlock(&kmapalloc); 
1991/0821    
 
1990/06021    
	k->pa = pg->pa; 
	putkmmu(k->va, PPN(k->pa) | PTEVALID | PTEKERNEL); 
1991/0817    
	if(u && u->p) 
		u->p->state = s; 
1990/06021    
	return k; 
} 
 
1991/0817/sys/src/9/gnot/mmu.c:165,1741991/0821/sys/src/9/gnot/mmu.c:162,172
1990/06021    
kunmap(KMap *k) 
{ 
	k->pa = 0; 
1991/0821    
	putkmmu(k->va, INVALIDPTE); 
 
1990/06021    
	lock(&kmapalloc); 
	k->next = kmapalloc.free; 
	kmapalloc.free = k; 
	putkmmu(k->va, INVALIDPTE); 
	unlock(&kmapalloc); 
1990/1211    
} 
 


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