M gnot/mmu.c => gnot/mmu.c +1 -1
@@ 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);
M port/devlance.c => port/devlance.c +12 -1
@@ 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);
M port/devmnt.c => port/devmnt.c +5 -9
@@ 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++){
M port/page.c => port/page.c +14 -10
@@ 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;