From be13def63848835edcd20442c3ce05b74ab34cd9 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 5 Jul 1990 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1990-07-05 --- gnot/l.s | 8 ++++---- gnot/lock.c | 22 ++++++++++++---------- gnot/proc.c | 2 +- power/dat.h | 1 + power/errno.h | 3 ++- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/gnot/l.s b/gnot/l.s index 58e5d05c7f42993cb21b251a616a938931f5c6a6..bcf958f9036c7888a823db702c1a6cc127a6a73e 100644 --- a/gnot/l.s +++ b/gnot/l.s @@ -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 */ diff --git a/gnot/lock.c b/gnot/lock.c index 29eb703c8deb9dfda7c72a7c9a92057fa520c988..b1e98cecb094c5b2486a00c20804ea1130060e41 100644 --- a/gnot/lock.c +++ b/gnot/lock.c @@ -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; diff --git a/gnot/proc.c b/gnot/proc.c index 50e4b66b912d202a3c2b03d3e13f5b12fe87f011..fb06bdcd6b2a2ec3e7c89b6c68707e7c92c82755 100644 --- a/gnot/proc.c +++ b/gnot/proc.c @@ -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); diff --git a/power/dat.h b/power/dat.h index eab9cae426662be7f577578c3a4251e2506d1483..718055f26e436b70ab0414ad890b290b91a26560 100644 --- a/power/dat.h +++ b/power/dat.h @@ -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 */ diff --git a/power/errno.h b/power/errno.h index 1aeb654a4adcef2e40629a86ca27532706dcb3a1..4cb872bf36ef89d3088f9a8aa2d230dbe883fce3 100644 --- a/power/errno.h +++ b/power/errno.h @@ -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 */ };