From aeb605a91c8a01a448497929f7176a0d2a06b257 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 24 Apr 2001 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2001-04-24 --- alphapc/segment.h | 9 --------- bitsy/segment.h | 8 -------- carrera/main.c | 24 ++++++++++++++++++++++++ carrera/segment.h | 16 ---------------- mpc/segment.h | 8 -------- pc/ether82557.c | 13 +++++++------ pc/segment.h | 8 -------- port/chan.c | 2 ++ port/devproc.c | 2 +- port/fault.c | 9 +-------- port/portdat.h | 1 - port/segment.c | 23 +++++------------------ port/swap.c | 2 -- 13 files changed, 40 insertions(+), 85 deletions(-) delete mode 100644 alphapc/segment.h delete mode 100644 bitsy/segment.h delete mode 100644 carrera/segment.h delete mode 100644 mpc/segment.h delete mode 100644 pc/segment.h diff --git a/alphapc/segment.h b/alphapc/segment.h deleted file mode 100644 index 24d9fc5b7db6798db1ec6077aa5721c14ab428ec..0000000000000000000000000000000000000000 --- a/alphapc/segment.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Attach segment types - */ - -Physseg physseg[10] = { - { SG_SHARED, "shared", 0, SEGMAXSIZE, 0, 0 }, - { SG_BSS, "memory", 0, SEGMAXSIZE, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, -}; diff --git a/bitsy/segment.h b/bitsy/segment.h deleted file mode 100644 index 3f6e9542bee2c5956771b00436fa8bbb8f17f350..0000000000000000000000000000000000000000 --- a/bitsy/segment.h +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Attach segment types - */ -static Physseg physseg[10] = { - { SG_SHARED, "shared", 0, SEGMAXSIZE, 0, 0 }, - { SG_BSS, "memory", 0, SEGMAXSIZE, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, -}; diff --git a/carrera/main.c b/carrera/main.c index a19e96fb2c67aaf10e8a5b56be78121cd77ccab3..ae94def9ad99885f06dfa5d2056ac9ed64269b2f 100644 --- a/carrera/main.c +++ b/carrera/main.c @@ -40,6 +40,8 @@ extern uchar rdbgcode[]; extern ulong rdbglen; extern int noprint; +static void addps(void); + void main(void) { @@ -63,6 +65,7 @@ main(void) procinit0(); initseg(); links(); + addps(); chandevreset(); swapinit(); userinit(); @@ -590,3 +593,24 @@ return;/**/ /* Install the debugger code in a known place */ memmove((void*)0xA001C000, rdbgcode, rdbglen); } + +/* + * physical segs unique to the carrera + */ +static Physseg myphyssegs[] = +{ + { SG_PHYSICAL, "eisaio", Eisaphys, 64*1024, 0, 0 }, + { SG_PHYSICAL, "eisavga", Eisavgaphys, 128*1024, 0, 0 }, + { SG_PHYSICAL, "bootrom", 0x1fc00000, 256*1024, 0, 0 }, + { SG_PHYSICAL, "nvram", 0xe0009000, 12*1024, 0, 0 }, + { SG_PHYSICAL, "fb", 0x40000000, 4*1024*1024, 0, 0 }, +}; + +static void +addps(void) +{ + int i; + + for(i = 0; i < nelem(myphyssegs); i++) + addphysseg(&myphyssegs[i]); +} diff --git a/carrera/segment.h b/carrera/segment.h deleted file mode 100644 index 5c5d8d229defdfb508eed585445f3411e1b4c48e..0000000000000000000000000000000000000000 --- a/carrera/segment.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Attach segment types - */ - -Physseg physseg[] = -{ - { SG_SHARED, "shared", 0, SEGMAXSIZE, 0, 0 }, - { SG_BSS, "memory", 0, SEGMAXSIZE, 0, 0 }, - { SG_MAP, "map", 0, SEGMAXSIZE, 0, 0 }, - { SG_PHYSICAL, "eisaio", Eisaphys, 64*1024, 0, 0 }, - { SG_PHYSICAL, "eisavga", Eisavgaphys, 128*1024, 0, 0 }, - { SG_PHYSICAL, "bootrom", 0x1fc00000, 256*1024, 0, 0 }, - { SG_PHYSICAL, "nvram", 0xe0009000, 12*1024, 0, 0 }, - { SG_PHYSICAL, "fb", 0x40000000, 4*1024*1024, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, -}; diff --git a/mpc/segment.h b/mpc/segment.h deleted file mode 100644 index 3f6e9542bee2c5956771b00436fa8bbb8f17f350..0000000000000000000000000000000000000000 --- a/mpc/segment.h +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Attach segment types - */ -static Physseg physseg[10] = { - { SG_SHARED, "shared", 0, SEGMAXSIZE, 0, 0 }, - { SG_BSS, "memory", 0, SEGMAXSIZE, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, -}; diff --git a/pc/ether82557.c b/pc/ether82557.c index 4b4a9ac39cea8fd33f8bf9d5250f9c64f74e5656..edd0276e8ea5e678b31d5bed4410034872183c99 100644 --- a/pc/ether82557.c +++ b/pc/ether82557.c @@ -225,7 +225,6 @@ typedef struct Ctlr { } Ctlr; static Ctlr* ctlrhead; -static Ctlr* ctlrtail; static uchar configdata[24] = { 0x16, /* byte count */ @@ -914,11 +913,13 @@ i82557pci(void) ctlr->port = port; ctlr->pcidev = p; - if(ctlrhead != nil) - ctlrtail->next = ctlr; - else - ctlrhead = ctlr; - ctlrtail = ctlr; + /* + * this is backwards from what we really wanted to do + * but this keeps the numbering of ethernet cards + * consistent with 9load. + */ + ctlr->next = ctlrhead; + ctlrhead = ctlr; pcisetbme(p); } diff --git a/pc/segment.h b/pc/segment.h deleted file mode 100644 index 3f6e9542bee2c5956771b00436fa8bbb8f17f350..0000000000000000000000000000000000000000 --- a/pc/segment.h +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Attach segment types - */ -static Physseg physseg[10] = { - { SG_SHARED, "shared", 0, SEGMAXSIZE, 0, 0 }, - { SG_BSS, "memory", 0, SEGMAXSIZE, 0, 0 }, - { 0, 0, 0, 0, 0, 0 }, -}; diff --git a/port/chan.c b/port/chan.c index 1c2a8f22e9f47f1652b85301cf51c25bbd1822dc..2496a9f713b0213527db7a45b36e7d6f49988d6c 100644 --- a/port/chan.c +++ b/port/chan.c @@ -664,6 +664,8 @@ namec(char *name, int amode, int omode, ulong perm) cname = newcname(name); /* save this before advancing */ name = skipslash(name); c = cclone(up->slash, 0); + if(*name == 0) + isdot = 1; break; case '#': cname = newcname(name); /* save this before advancing */ diff --git a/port/devproc.c b/port/devproc.c index fd27afd8a6b2497706dcadf11211d829e4c2bc47..75da0631a200ed33905ce31056565d1db5443214 100644 --- a/port/devproc.c +++ b/port/devproc.c @@ -49,7 +49,7 @@ Dirtab procdir[] = }; /* Segment type from portdat.h */ -char *sname[]={ "Text", "Data", "Bss", "Stack", "Shared", "Phys", "Shdata", "Map" }; +char *sname[]={ "Text", "Data", "Bss", "Stack", "Shared", "Phys", "Shdata" }; /* * Qids are, in path: diff --git a/port/fault.c b/port/fault.c index f7b25eb006ff4447972d8ab67b8d63e5ef2dfe8a..7520d0c5879d6b7dd0156d79b65ecef173e1e8cd 100644 --- a/port/fault.c +++ b/port/fault.c @@ -53,12 +53,10 @@ fixfault(Segment *s, ulong addr, int read, int doputmmu) int type; int ref; Pte **p, *etp; - char buf[ERRLEN]; - ulong va, mmuphys=0, soff; + ulong mmuphys=0, soff; Page **pg, *lkp, *new; Page *(*fn)(Segment*, ulong); - va = addr; addr &= ~(BY2PG-1); soff = addr-s->base; p = &s->map[soff/PTEMAPMEM]; @@ -90,12 +88,7 @@ fixfault(Segment *s, ulong addr, int read, int doputmmu) case SG_BSS: case SG_SHARED: /* Zero fill on demand */ case SG_STACK: - case SG_MAP: if(*pg == 0) { - if(type == SG_MAP) { - sprint(buf, "map 0x%lux %c", va, read ? 'r' : 'w'); - postnote(up, 1, buf, NDebug); - } new = newpage(1, &s, addr); if(s == 0) return -1; diff --git a/port/portdat.h b/port/portdat.h index a4c0a2e44fa37260d0fdd15d5b424ebdea90c994..55204347e4337f869e1b093e421548cdf8c921ff 100644 --- a/port/portdat.h +++ b/port/portdat.h @@ -343,7 +343,6 @@ enum SG_SHARED = 04, SG_PHYSICAL = 05, SG_SHDATA = 06, - SG_MAP = 07, SG_RONLY = 0040, /* Segment is read only */ SG_CEXEC = 0100, /* Detach at exec */ diff --git a/port/segment.c b/port/segment.c index baa25657298489088c83114b8eabf770d3303920..a7e8752933213bd421c9616ab065a67a3f36c3a2 100644 --- a/port/segment.c +++ b/port/segment.c @@ -158,7 +158,6 @@ dupseg(Segment **seg, int segno, int share) case SG_TEXT: /* New segment shares pte set */ case SG_SHARED: case SG_PHYSICAL: - case SG_SHDATA: goto sameseg; case SG_STACK: @@ -166,13 +165,8 @@ dupseg(Segment **seg, int segno, int share) break; case SG_BSS: /* Just copy on write */ - case SG_MAP: - if(share) { - if(s->ref != 1) - print("Fuckin A cap'n!\n"); - s->type = (s->type&~SG_TYPE)|SG_SHARED; + if(share) goto sameseg; - } n = newseg(s->type, s->base, s->size); break; @@ -183,12 +177,8 @@ dupseg(Segment **seg, int segno, int share) return data2txt(s); } - if(share) { - if(s->ref != 1) - print("Fuckin A again cap'n!\n"); - s->type = (s->type&~SG_TYPE)|SG_SHDATA; + if(share) goto sameseg; - } n = newseg(s->type, s->base, s->size); incref(s->image); @@ -203,6 +193,8 @@ dupseg(Segment **seg, int segno, int share) n->map[i] = ptecpy(pte); n->flushme = s->flushme; + if(s->ref > 1) + procflushseg(s); poperror(); qunlock(&s->lk); return n; @@ -531,13 +523,8 @@ mfreeseg(Segment *s, ulong start, int pages) } out: /* flush this seg in all other processes */ - i = s->type&SG_TYPE; - switch(i){ - case SG_SHARED: - case SG_SHDATA: + if(s->ref > 1) procflushseg(s); - break; - } /* free the pages */ for(pg = list; pg != nil; pg = list){ diff --git a/port/swap.c b/port/swap.c index 81f5a13f36b539c7e681f6b62f388ce50a9800b7..44e3d291f16b0d8d3e445589d7507b8234821a12 100644 --- a/port/swap.c +++ b/port/swap.c @@ -148,7 +148,6 @@ loop: case SG_STACK: case SG_SHARED: case SG_SHDATA: - case SG_MAP: up->psstate = "Pageout"; pageout(p, s); if(ioptr != 0) { @@ -282,7 +281,6 @@ pagepte(int type, Page **pg) case SG_STACK: case SG_SHARED: case SG_SHDATA: - case SG_MAP: /* * get a new swap address and clear any pages * referring to it from the cache