From 854cf1d75978472b8fffb204d0f578c8bd08fef1 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 26 Apr 1991 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1991-04-26 --- port/chan.c | 12 ------------ port/devdup.c | 13 +------------ port/devmnt.c | 39 +++++++++++++++------------------------ port/sturp.c | 1 + power/l.s | 16 +++++----------- power/main.c | 2 +- power/mmu.c | 34 ++++++++-------------------------- 7 files changed, 31 insertions(+), 86 deletions(-) diff --git a/port/chan.c b/port/chan.c index 0ac2f568a4ab6a06959166475377c1fc433d6556..2d7962d4c5485b08c75b634db4a8b239826e47b6 100644 --- a/port/chan.c +++ b/port/chan.c @@ -110,18 +110,6 @@ loop: goto loop; } -void -freechan(Chan *c) -{ - if(decref(c) == 0){ - c->flag = CFREE; - lock(&chanalloc); - c->next = chanalloc.free; - chanalloc.free = c; - unlock(&chanalloc); - } -} - void close(Chan *c) { diff --git a/port/devdup.c b/port/devdup.c index 10b0951323db0e1da2e35fb6176ddf670e13939d..9ec8cd45a549ef71a3db6a48aedc2869998186e3 100644 --- a/port/devdup.c +++ b/port/devdup.c @@ -61,18 +61,7 @@ dupwalk(Chan *c, char *name) void dupstat(Chan *c, char *db) { - int fd; - Chan *f; - - if(c->qid.path == CHDIR){ - devstat(c, db, (Dirtab *)0, 0L, dupgen); - }else{ - fd = c->qid.path; - SET(f); - if(fd<0 || NFD<=fd || (f=u->fd[fd])==0) - error(Ebadfd); - (*devtab[f->type].stat)(f, (char*)db); - } + devstat(c, db, (Dirtab *)0, 0L, dupgen); } Chan * diff --git a/port/devmnt.c b/port/devmnt.c index 828b530c066bf64fd53c70eed493ff2782f06537..91ac489416534ca549fcb12fc0fd780171183cc0 100644 --- a/port/devmnt.c +++ b/port/devmnt.c @@ -398,16 +398,6 @@ mntclwalk(Chan *c, char *name) Chan *nc; nc = newchan(); - nc->type = c->type; - nc->dev = c->dev; - nc->qid = c->qid; - nc->mode = c->mode; - nc->flag = c->flag; - nc->offset = c->offset; - nc->mnt = c->mnt; - nc->aux = c->aux; - nc->mchan = c->mchan; - nc->mqid = c->qid; mh = 0; if(waserror()){ close(nc); @@ -422,21 +412,24 @@ mntclwalk(Chan *c, char *name) mh->thdr.newfid = nc->fid; strcpy(mh->thdr.name, name); mntxmit(m, mh); - poperror(); if(mh->rhdr.fid == mh->thdr.fid){ /* - * just free the chan, the other side has - * already clunked - */ - freechan(nc); - nc = 0; - } else { - /* - * it worked, keep the channel + * hack to indicate the most common error */ - nc->qid = mh->rhdr.qid; - incref(m); + errors("directory entry not found"); } + nc->type = c->type; + nc->dev = c->dev; + nc->mode = c->mode; + nc->flag = c->flag; + nc->offset = c->offset; + nc->mnt = c->mnt; + nc->aux = c->aux; + nc->mchan = c->mchan; + nc->mqid = c->qid; + nc->qid = mh->rhdr.qid; + incref(m); + poperror(); mhfree(mh); return nc; } @@ -791,12 +784,10 @@ mntxmit(Mnt *m, Mnthdr *mh) print("type mismatch %d %d\n", mh->rhdr.type, mh->thdr.type+1); error(Ebadmsg); } -#ifdef PHILW_HACK - if(mh->rhdr.fid != mh->thdr.fid){ + if(mh->rhdr.fid!=mh->thdr.fid && mh->thdr.type!=Tclwalk){ print("fid mismatch %d %d type %d\n", mh->rhdr.fid, mh->thdr.fid, mh->rhdr.type); error(Ebadmsg); } -#endif /* * Copy out on read diff --git a/port/sturp.c b/port/sturp.c index 38ab348f67e299c0e3c56ac276ffdfe9af4568c4..429bda7ee49670e57d8c1b3a2cbe1c8aa1271c36 100644 --- a/port/sturp.c +++ b/port/sturp.c @@ -861,6 +861,7 @@ rcvack(Urp *up, int msg) } wakeup(&urpkr); + wakeup(&up->r); } /* diff --git a/power/l.s b/power/l.s index 39f4d9afd276b465eb8c33fb49342bf2214c2a14..f7557fb8e2c6a671814f37f8595d927cc5c64eed 100644 --- a/power/l.s +++ b/power/l.s @@ -246,12 +246,13 @@ TEXT vector0(SB), $-4 MOVW $utlbmiss(SB), R26 MOVW M(TLBVIRT), R27 - SLL $(STLBLOG-9), R27 /* delay slot fodder */ + SRL $(6-3), R27 /* delay slot fodder, right adjust */ JMP (R26) TEXT utlbmiss(SB), $-4 - SRL $(STLBLOG), R27, R26 + SRL $6, R27, R26 /* right adjusted vpn */ + SLL $(STLBLOG-6), R27 /* left adjusted pid */ XOR R26, R27 AND $((STLBSIZE-1)<<3), R27 MOVW R27, M(TLBPHYS) /* scratch register, store */ @@ -273,17 +274,10 @@ TEXT utlbmiss(SB), $-4 MOVW (R27), R27 BNE R26, R27, stlbm - TLBP - MOVW M(EPC), R27 - MOVW M(INDEX), R26 - BGEZ R26, uind TLBWR - NOOP + MOVW M(EPC), R27 RFE (R27) -uind: - TLBWI - NOOP - RFE (R27) + stlbm: MOVW $exception(SB), R26 JMP (R26) diff --git a/power/main.c b/power/main.c index b0da007618a49691ce2ecda607435cf9f02ddd40..c1862a6c89023ac0f3e11fe5a075c9b1428c7535 100644 --- a/power/main.c +++ b/power/main.c @@ -106,7 +106,7 @@ vecinit(void) *p++ = *q++; p = (ulong*)UTLBMISS; q = (ulong*)vector0; - for(size=0; size<4; size++) + for(size=0; size<0x80/sizeof(*q); size++) *p++ = *q++; } diff --git a/power/mmu.c b/power/mmu.c index 079a90633b9d7e938191245f6c9503c6f91357a1..d372635ce51cba6fd6250bdb3b4a4ca2cac9ba38 100644 --- a/power/mmu.c +++ b/power/mmu.c @@ -38,7 +38,7 @@ newtlbpid(Proc *p) int i, s; Proc *sp; char *h; -/* + s = m->lastpid; if(s >= NTLBPID) s = 1; @@ -51,26 +51,16 @@ newtlbpid(Proc *p) }while(h[i] && i != s); if(i == s){ - sp = m->pidproc[i]; - if(sp){ - if(sp->pidonmach[m->machno] == i) - sp->pidonmach[m->machno] = 0; - purgetlb(i); - } + i++; + if(i >= NTLBPID) + i = 1; } -*/ - i = m->lastpid+1; - if(i >= NTLBPID) - i = 1; sp = m->pidproc[i]; if(sp){ if(sp->pidonmach[m->machno] == i) sp->pidonmach[m->machno] = 0; - - sp->pidonmach[m->machno] = 0; purgetlb(i); } - m->lastpid = i; m->pidproc[i] = p; return i; @@ -105,16 +95,16 @@ void purgetlb(int pid) { Softtlb *entry, *etab; - char p[NTLBPID]; + char *p; Proc *sp; int i, rpid; - if(m->pidproc[pid] == 0) + if(m->pidhere[pid] == 0) return; m->tlbpurge++; - m->pidproc[pid] = 0; - memset(p, 0, sizeof p); + p = m->pidhere; + memset(m->pidhere, 0, sizeof m->pidhere); for(i=TLBROFF; ipidproc[i]; - if(sp && sp->pidonmach[m->machno] == i) - sp->pidonmach[m->machno] = 0; - m->pidproc[i] = 0; - m->pidhere[i] = 0; - } } void