~kris/9p

9hist

39c575f2dc98eaa4bac615e747889a34b2b0ef30 — David du Colombier 36 years ago 8d1caad
Plan 9 from Bell Labs 1990-03-22
M gnot/boot.c => gnot/boot.c +2 -2
@@ 40,8 40,8 @@ main(int argc, char *argv[])
	cfd = open("#k/2/ctl", 2);
	if(cfd < 0)
		error("opening #k/2/ctl");
	sendmsg(cfd, "connect r70.nonet!bootes!fs");
	print("connected to r70.nonet!bootes!fs\n");
	sendmsg(cfd, "connect helix.bootfs");
	print("connected to helix.bootfs\n");
	close(cfd);

	/*

M gnot/boot.h => gnot/boot.h +147 -151
@@ 1,7 1,7 @@
ulong bootcode[]={
	0x00000107,
	0x0000200e,
	0x00000404,
	0x000003f4,
	0x00000130,
	0x00000000,
	0x00002020,


@@ 58,15 58,15 @@ ulong bootcode[]={
	0x486e818d,
	0x2f2f0078,
	0x610002f6,
	0x486e81a9,
	0x486e81a2,
	0x610003ee,
	0x2f2f0080,
	0x61001f04,
	0x486e81cb,
	0x486e81bd,
	0x610003de,
	0x422e84ee,
	0x422e84de,
	0x486f005c,
	0x486e84ee,
	0x486e84de,
	0x61000fba,
	0x2f002f40,
	0x008c486f,


@@ 74,7 74,7 @@ ulong bootcode[]={
	0x00946100,
	0x1f04b0af,
	0x0094670a,
	0x486e81d2,
	0x486e81c4,
	0x610002de,
	0x588f4878,
	0x001c486f,


@@ 83,11 83,11 @@ ulong bootcode[]={
	0x1ede2f40,
	0x00a04aaf,
	0x00a06e0a,
	0x486e81dc,
	0x486e81ce,
	0x610002ba,
	0x588f2f2f,
	0x00a0486e,
	0x84ee486f,
	0x84de486f,
	0x00846100,
	0x170a4a80,
	0x6638102f,


@@ 100,22 100,22 @@ ulong bootcode[]={
	0x009449c0,
	0x2f002f2f,
	0x00bc486e,
	0x81e56100,
	0x81d76100,
	0x0348486e,
	0x82086100,
	0x81fa6100,
	0x02704fef,
	0x001c0c2e,
	0x000184ee,
	0x000184de,
	0x670a486e,
	0x82136100,
	0x82056100,
	0x025c588f,
	0x486e821c,
	0x486e820e,
	0x61000322,
	0x1d7c0002,
	0x84ee1d7c,
	0x007684f8,
	0x84de1d7c,
	0x007684e8,
	0x486f008c,
	0x486e84ee,
	0x486e84de,
	0x61000ef6,
	0x2f002f40,
	0x00bc486f,


@@ 123,7 123,7 @@ ulong bootcode[]={
	0x00c46100,
	0x1e40b0af,
	0x00c4670a,
	0x486e8227,
	0x486e8219,
	0x6100021a,
	0x588f4878,
	0x001c486f,


@@ 132,33 132,33 @@ ulong bootcode[]={
	0x1e1a2f40,
	0x00d04aaf,
	0x00d06e0a,
	0x486e8235,
	0x486e8227,
	0x610001f6,
	0x588f2f2f,
	0x00d0486e,
	0x84ee486f,
	0x84de486f,
	0x00b46100,
	0x16464a80,
	0x660a486e,
	0x82426100,
	0x82346100,
	0x01d8588f,
	0x0c2e0003,
	0x84ee670a,
	0x486e8251,
	0x84de670a,
	0x486e8243,
	0x610001c6,
	0x588f4a6e,
	0x84f2671c,
	0x302e84f2,
	0x84e2671c,
	0x302e84e2,
	0x48c02f00,
	0x486e825e,
	0x486e8250,
	0x6100027e,
	0x486e8268,
	0x486e825a,
	0x610001a6,
	0x4fef000c,
	0x486e8275,
	0x486e8267,
	0x6100026a,
	0x486e8283,
	0x486e827d,
	0x486e8275,
	0x486e826f,
	0x486f00c4,
	0x6100032a,
	0x487801b6,


@@ 168,11 168,11 @@ ulong bootcode[]={
	0x4a8042e7,
	0x2f4000f2,
	0x44df6c0a,
	0x486e828a,
	0x486e827c,
	0x61000166,
	0x588f2f2f,
	0x00fc486e,
	0x8291486f,
	0x8283486f,
	0x00dc6100,
	0x02f4486f,
	0x00e06100,


@@ 185,26 185,26 @@ ulong bootcode[]={
	0x61000dd0,
	0x588f221f,
	0xb280670a,
	0x486e8294,
	0x486e8286,
	0x61000122,
	0x588f2f2f,
	0x01086100,
	0x1d06486e,
	0x82a0486e,
	0x829a486f,
	0x8292486e,
	0x828c486f,
	0x00f86100,
	0x02a84878,
	0x01b64878,
	0x0001486e,
	0x82a76100,
	0x82996100,
	0x1cec4a80,
	0x42e72f40,
	0x012644df,
	0x6c0a486e,
	0x82af6100,
	0x82a16100,
	0x00e4588f,
	0x2f2f0130,
	0x486e82b6,
	0x486e82a8,
	0x486f0110,
	0x61000272,
	0x486f0114,


@@ 218,33 218,33 @@ ulong bootcode[]={
	0x0d4e588f,
	0x221fb280,
	0x670a486e,
	0x82b96100,
	0x82ab6100,
	0x00a0588f,
	0x2f2f013c,
	0x61001c84,
	0x486e82bf,
	0x486e82b1,
	0x6100015e,
	0x42a7486e,
	0x82ca486e,
	0x82c86100,
	0x82bc486e,
	0x82ba6100,
	0x0d364a80,
	0x6c08486e,
	0x82cc6174,
	0x82be6174,
	0x588f486e,
	0x82d34878,
	0x82c54878,
	0x0006486e,
	0x82d12f2f,
	0x82c32f2f,
	0x01686100,
	0x1c664a80,
	0x6c08486e,
	0x82d46154,
	0x82c66154,
	0x588f486e,
	0x82da6100,
	0x82cc6100,
	0x011c42a7,
	0x486e82ef,
	0x486e82e3,
	0x486e82e1,
	0x486e82d5,
	0x61000cc8,
	0x486e82f4,
	0x486e82e6,
	0x61364fef,
	0x01884e75,
	0x598f2f2f,


@@ 264,7 264,7 @@ ulong bootcode[]={
	0x61001bf0,
	0x486f0008,
	0x2f2f0050,
	0x486e8300,
	0x486e82f2,
	0x48780002,
	0x6100011a,
	0x42a76174,


@@ 273,9 273,9 @@ ulong bootcode[]={
	0x42817021,
	0xb0816f1e,
	0x4ab61d20,
	0x8406660e,
	0x83f6660e,
	0x2daf0008,
	0x1d208406,
	0x1d2083f6,
	0x7001588f,
	0x4e755281,
	0x7021b081,


@@ 285,25 285,25 @@ ulong bootcode[]={
	0x00084282,
	0x7021b082,
	0x6f182036,
	0x2d208406,
	0x2d2083f6,
	0xb0886606,
	0x42b62d20,
	0x84065282,
	0x83f65282,
	0x7021b082,
	0x6ee8588f,
	0x4e754aaf,
	0x00046606,
	0x42a7610c,
	0x588f486e,
	0x834e6104,
	0x833e6104,
	0x588f4e75,
	0x518f7220,
	0x4a816d22,
	0x2eb61d20,
	0x84064a97,
	0x83f64a97,
	0x67122f41,
	0x000442b6,
	0x1d208406,
	0x1d2083f6,
	0x4eb70151,
	0x222f0004,
	0x53814a81,


@@ 513,7 513,7 @@ ulong bootcode[]={
	0x7209b081,
	0x6e0000ea,
	0x30360b20,
	0x83384efb,
	0x83284efb,
	0x00007004,
	0xc0846604,
	0x4a836d72,


@@ 639,7 639,7 @@ ulong bootcode[]={
	0x801260b6,
	0x4878ffff,
	0x42a7486e,
	0x83126100,
	0x83026100,
	0xff3c4280,
	0x4fef000c,
	0x4e75598f,


@@ 1083,7 1083,7 @@ ulong bootcode[]={
	0x7227b001,
	0x6e0005e8,
	0x30360b20,
	0x83664efb,
	0x83564efb,
	0x00002008,
	0x90af000c,
	0x588f4e75,


@@ 1461,7 1461,7 @@ ulong bootcode[]={
	0x00186000,
	0xfa261011,
	0x49c02f00,
	0x486e831a,
	0x486e830a,
	0x6100ee02,
	0x42804fef,
	0x000c4e75,


@@ 1572,7 1572,7 @@ ulong bootcode[]={
	0x057e7227,
	0xb0016e00,
	0x05763036,
	0x0b2083b6,
	0x0b2083a6,
	0x4efb0000,
	0x202f0008,
	0xd0af0010,


@@ 1922,7 1922,7 @@ ulong bootcode[]={
	0x00186000,
	0xfa981011,
	0x49c02f00,
	0x486e8328,
	0x486e8318,
	0x6100e6ce,
	0x42804fef,
	0x000c4e75,


@@ 2159,101 2159,97 @@ ulong bootcode[]={
	0x2f63746c,
	0x00636f6e,
	0x6e656374,
	0x20723730,
	0x2e6e6f6e,
	0x65742162,
	0x6f6f7465,
	0x73216673,
	0x00636f6e,
	0x6e656374,
	0x65642074,
	0x6f207237,
	0x302e6e6f,
	0x6e657421,
	0x626f6f74,
	0x65732166,
	0x730a006e,
	0x6f702e2e,
	0x2e007772,
	0x69746520,
	0x6e6f7000,
	0x72656164,
	0x206e6f70,
	0x006e203d,
	0x2025643b,
	0x20627566,
	0x2068656c,
	0x69782e62,
	0x6f6f7466,
	0x7300636f,
	0x6e6e6563,
	0x74656420,
	0x746f2068,
	0x656c6978,
	0x2e626f6f,
	0x7466730a,
	0x006e6f70,
	0x2e2e2e00,
	0x77726974,
	0x65206e6f,
	0x70007265,
	0x6164206e,
	0x6f70006e,
	0x203d2025,
	0x2e327820,
	0x252e3278,
	0x643b2062,
	0x7566203d,
	0x20252e32,
	0x7820252e,
	0x32780a00,
	0x666f726d,
	0x6174206e,
	0x6f70006e,
	0x6f742052,
	0x6e6f7000,
	0x73657373,
	0x696f6e2e,
	0x2e2e0077,
	0x72697465,
	0x20736573,
	0x73696f6e,
	0x00726561,
	0x64207365,
	0x7373696f,
	0x6e00666f,
	0x32782025,
	0x2e327820,
	0x252e3278,
	0x0a00666f,
	0x726d6174,
	0x20736573,
	0x73696f6e,
	0x206e6f70,
	0x006e6f74,
	0x20527365,
	0x20526e6f,
	0x70007365,
	0x7373696f,
	0x6e006572,
	0x726f7220,
	0x25643b00,
	0x72656d6f,
	0x74652065,
	0x72726f72,
	0x00706f73,
	0x742e2e2e,
	0x0023732f,
	0x25730062,
	0x6f6f7465,
	0x73006372,
	0x65617465,
	0x00256400,
	0x77726974,
	0x65002373,
	0x2f257300,
	0x626f6f74,
	0x65730023,
	0x732f626f,
	0x6f740063,
	0x72656174,
	0x65002564,
	0x6e2e2e2e,
	0x00777269,
	0x7465006d,
	0x6f756e74,
	0x2e2e2e00,
	0x2f002f00,
	0x62696e64,
	0x002f0000,
	0x6d6f756e,
	0x74007375,
	0x63636573,
	0x730a002f,
	0x36383032,
	0x302f696e,
	0x69740069,
	0x6e697400,
	0x2f363830,
	0x32302f69,
	0x6e697400,
	0x74652073,
	0x65737369,
	0x6f6e0072,
	0x65616420,
	0x73657373,
	0x696f6e00,
	0x666f726d,
	0x61742073,
	0x65737369,
	0x6f6e006e,
	0x6f742052,
	0x73657373,
	0x696f6e00,
	0x6572726f,
	0x72202564,
	0x3b007265,
	0x6d6f7465,
	0x20657272,
	0x6f720070,
	0x6f73742e,
	0x2e2e0023,
	0x732f2573,
	0x00626f6f,
	0x74657300,
	0x63726561,
	0x74650025,
	0x64007772,
	0x69746500,
	0x23732f25,
	0x7300626f,
	0x6f746573,
	0x0023732f,
	0x626f6f74,
	0x3a202573,
	0x3a202573,
	0x0a000000,
	0x00637265,
	0x61746500,
	0x25640077,
	0x72697465,
	0x006d6f75,
	0x6e742e2e,
	0x2e002f00,
	0x2f006269,
	0x6e64002f,
	0x00006d6f,
	0x756e7400,
	0x73756363,
	0x6573730a,
	0x002f3638,
	0x3032302f,
	0x696e6974,
	0x00696e69,
	0x74002f36,
	0x38303230,
	0x2f696e69,
	0x7400626f,
	0x6f743a20,
	0x25733a20,
	0x25730a00,
	0x00002a2a,
	0x2a000000,
	0x00006261,


@@ 2316,6 2312,6 @@ ulong bootcode[]={
	0x0162010a,
	0x00be005a,
	0x001c0000,
	0x0002432,
	0x0002422,
	0x,
};

M gnot/devincon.c => gnot/devincon.c +16 -5
@@ 23,7 23,7 @@ enum {
	Minstation=	2,	/* lowest station # to poll */
	Maxstation=	15,	/* highest station # to poll */
	Nincon=		1,	/* number of incons */
	Nin=		64,	/* Blocks in the input ring */
	Nin=		32,	/* Blocks in the input ring */
	Bsize=		128,	/* size of an input ring block */
	Mfifo=		0xff	/* a mask, must be 2^n-1, must be > Nin */
};


