~kris/9p

9hist

be13def63848835edcd20442c3ce05b74ab34cd9 — David du Colombier 36 years ago dd3cf79
Plan 9 from Bell Labs 1990-07-05
5 files changed, 20 insertions(+), 16 deletions(-)

M gnot/l.s
M gnot/lock.c
M gnot/proc.c
M power/dat.h
M power/errno.h
M gnot/l.s => gnot/l.s +4 -4
@@ 6,16 6,16 @@
TEXT	start(SB), $-4

	MOVW	$(SUPER|SPL(7)), SR
	MOVL	$a6base(SB), A6
	MOVL	$0, R0
	MOVL	R0, CACR
	MOVL	R0, TACADDR
	MOVL	$a6base(SB), A6
	MOVL	R0, TACADDR		/* zero tac counter (cause an intr?) */

	MOVL	$mach0(SB), A0
	MOVL	A0, m(SB)
	MOVL	$0, 0(A0)
	MOVL	A0, A7
	ADDL	$(MACHSIZE-4), A7
	ADDL	$(MACHSIZE-4), A7	/* start stack under machine struct */
	MOVL	$0, u(SB)

	MOVL	$vectors(SB), A0


@@ 157,7 157,7 @@ TEXT	tacintr(SB), $0			/* level 1 */

	MOVL	R0, -(A7)
	MOVL	TACADDR, R0
	ADDL	$4, A7
	MOVL	(A7)+, R0
	RTE

TEXT	dkintr(SB), $0			/* level 2 */

M gnot/lock.c => gnot/lock.c +12 -10
@@ 18,23 18,24 @@
void
lock(Lock *l)
{
	Lock *ll = l;	/* do NOT take the address of l */
	int i;

	/*
	 * Try the fast grab first
	 */
    	if(l->key >= 0){
		l->key |= 0x80;
		l->pc = ((ulong*)&l)[PCOFF];
    	if(ll->key >= 0){
		ll->key |= 0x80;
		ll->pc = ((ulong*)&l)[PCOFF];
		return;
	}
	for(i=0; i<10000000; i++)
    		if(l->key >= 0){
			l->key |= 0x80;
			l->pc = ((ulong*)&l)[PCOFF];
    		if(ll->key >= 0){
			ll->key |= 0x80;
			ll->pc = ((ulong*)&l)[PCOFF];
			return;
		}
	l->key = 0;
	ll->key = 0;
dumpstack();
	panic("lock loop %lux pc %lux held by pc %lux\n", l, ((ulong*)&l)[PCOFF], l->pc);
}


@@ 42,9 43,10 @@ dumpstack();
int
canlock(Lock *l)
{
	if(l->key >= 0){
		l->key |= 0x80;
		l->pc = ((ulong*)&l)[PCOFF];
	Lock *ll = l;	/* do NOT take the address of l */
	if(ll->key >= 0){
		ll->key |= 0x80;
		ll->pc = ((ulong*)&l)[PCOFF];
		return 1;
	}
	return 0;

M gnot/proc.c => gnot/proc.c +1 -1
@@ 510,7 510,7 @@ pwait(Waitmsg *w)

	p = u->p;
again:
	while(canlock(&p->wait.use)){
	while(canqlock(&p->wait)){
		if(p->nchild == 0){
			qunlock(&p->wait);
			error(0, Enochild);

M power/dat.h => power/dat.h +1 -0
@@ 519,6 519,7 @@ struct Nomsg {
struct Noconv {
	QLock;

	Stream	*s;
	Queue	*rq;		/* input queue */
	int	version;	/* incremented each time struct is changed */
	int	state;		/* true if listening */

M power/errno.h => power/errno.h +2 -1
@@ 46,8 46,9 @@ enum{
	Edestotl,	/* datakit destination out to lunch */
	Enetotl,	/* datakit controller out to lunch */
	Erejected,	/* datakit destination rejected call */
	Egreg,		/* it's all greg's fault */
	Eshortmsg,	/* short message */
	Ebadmsg,	/* format error or mismatch in message */
	Ebadcnt,	/* read count greater than requested */
	Enoannounce,	/* listening on an unannounced network connection */
	Egreg,		/* it's all greg's fault */
};