~kris/9p

9hist

d9b7b9dfe239f61b43d160885811db9e67404560 — David du Colombier 34 years ago 5611c0b
Plan 9 from Bell Labs 1992-09-12
M boot/settime.c => boot/settime.c +5 -4
@@ 40,10 40,11 @@ settime(int islocal)
		f = open(timeserver, ORDWR);
		if(f < 0)
			return;
		if(mount(f, "/n/boot", MREPL, "", sauth) < 0){
			close(f);
			return;
		}
		if(mount(f, "/n/boot", MREPL, "", sauth) < 0)
			if(mount(f, "/n/boot", MREPL, "", "any") < 0){
				close(f);
				return;
			}
		close(f);
		if(stat("/n/boot", dirbuf) < 0)
			fatal("stat");

M port/alloc.c => port/alloc.c +4 -1
@@ 380,7 380,7 @@ xsummary(void)
{
	Hole *h;
	Bucket *k;
	int i, nfree;
	int i, nfree, nused;

	i = 0;
	for(h = xlists.flist; h; h = h->link)


@@ 393,12 393,15 @@ xsummary(void)
		i += h->size;
	}
	print("%d bytes free\n", i);
	nused = 0;
	for(i = 3; i < Maxpow; i++) {
		if(arena.btab[i] == 0 && arena.nbuck[i] == 0)
			continue;
		nused += arena.nbuck[i]*(1<<i);
		nfree = 0;
		for(k = arena.btab[i]; k; k = k->next)
			nfree++;
		print("%8d %4d %4d\n", 1<<i, arena.nbuck[i], nfree);
	}
	print("%d bytes in pool\n", nused);
}

M port/devbit.c => port/devbit.c +17 -12
@@ 11,8 11,6 @@
#include	<gnot.h>
#include	"screen.h"

extern GSubfont	*defont;

/*
 * Some monochrome screens are reversed from what we like:
 * We want 0's bright and 1's dark.


@@ 63,6 61,11 @@ struct BSubfont
	ulong	qid[2];		/* unique id used as a cache tag */
};

extern GSubfont	*defont;
       BSubfont	*bdefont;
       BSubfont bdefont0;