@@ 587,8 587,8 @@ static void
inconkproc(void *arg)
{
	Incon *ip;
	Block *bp;
	int i;
	Block *bp, *nbp;
	int i, n;

	ip = (Incon *)arg;
	ip->kstarted = 1;


@@ 619,10 619,21 @@ inconkproc(void *arg)
		}

		/*
		 *  send blocks upstream and stage new blocks
		 *  send blocks upstream and stage new blocks.  if the block is small
		 *  (< 64 bytes) copy into a smaller buffer.
		 */
		while(ip->ri != ip->wi){
			PUTNEXT(ip->rq, ip->inb[ip->ri]);
			bp = ip->inb[ip->ri];
			n = BLEN(bp);
			if(n <= 64){
				nbp = allocb(n);
				memcpy(nbp->wptr, bp->rptr, n);
				nbp->wptr += n;
				freeb(bp);
				PUTNEXT(ip->rq, nbp);
			} else {
				PUTNEXT(ip->rq, bp);
			}
			bp = ip->inb[ip->ri] = allocb(Bsize);
			bp->wptr += 3;
			ip->ri = (ip->ri+1)%Nin;

M gnot/main.c => gnot/main.c +1 -1
@@ 251,6 251,6 @@ confinit(void)
	conf.nmnthdr = 10;
	conf.nstream = 64;
	conf.nqueue = 5 * conf.nstream;
	conf.nblock = 32 * conf.nstream;
	conf.nblock = 12 * conf.nstream;
	conf.nsrv = 32;
}

