From d54baa15f1f0ada1ac5523c7df665b04d460c487 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sun, 15 Mar 1992 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1992-03-15 --- gnot/mmu.c | 2 +- port/devlance.c | 13 ++++++++++++- port/devmnt.c | 14 +++++--------- port/page.c | 24 ++++++++++++++---------- 4 files changed, 32 insertions(+), 21 deletions(-) diff --git a/gnot/mmu.c b/gnot/mmu.c index 38438fd165930cc5f7874d93e46d876ea1225667..1e5eb37130c36846c616d26b58e6e11419a98f48 100644 --- a/gnot/mmu.c +++ b/gnot/mmu.c @@ -94,7 +94,7 @@ kmapinit(void) } e = (MB4 - 256*1024)/BY2PG; /* screen lives at top 256K */ - i = PGROUND(((ulong)ialloc(0, 0))&~KZERO)/BY2PG; + i = PGROUND(palloc.addr0)/BY2PG; print("%lud free map registers\n", e-i); diff --git a/port/devlance.c b/port/devlance.c index c6380c6f4261edb20c2f676e4facc902be9daa69..dddf74ad1eca3841a1584eb8d3a8b40c9c41f2a9 100644 --- a/port/devlance.c +++ b/port/devlance.c @@ -93,6 +93,7 @@ typedef struct { Lance; /* host dependent lance params */ int prom; /* number of promiscuous channels */ + int all; /* number of channels listening to all packets */ Network net; Netprot prot[Ntypes]; @@ -245,6 +246,11 @@ lancestclose(Queue *q) lancestart(0, 1); qunlock(&l); } + if(et->type == -1){ + qlock(&l); + l.all--; + qunlock(&l); + } qlock(et); et->type = 0; et->q = 0; @@ -277,6 +283,11 @@ lanceoput(Queue *q, Block *bp ) e = q->ptr; if(streamparse("connect", bp)){ e->type = strtol((char *)bp->rptr, 0, 0); + if(e->type == -1){ + qlock(&l); + l.all++; + qunlock(&l); + } } else if(streamparse("promiscuous", bp)) { e->prom = 1; qlock(&l); @@ -309,7 +320,7 @@ lanceoput(Queue *q, Block *bp ) } return; } - if(memcmp(l.bcast, p->d, sizeof(l.bcast)) == 0 || l.prom){ + if(memcmp(l.bcast, p->d, sizeof(l.bcast)) == 0 || l.prom || l.all){ len = blen(bp); nbp = copyb(bp, len); nbp = expandb(nbp, len >= ETHERMINTU ? len : ETHERMINTU); diff --git a/port/devmnt.c b/port/devmnt.c index 412f04f9267b9b939329ae1fe3d7459e4dc0c477..7e529e38fba5894cc4aac7d1a775573a12daefed 100644 --- a/port/devmnt.c +++ b/port/devmnt.c @@ -93,19 +93,15 @@ mntreset(void) mntalloc.rpcarena = mntalloc.rpcfree; re = &mntalloc.rpcfree[conf.nmntbuf]; - /* Align mount buffers to 256 byte boundaries so we can use burst mode vme transfers */ - p = (ulong)ialloc(0, 0); - if(p&(ALIGN-1)) - ialloc(ALIGN-(p&(ALIGN-1)), 0); - - i = MAXRPC+(ALIGN-1); - i &= ~(ALIGN-1); - + /* + * Align mount buffers to 256 byte boundaries + * so we can use burst mode vme transfers + */ tag = Tagspace; for(rd = mntalloc.rpcfree; rd < re; rd++) { rd->list = rd+1; rd->request.tag = tag++; - rd->rpc = ialloc(i, 0); + rd->rpc = iallocspan(MAXRPC, ALIGN, 0); } re[-1].list = 0; for(md = mntalloc.mntfree; md < me; md++){ diff --git a/port/page.c b/port/page.c index 7d8cc78c7b2a5d7e2bcb7d76f244d8d2e0fea3f0..735c1fda947e08d830b803a746a8ce839609e35b 100644 --- a/port/page.c +++ b/port/page.c @@ -17,7 +17,8 @@ struct Ptealloc int pages; }ptealloclk; -extern long end; +extern long end; +ulong hiaddr; static Lock pglock; /* Multiplex a hardware lock for per page manipulations */ @@ -63,14 +64,6 @@ enum Region region[Nregion]; -/* - * Called to allocate permanent data structures, before calling pageinit(). - * We assume all of text+data+bss is in the first memory bank. - * - * alignment is in number of bytes - * - * WARNING: You can't cross a crevasse! - */ void addsplit(Region *r, ulong start, ulong end) { @@ -99,6 +92,17 @@ addsplit(Region *r, ulong start, ulong end) } } } + +/* + * Called to allocate permanent data structures, before calling pageinit(). + * We assume all of text+data+bss is in the first memory bank. + * + * alignment is in number of bytes. It pretains both to the start and + * end of the allocated memory. + * + * If crevasse is specified, no allocation can span an address that is + * a multiple of crevasse. + */ void* iallocspan(ulong n, int align, ulong crevasse) { @@ -131,7 +135,7 @@ iallocspan(ulong n, int align, ulong crevasse) p = 0; for(r = region; r < ®ion[Nregion]; r++){ - /* allign region */ + /* align region */ p = r->start; if(align){ m = p % align;