struct
{
	Ref;


@@ 182,7 185,7 @@ bitfreeup(void)
	/* free unused subfonts and compact */
	for(i=0; i<bit.nsubfont; i++){
		s = bit.subfont[i];
		if(s && s!=defont && s->ref==0){
		if(s && s!=bdefont && s->ref==0){
			s->ref = 1;
			s->qid[0] = ~0;	/* force cleanup */
			subfontfree(s, i);


@@ 247,6 250,8 @@ bitreset(void)
	ulong r;
	Arena *a;

	memmove(&bdefont0, defont, sizeof(*defont));
	bdefont = &bdefont0;
	if(!conf.monitor)
		return;
	bit.map = smalloc(DMAP*sizeof(GBitmap*));


@@ 365,7 370,7 @@ bitopen(Chan *c, int omode)
		b = smalloc(sizeof(GBitmap));
		*b = gscreen;
		bit.map[0] = b;			/* bitmap 0 is screen */
		bit.subfont[0] = (BSubfont*)defont;	/* subfont 0 is default */
		bit.subfont[0] = bdefont;	/* subfont 0 is default */
		bit.subfont[0]->ref = 1;
		bit.subfont[0]->qid[0] = 0;
		bit.subfont[0]->qid[1] = 0;


@@ 556,7 561,7 @@ bitread(Chan *c, void *va, long n, ulong offset)
		 * 	rectangle	16
		 * 	clip rectangle	16
		 *	font info	3*12
		 *	fontchars	6*(defont->n+1)
		 *	fontchars	6*(bdefont->n+1)
		 */
		if(n < 34)
			error(Ebadblt);


@@ 570,19 575,19 @@ bitread(Chan *c, void *va, long n, ulong offset)
		BPLONG(p+22, gscreen.clipr.min.y);
		BPLONG(p+26, gscreen.clipr.max.x);
		BPLONG(p+30, gscreen.clipr.max.y);
		if(n >= 34+3*12+6*(defont->n+1)){
		if(n >= 34+3*12+6*(bdefont->n+1)){
			p += 34;
			sprint((char*)p, "%11d %11d %11d ", defont->n,
				defont->height, defont->ascent);
			sprint((char*)p, "%11d %11d %11d ", bdefont->n,
				bdefont->height, bdefont->ascent);
			p += 3*12;
			for(i=defont->info,j=0; j<=defont->n; j++,i++,p+=6){
			for(i=bdefont->info,j=0; j<=bdefont->n; j++,i++,p+=6){
				BPSHORT(p, i->x);
				p[2] = i->top;
				p[3] = i->bottom;
				p[4] = i->left;
				p[5] = i->width;
			}
			n = 34+3*12+6*(defont->n+1);
			n = 34+3*12+6*(bdefont->n+1);
		}else
			n = 34;
		bit.init = 0;


@@ 1259,7 1264,7 @@ bitwrite(Chan *c, void *va, long n, ulong offset)
			pt.y = BGLONG(p+7);
			v = BGSHORT(p+11);
			if(v<0 || v>=bit.nfont || (ff=bit.font[v])==0)
				error(Ebadblt);
				error(Ebadfont);
			l = BGSHORT(p+15)*2;
			p += 17;
			m -= 17;


@@ 1635,7 1640,7 @@ fontfree(GFont *f)
void
subfontfree(BSubfont *s, int i)
{
	if(s!=defont && s->ref>0){	/* don't free subfont 0, defont */
	if(s!=bdefont && s->ref>0){	/* don't free subfont 0, bdefont */
		s->ref--;
		if(s->ref==0 && s->qid[0]==~0){	/* uncached */
			bitfree(s->bits);

M port/devlance.c => port/devlance.c +13 -3
@@ 362,10 362,11 @@ lanceoput(Queue *q, Block *bp)
	p = &l.tp[l.tc];
	if((MPus(m->flags)&LANCEOWNER) != 0)
		tsleep(&l.tr, isobuf, m, 128);
		if(isobuf(m) == 0){
		if(l.wedged || isobuf(m) == 0){
			qunlock(&l.tlock);
			freeb(bp);
			poperror();
			l.wedged = 0;
			print("lance wedged, dumping block & restarting\n");
			lancestart(0);
			return;


@@ 704,6 705,15 @@ lanceintr(void)
	if(csr & (BABL|MISS|MERR)){
		if(l.misses++ < 4)
			print("lance err %ux\n", csr);
		else {
			l.wedged = 1;
			l.misses = 0;
			*l.rap = 0;
			*l.rdp = STOP;
			wakeup(&l.rr);
			wakeup(&l.tr);
			return;
		}
	}

	if(csr & IDON){


@@ 737,9 747,9 @@ lanceintr(void)
static void
lanceup(Etherpkt *p, int len)
{
	int t;
	Block *bp;
	Ethertype *e;
	int t;

	if(len <= 0)
		return;


@@ 844,8 854,8 @@ lancekproc(void *arg)
		 *  if the lance is wedged, restart it
		 */
		if(l.wedged){
			print("lance wedged, restarting\n");
			l.wedged = 0;
			print("lance wedged, restarting\n");
			lancestart(0);
		}


M port/fault.c => port/fault.c +0 -2
@@ 184,8 184,6 @@ pio(Segment *s, ulong addr, ulong soff, Page **p)
	kaddr = (char*)VA(k);
	
	if(loadrec == 0) {			/* This is demand load */
if(u && strcmp(u->p->text, "rc") == 0)
print("dl: %d %s %lux\n", u->p->pid, u->p->text, addr);
		c = s->image->c;
		while(waserror()) {
			if(strcmp(u->error, Eintr) == 0)

M port/portdat.h => port/portdat.h +4 -3
@@ 355,9 355,10 @@ struct Swapalloc
{
	Lock;				/* Free map lock */
	int	free;			/* Number of currently free swap pages */
	char	*swmap;			/* Base of swap map in memory */
	char	*alloc;			/* Round robin allocator */
	char	*top;			/* Top of swap map */
	uchar	*swmap;			/* Base of swap map in memory */
	uchar	*alloc;			/* Round robin allocator */
	uchar	*last;			/* Speed swap allocation */
	uchar	*top;			/* Top of swap map */
	Rendez	r;			/* Pager kproc idle sleep */
	ulong	highwater;		/* Threshold beyond which we must page */
	ulong	headroom;		/* Space pager keeps free under highwater */

M port/qlock.c => port/qlock.c +4 -0
@@ 39,6 39,8 @@ canqlock(QLock *q)
		unlock(&q->use);
		return 0;
	}
	if(u)
		u->p->qlockpc = getcallerpc(((uchar*)&q) - sizeof(q));
	q->locked = 1;
	unlock(&q->use);
	return 1;


@@ 49,6 51,8 @@ qunlock(QLock *q)
{
	Proc *p;

	if(u)
		u->p->qlockpc = 0;
	lock(&q->use);
	p = q->head;
	if(p) {

M port/segment.c => port/segment.c +1 -1
@@ 345,7 345,7 @@ ibrk(ulong addr, int seg)

	if(newsize > (PTEMAPMEM*SEGMAPSIZE)/BY2PG) {
		qunlock(&s->lk);
		return -1;
		error(Enovmem);
	}

	s->top = newtop;

M port/swap.c => port/swap.c +12 -6
@@ 28,24 28,25 @@ swapinit(void)
	swapalloc.swmap = xalloc(conf.nswap);
	swapalloc.top = &swapalloc.swmap[conf.nswap];
	swapalloc.alloc = swapalloc.swmap;

	swapalloc.last = swapalloc.swmap;
	swapalloc.free = conf.nswap;
}

ulong
newswap(void)
{
	char *look;
	uchar *look;

	lock(&swapalloc);
	if(swapalloc.free == 0)
		panic("out of swap space");

	look = memchr(swapalloc.swmap, 0, conf.nswap);
	look = memchr(swapalloc.last, 0, swapalloc.top-swapalloc.last);
	if(look == 0)
		panic("inconsistant swap");

		panic("inconsistent swap");
	
	*look = 1;
	swapalloc.last = look;
	swapalloc.free--;
	unlock(&swapalloc);
	return (look-swapalloc.swmap) * BY2PG; 


@@ 54,9 55,14 @@ newswap(void)
void
putswap(Page *p)
{
	uchar *idx;

	lock(&swapalloc);
	if(--swapalloc.swmap[((ulong)p)/BY2PG] == 0)
	idx = &swapalloc.swmap[((ulong)p)/BY2PG];
	if(--(*idx) == 0)
		swapalloc.free++;
	if(idx < swapalloc.last)
		swapalloc.last = idx;
	unlock(&swapalloc);
}


M port/taslock.c => port/taslock.c +1 -1
@@ 13,7 13,7 @@ lock(Lock *l)
	ulong pc;

	pc = getcallerpc(((uchar*)&l) - sizeof(l));
	for(i = 0; i < 10000000; i++){
	for(i = 0; i < 100000000; i++){
    		if (tas(&ll->key) == 0){
			if(u)
				u->p->hasspin = 1;

M ss/compile.c => ss/compile.c +2 -9
@@ 21,8 21,6 @@ ulong	(*getsegspace)(ulong);
void	(*putsegspace)(ulong, ulong);
ulong	(*getpmegspace)(ulong);
void	(*putpmegspace)(ulong, ulong);
ulong	(*flushcx)(ulong);
ulong	(*flushpm)(ulong);
ulong	(*flushpg)(ulong);

/*


@@ 180,13 178,8 @@ compile(void)
	putsegspace = compilestaddr(STBA, 3);
	getpmegspace = compileldaddr(LDA, 4);
	putpmegspace = compilestaddr(STA, 4);
	if(conf.ss2){
	if(conf.ss2)
		flushpg = compile1(BY2PG, 6);
		flushpm = compile16(conf.vaclinesize, 5);
		flushcx = compile16(conf.vaclinesize, 7);
	}else{
	else
		flushpg = compile16(conf.vaclinesize, 0xD);
		flushpm = compile16(conf.vaclinesize, 0xC);
		flushcx = compile16(conf.vaclinesize, 0xE);
	}
}

M ss/faultsparc.c => ss/faultsparc.c +1 -1
@@ 33,7 33,7 @@ faultsparc(Ureg *ur)
		if(ser&(SE_WRITE|SE_PROT))
			read = 0;
	}
if(u && strcmp(u->p->text, "rc") == 0)
/*if(u && strcmp(u->p->text, "rc") == 0)
print("fault pc=%lux addr=%lux %d\n", ur->pc, addr, read);/**/
	spllo();
	if(u == 0){

M ss/fns.h => ss/fns.h +2 -3
@@ 68,7 68,8 @@ void	trap(Ureg*);
void	trapinit(void);
#define	wbflush()	/* mips compatibility */
#define	waserror()	(u->nerrlab++, setlabel(&u->errlab[u->nerrlab-1]))
#define getcallerpc(x)	(*(ulong*)(x))
#define getcallerpc(x)	_getcallerpc()
ulong	_getcallerpc(void);

/*
 * compiled entry points


@@ 85,6 86,4 @@ extern ulong	(*getsegspace)(ulong);
extern void	(*putsegspace)(ulong, ulong);
extern ulong	(*getpmegspace)(ulong);
extern void	(*putpmegspace)(ulong, ulong);
extern ulong	(*flushcx)(ulong);
extern ulong	(*flushpg)(ulong);
extern ulong	(*flushpm)(ulong);

M ss/l.s => ss/l.s +13 -21
@@ 1,6 1,6 @@
#include "mem.h"

#define	SYSPSR	(SPL(0x0)|PSREF|PSRET|PSRSUPER|SPL(15)|0)
#define	SYSPSR	(PSREF|PSRET|PSRSUPER|SPL(15))
#define	NOOP	ORN R0, R0; ORN R0, R0; ORN R0, R0

TEXT	start(SB), $-4


@@ 66,32 66,20 @@ TEXT	startvirt(SB), $-4
	MOVW	(R0), R0
	RETURN

TEXT	tas(SB), $0
TEXT	oldtas(SB), $0

	TAS	(R7), R7		/* LDSTUB, thank you ken */
	RETURN

TEXT	swap1_should_work(SB), $0
TEXT	tas(SB), $0			/* it seems we must be splhi */

	MOVW	R7, R8
	MOVW	$1, R7
	SWAP	(R8), R7
	RETURN

TEXT	swap1x(SB), $0

	MOVW	PSR, R9
	MOVW	R9, R10
	AND	$~PSRET, R10		/* BUG: book says this is buggy */
	MOVW	R10, PSR
	NOOP
	MOVW	(R7), R7
	CMP	R7, R0
	BNE	was1
	MOVW	$1, R10
	MOVW	R10, (R8)
was1:
	MOVW	PSR, R8
	MOVW	$SYSPSR, R9
	MOVW	R9, PSR
	NOOP
	TAS	(R7), R7		/* LDSTUB, thank you ken */
	MOVW	R8, PSR
	NOOP
	RETURN

TEXT	spllo(SB), $0


@@ 465,6 453,10 @@ TEXT	clearftt(SB), $0
	FMOVF	F0, F0
	RETURN

TEXT	_getcallerpc(SB), $0
	MOVW	0(R1), R7
	RETURN

GLOBL	mach0+0(SB), $MACHSIZE
GLOBL	fsr+0(SB), $BY2WD


M ss/main.c => ss/main.c +0 -5
@@ 57,7 57,6 @@ main(void)
	active.machs = 1;
	trapinit();
	confinit();
conf.monitor = 0;
	xinit();
	mmuinit();
	kmapinit();


@@ 140,8 139,6 @@ init0(void)
	print("Sun Sparcstation %s\n", sparam->name);
	print("bank 0: %dM  1: %dM\n", bank[0], bank[1]);
	print("frame buffer id %lux slot %ld %s\n", conf.monitor, fbslot, fbstr);
	if(conf.npage1 != conf.base1)
		print("kernel mem from second bank: reboot and fix!\n");

	u->slash = (*devtab[0].attach)(0);
	u->dot = clone(u->slash, 0);


@@ 447,8 444,6 @@ confinit(void)
	conf.frag = 32;
	if(cpuserver)
		conf.nproc = 500;

	conf.monitor = 0;
}

/*

M ss/mem.h => ss/mem.h +3 -3
@@ 19,7 19,7 @@
/*
 * Time
 */
#define	HZ		20			/* clock frequency */
#define	HZ		50			/* clock frequency */
#define	MS2HZ		(1000/HZ)		/* millisec per clock tick */
#define	TK2SEC(t)	((t)/HZ)		/* ticks to seconds */
#define	TK2MS(t)	((((ulong)(t))*1000)/HZ)	/* ticks to milliseconds */


@@ 86,10 86,10 @@

#define PTEMAPMEM	(1024*1024)	
#define	PTEPERTAB	(PTEMAPMEM/BY2PG)
#define SEGMAPSIZE	16
#define SEGMAPSIZE	128

#define	INVALIDPTE	0
#define	PPN(pa)		((pa>>12)&0xFFFF)
#define	PPN(pa)		(((pa)>>12)&0xFFFF)

/*
 * Weird addresses etc. in System ASI (2)

M ss/mmu.c => ss/mmu.c +73 -41
@@ 159,19 159,6 @@ mkfirst(List **list, List *entry)
}

/*
 *  remove from list
 */
static void
remove(List **list, List *entry)
{
	if(*list == entry)
		*list = entry->next;

	entry->prev->next = entry->next;
	entry->next->prev = entry->prev;
}

/*
 *  add to list
 */
static void


@@ 199,13 186,11 @@ static Pmeg*
allocpmeg(ulong virt)
{
	Pmeg *p;
	Ctx *c;

	virt = virt & ~(BY2SEGM-1);
	for(;;){
		p = (Pmeg*)m->plist;
		c = p->ctx;
		if(c == 0)
		if(p->ctx == 0)
			break;
		m->needpmeg = 1;
		sched();


@@ 217,7 202,7 @@ allocpmeg(ulong virt)
	p->cnext = m->cctx->pmeg;
	m->cctx->pmeg = p;
	p->virt = virt;
	p->lo = virt;
	p->lo = virt + BY2PG;
	p->hi = virt;
	putsegspace(p->virt, p->index);
	mklast(&m->plist, p);


@@ 229,7 214,7 @@ freepmeg(Pmeg *p, int flush)
{
	ulong x;

	/* invalidate any used PTE's, flush cache */
	/* invalidate any used PTE's */
	for(x = p->lo; x <= p->hi; x += BY2PG)
		putpme(x, INVALIDPTE, flush);



@@ 241,6 226,7 @@ freepmeg(Pmeg *p, int flush)
	p->cnext = 0;
	p->ctx = 0;
	p->virt = 0;
	mkfirst(&m->plist, p);
}

/*


@@ 253,8 239,12 @@ allocctx(Proc *proc)

	c = (Ctx*)m->clist;
	putctx(c);
	if(c->proc)
	if(c->proc){
		freectx(c, 1);
	}
	if(c->pmeg)
		panic("allocctx c->pmeg %lux\n", c->pmeg);

	c->proc = proc;
	c->proc->ctxonmach[m->machno] = c;
	mklast(&m->clist, c);


@@ 267,12 257,15 @@ freectx(Ctx *c, int flush)
	Pmeg *p;

	putctx(c);
	if(c->proc->ctxonmach[m->machno] != c)
		panic("freectx %lux %lux\n", c->proc->ctxonmach[m->machno], c);

	/* give back mappings */
	while(p = c->pmeg){
		if(p->ctx != c)
			panic("freectx: %lux/%lux\n", p->ctx, c);
		c->pmeg = p->cnext;
		freepmeg(p, flush);
		mkfirst(&m->plist, p);
	}

	/* flush u-> */


@@ 281,6 274,7 @@ freectx(Ctx *c, int flush)
	/* detach from process */
	c->proc->ctxonmach[m->machno] = 0;
	c->proc = 0;
	mkfirst(&m->clist, c);
}

static void


@@ 302,6 296,7 @@ flushpage(ulong virt)
	while(a < evirt);
}


/*
 *  stuff an entry into a pmeg
 */


@@ 330,8 325,11 @@ putmmu(ulong virt, ulong phys, Page *pg)
	x = getsegspace(v);
	if(x == INVALIDPMEG)
		p = allocpmeg(v);
	else
	else {
		p = &m->pmeg[x - m->pfirst];
		if(x != p->index)
			panic("putmmu %d/%d\n", x, p->index);
	}
	if(virt < p->lo)
		p->lo = virt;
	if(virt > p->hi)


@@ 356,7 354,7 @@ cacheinit(void)
	/*
	 * Turn cache on
	 */
	putenab(getenab()&~ENABCACHE);
	putenab(getenab()|ENABCACHE);
}

/*


@@ 366,17 364,20 @@ void
mmuinit(void)
{
	int c, i, j;
	ulong va, ktop, pme;
	ulong va, ktop, pme, kbot1, ktop1;
	int fp;		/* first free pmeg */
	Pmeg *p;
	Ctx *ctx;

conf.ncontext = 1; /**/
	/*
	 *  mmuinit is entered with PMEG's 0 & 1 providing mappng
	 *  for virtual addresses KZERO<->KZERO+2*BY2SEGM to physical
	 *  0<->2*BY2SEGM
	 */
	compile();

	/*
	 *  First map kernel text, data, bss, and xalloc regions.
	 *  xinit sets conf.npage0 to end of these.
	 *  map all of kernel region 0.
	 */
	ktop = PGROUND(conf.npage0);
	i = 0;


@@ 388,7 389,7 @@ conf.ncontext = 1; /**/
	fp = i;

	/*
	 *  Make sure cache is turned on for kernel
	 *  Make sure cache is turned on for kernel region 0
	 */
	pme = PTEVALID|PTEWRITE|PTEKERNEL|PTEMAINMEM;
	i = 0;


@@ 396,13 397,49 @@ conf.ncontext = 1; /**/
		putpme(va, pme+i, 1);

	/*
	 *  invalidate rest of kernel's PMEG
	 *  invalidate rest of kernel's region 0's PMEG's
	 */
	va = ROUNDUP(ktop, BY2SEGM);
	for(; ktop < va; ktop += BY2PG)
		putpme(ktop, INVALIDPTE, 1);

	/*
	 *  Invalidate all entries in all other pmegs
	 */
	for(j = fp; j < conf.npmeg; j++){
		putsegspace(INVALIDSEGM, j);
		for(va = 0; va < BY2SEGM; va += BY2PG)
			putpmegspace(INVALIDSEGM+va, INVALIDPTE);
	}

	if(conf.base1 < conf.npage1){
		/*
		 *  map kernel region 1, this may overlap kernel region 0's
		 *  PMEG's.
		 */
		ktop1 = PGROUND(conf.npage1);
		kbot1 = conf.base1 & ~(BY2SEGM - 1);
		if(kbot1 < ktop)
			kbot1 = ktop;
		for(c = 0; c < conf.ncontext; c++){
			i = fp;
			putcontext(c);
			for(va = kbot1; va < ktop1; va += BY2SEGM)
				putsegspace(va, i++);
		}
		fp = i;
	
		/*
		 *  Make sure cache is turned on for kernel region 1
		 */
		kbot1 = conf.base1 & ~(BY2PG - 1);
		pme = PTEVALID|PTEWRITE|PTEKERNEL|PTEMAINMEM;
		i = PPN(kbot1 & ~KZERO);
		for(va = kbot1; va < ktop1; va += BY2PG, i++)
			putpme(va, pme+i, 1);
	}

	/*
	 *  allocate pmegs for kmap'ing
	 */
	for(c = 0; c < conf.ncontext; c++){


@@ 414,15 451,6 @@ conf.ncontext = 1; /**/
	fp = i;

	/*
	 *  Invalidate all entries in all other pmegs
	 */
	for(j = fp; j < conf.npmeg; j++){
		putsegspace(INVALIDSEGM, j);
		for(va = INVALIDSEGM; va < INVALIDSEGM+BY2SEGM; va += BY2PG)
			putpme(va, INVALIDPTE, 1);
	}

	/*
	 *  invalidate everything outside the kernel in every context
	 */
	for(c = 0; c < conf.ncontext; c++){


@@ 464,7 492,6 @@ mmurelease(Proc *p)
		return;

	freectx(c, 1);
	mkfirst(&m->clist, c);
}

/*


@@ 494,6 521,8 @@ mapstack(Proc *p)
				}
				l = &f->cnext;
			}
			if(f != pm)
				panic("mapstack f != pm\n");
	
			/* flush cache & remove mappings */
			putctx(c);


@@ 513,10 542,13 @@ mapstack(Proc *p)
	/* set to this proc's context */
	c = p->ctxonmach[m->machno];
	if(c == 0)
		allocctx(p);
		c = allocctx(p);
	else
		putctx(c);

	if(c->proc != p || p->ctxonmach[m->machno] != c)
		panic("mapstack c->proc != p\n");

	/* make sure there's a mapping for u-> */
	tlbphys = PPN(p->upage->pa)|PTEVALID|PTEWRITE|PTEKERNEL|PTEMAINMEM;
	putpmegspace(USERADDR, tlbphys);


@@ 536,7 568,6 @@ flushmmu(void)
	while(p = c->pmeg){
		c->pmeg = p->cnext;
		freepmeg(p, 1);
		mkfirst(&m->plist, p);
	}
	spllo();
}


@@ 552,6 583,7 @@ struct
	Lock;
	KMap	*free;
	KMap	arena[IOSEGSIZE/BY2PG];
	int inited;
}kmapalloc;

void


@@ 566,6 598,7 @@ kmapinit(void)
		k->va = va;
		kunmap(k);
	}
	kmapalloc.inited = 1;
}

KMap*


@@ 632,4 665,3 @@ kmap(Page *pg)
	 */
	return kmappa(pg->pa, PTEMAINMEM|PTENOCACHE);
}


M ss/scsi.c => ss/scsi.c +0 -1
@@ 16,7 16,6 @@ Scsibuf *
scsialloc(ulong n)
{
	Scsibuf *b;
	KMap *k;
	ulong pa, va;
	int i;