M gnot/stream.c => gnot/stream.c +4 -4
@@ 109,8 109,7 @@ allocb(ulong size)
{
	Block *bp;
	Bclass *bcp;
	int i;

	int loop=0;

	/*
	 *  map size to class


@@ 124,9 123,10 @@ allocb(ulong size)
	lock(bcp);
	while(bcp->first == 0){
		unlock(bcp);
		print("waiting for blocks\n");
		if(loop++ > 10)
			panic("waiting for blocks\n");
		qlock(bcp);
		sleep(&bcp->r, isblock, (void *)bcp);
		tsleep(&bcp->r, isblock, (void *)bcp, 250);
		qunlock(bcp);
		lock(bcp);
	}

M gnot/trap.c => gnot/trap.c +1 -1
@@ 270,7 270,7 @@ syscall(Ureg *aur)
	ret = -1;
	if(!waserror())
		ret = (*systab[r0])((ulong*)(sp+BY2WD));
else print("syscall %d err %d %d\n", r0, u->error.type, u->error.code);
/* else print("syscall %d err %d %d\n", r0, u->error.type, u->error.code); /**/
	u->nerrlab = 0;
	u->p->insyscall = 0;
	if(r0 == NOTED)	/* ugly hack */

M port/devmnt.c => port/devmnt.c +10 -10
@@ 17,7 17,7 @@ typedef struct Mnt	Mnt;
struct Mnt
{
	Ref;			/* for number of chans, incl. mntpt but not msg */
	QLock;			/* for access */
	QLock	q;		/* for access */
	ulong	mntid;		/* serial # */
	Chan	*msg;		/* for reading and writing messages */
	Chan	*mntpt;		/* channel in user's name space */


@@ 383,10 383,10 @@ mntclose(Chan *c)
		m->mntpt = 0;
	if(decref(m) == 0){		/* BUG: need to hang up all pending i/o */
print("close mount table %d\n", m->mntid);
		qlock(m);
		qlock(&m->q);
		close(m->msg);
		m->msg = 0;
		qunlock(m);
		qunlock(&m->q);
	}
	poperror();
}


@@ 573,17 573,17 @@ mntxmit(Mnt *m, Mnthdr *mh)
	 * Avoid qlock for bit, to maximize parallelism
	 */
	if(isbit){
		lock(&m->use);		/* spin rather than sleep */
		lock(&m->q);		/* spin rather than sleep */
		if((msg = m->msg) == 0){
			unlock(&m->use);
			unlock(&m->q);
			error(0, Eshutdown);
		}
		incref(msg);
		unlock(&m->use);
		unlock(&m->q);
	}else{
		qlock(m);
		qlock(&m->q);
		if((msg = m->msg) == 0){
			qunlock(m);
			qunlock(&m->q);
			error(0, Eshutdown);
		}
		qlock(msg);


@@ 592,7 592,7 @@ mntxmit(Mnt *m, Mnthdr *mh)
		if(isbit)
			close(msg);
		else{
			qunlock(m);
			qunlock(&m->q);
			qunlock(msg);
		}
		nexterror();


@@ 609,7 609,7 @@ mntxmit(Mnt *m, Mnthdr *mh)
	if(isbit)
		close(msg);
	else{
		qunlock(m);
		qunlock(&m->q);
		qunlock(msg);
	}
	poperror();

M port/proc.c => port/proc.c +17 -12
@@ 364,14 364,13 @@ pexit(char *s, int freemem)
	 * Any of my children exiting?
	 */
	while(c->nchild){
		lock(&c->wait.queue);
		if(canlock(&c->wait.use)){	/* no child is exiting */
		lock(&c->wait);
		if(c->wait.locked == 0){	/* no child is exiting */
			c->exiting = 1;
			unlock(&c->wait.use);
			unlock(&c->wait.queue);
			unlock(&c->wait);
			break;
		}else{				/* must wait for child */
			unlock(&c->wait.queue);
			unlock(&c->wait);
			pwait(0);
		}
	}


@@ 384,7 383,7 @@ pexit(char *s, int freemem)
	if(p == 0)
		goto out;
	qlock(&p->wait);
	lock(&p->wait.queue);
	lock(&p->wait);
	if(p->pid==c->parentpid && !p->exiting){
		w.pid = mypid;
		strcpy(w.msg, status);


@@ 402,10 401,10 @@ pexit(char *s, int freemem)
		c->state = Exiting;
		if(p->state == Inwait)
			ready(p);
		unlock(&p->wait.queue);
		unlock(&p->wait);
		sched();
	}else{
		unlock(&p->wait.queue);
		unlock(&p->wait);
		qunlock(&p->wait);
	}
   out:


@@ 476,21 475,27 @@ pwait(Waitmsg *w)

	p = u->p;
again:
	while(canlock(&p->wait.use)){
	while(canlock(&p->wait)){
		if(p->wait.locked){	/* child is exiting; wait for him */
			unlock(&p->wait);
			break;
		}
		if(p->nchild == 0){
			unlock(&p->wait);
			qunlock(&p->wait);
			error(0, Enochild);
		}
		p->state = Inwait;
		unlock(&p->wait);
		qunlock(&p->wait);
		sched();
	}
	lock(&p->wait.queue);	/* wait until child is finished */
	lock(&p->wait);	/* wait until child is finished */
	c = p->child;
	if(c == 0){
		print("pwait %d\n", p->pid);
		p->state = Inwait;
		unlock(&p->wait.queue);
		unlock(&p->wait);
		sched();
		goto again;
	}


@@ 502,7 507,7 @@ again:
	p->time[TCSys] += c->time[TSys] + c->time[TCSys];
	p->time[TCReal] += c->time[TReal];
	p->nchild--;
	unlock(&p->wait.queue);
	unlock(&p->wait);
	qunlock(&p->wait);
	ready(c);
	return cpid;

M port/stream.c => port/stream.c +8 -7
@@ 51,7 51,7 @@ static Lock garbagelock;
typedef struct {
	int	size;
	Blist;
	QLock;		/* qlock for sleepers on r */
	QLock	q;	/* qlock for sleepers on r */
	Rendez	r;	/* sleep here waiting for blocks */
} Bclass;
Bclass bclass[Nclass]={


@@ 109,8 109,7 @@ allocb(ulong size)
{
	Block *bp;
	Bclass *bcp;
	int i;

	int loop=0;

	/*
	 *  map size to class


@@ 124,10 123,12 @@ allocb(ulong size)
	lock(bcp);
	while(bcp->first == 0){
		unlock(bcp);
		print("waiting for blocks\n");
		qlock(bcp);
		sleep(&bcp->r, isblock, (void *)bcp);
		qunlock(bcp);
		print("waiting for block %d\n", size);
		if(loop++ > 10)
			panic("waiting for blocks");
		qlock(&bcp->q);
		tsleep(&bcp->r, isblock, (void *)bcp, 250);
		qunlock(&bcp->q);
		lock(bcp);
	}
	bp = bcp->first;

M port/sysproc.c => port/sysproc.c +0 -1
@@ 134,7 134,6 @@ sysfork(ulong *arg)
	p->parentpid = u->p->pid;
	p->pgrp = u->p->pgrp;
	incref(p->pgrp);
	u->p->nchild++;
	pid = p->pid;
	memset(p->time, 0, sizeof(p->time));
	p->time[TReal] = MACHP(0)->ticks;

M power/dat.h => power/dat.h +4 -5
@@ 54,10 54,10 @@ struct Ref

struct QLock
{
	Lock;				/* to use object */
	Proc	*head;			/* next process waiting for object */
	Proc	*tail;			/* last process waiting for object */
	Lock	use;			/* to use object */
	Lock	queue;			/* to access list */
	int	locked;			/* flag; is locked */
};

struct Label


@@ 307,8 307,7 @@ struct Proc
	Proc	*pop;			/* some ascendant */
	Proc	*kid;			/* some descendant */
	Proc	*sib;			/* non-ascendant relatives (circular list) */
	int	nchild;
	QLock	wait;			/* exiting children to be waited for */
	Rendez	exit;			/* child sleeps; parent wakes up */
	Waitmsg	*waitmsg;
	Proc	*child;
	Proc	*parent;


@@ 451,7 450,7 @@ enum {
	Sdataqid = Shighqid,
	Sctlqid = Sdataqid-1,
	Slowqid = Sctlqid,
	Streamhi= (32*1024),	/* stream high water mark */
	Streamhi= (9*1024),	/* stream high water mark */
};

#define	PRINTSIZE	256

M power/lock.c => power/lock.c +19 -13
@@ 110,7 110,14 @@ unlock(Lock *l)
int
canqlock(QLock *q)
{
	return canlock(&q->use);
	lock(q);
	if(q->locked){
		unlock(q);
		return 0;
	}
	q->locked = 1;
	unlock(q);
	return 1;
}

void


@@ 118,11 125,10 @@ qlock(QLock *q)
{
	Proc *p;

	if(canlock(&q->use))
		return;
	lock(&q->queue);
	if(canlock(&q->use)){
		unlock(&q->queue);
	lock(q);
	if(!q->locked){
		q->locked = 1;
		unlock(q);
		return;
	}
	p = q->tail;


@@ 133,7 139,7 @@ qlock(QLock *q)
	q->tail = u->p;
	u->p->qnext = 0;
	u->p->state = Queueing;
	unlock(&q->queue);
	unlock(q);
	sched();
}



@@ 142,16 148,16 @@ qunlock(QLock *q)
{
	Proc *p;

	lock(&q->queue);
	if(q->head){
		p = q->head;
	lock(q);
	p = q->head;
	if(p){
		q->head = p->qnext;
		if(q->head == 0)
			q->tail = 0;
		unlock(&q->queue);
		unlock(q);
		ready(p);
	}else{
		unlock(&q->use);
		unlock(&q->queue);
		q->locked = 0;
		unlock(q);
	}
}

M power/main.c => power/main.c +2 -2
@@ 359,7 359,7 @@ confinit(void)
	conf.npgrp = 100;

	x = 0x12345678;
	for(i=4; i<64; i+=4){
	for(i=4; i<128; i+=4){
		l = (long*)(KSEG1|(i*1024L*1024L));
		*l = x;
		wbflush();


@@ 372,7 372,7 @@ confinit(void)

	conf.npte = 20000;
	conf.nmod = 2000;
	conf.nalarm = 1000;
	conf.nalarm = 10000;
	conf.norig = 500;
	conf.nchan = 500;
	conf.nenv = 400;