From 185aaddeb7c5f717988d3f97f3b4f29b9c30b0cb Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 3 Jan 1992 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1992-01-03 --- gnot/dat.h | 19 ------------------- gnot/mmu.c | 34 ---------------------------------- pc/main.c | 2 +- pc/trap.c | 6 ++++-- port/fault.c | 2 +- port/ipdat.h | 1 + port/proc.c | 1 - port/stil.c | 2 ++ port/sysproc.c | 3 --- 9 files changed, 9 insertions(+), 61 deletions(-) diff --git a/gnot/dat.h b/gnot/dat.h index cf5466a5cdc6c124827730434a6b1a368e8772a1..d0c13e294ae6d514b71a9c9ee577bb2fa4c8da42 100644 --- a/gnot/dat.h +++ b/gnot/dat.h @@ -5,7 +5,6 @@ typedef struct KMap KMap; typedef struct Label Label; typedef struct Lock Lock; typedef struct MMU MMU; -typedef struct MMUCache MMUCache; typedef struct Mach Mach; typedef struct PMMU PMMU; typedef struct Portpage Portpage; @@ -146,19 +145,6 @@ struct Mach int stack[1]; }; -struct MMU -{ - ulong va; - ulong pa; -}; - -#define NMMU 16 -struct MMUCache -{ - ulong next; - MMU mmu[NMMU]; -}; - /* * gnot bus ports */ @@ -211,11 +197,6 @@ struct User void *dbgreg; ushort svsr; ushort svvo; - /* - * mmu cache for preloading MMU. - * should be replaced by software TLB? -- presotto - */ - MMUCache mc; }; struct diff --git a/gnot/mmu.c b/gnot/mmu.c index 529128f82cc044118100e1c853cf9aeeb83bdb80..38438fd165930cc5f7874d93e46d876ea1225667 100644 --- a/gnot/mmu.c +++ b/gnot/mmu.c @@ -32,7 +32,6 @@ mapstack(Proc *p) if(p->newtlb) { flushmmu(); - clearmmucache(); p->newtlb = 0; } @@ -42,20 +41,6 @@ mapstack(Proc *p) */ if(!p->kp && p!=m->lproc){ flushmmu(); - - /* - * preload the MMU with the last (up to) NMMU user entries - * previously faulted into it for this process. - */ - mn = &u->mc.mmu[u->mc.next&(NMMU-1)]; - me = &u->mc.mmu[NMMU]; - if(u->mc.next >= NMMU){ - for(mm = mn; mm < me; mm++) - UMAP[mm->va] = mm->pa; - } - for(mm = u->mc.mmu; mm < mn; mm++) - UMAP[mm->va] = mm->pa; - m->lproc = p; } } @@ -82,17 +67,6 @@ putmmu(ulong tlbvirt, ulong tlbphys, Page *p) panic("putmmu"); tlbphys |= VTAG(tlbvirt)<<24; tlbvirt = (tlbvirt&0x003FE000L)>>2; - if(u){ - MMU *mp; - int s; - - s = splhi(); - mp = &(u->mc.mmu[u->mc.next&(NMMU-1)]); - mp->pa = tlbphys; - mp->va = tlbvirt; - u->mc.next++; - splx(s); - } UMAP[tlbvirt] = tlbphys; } @@ -104,14 +78,6 @@ flushmmu(void) *PARAM |= TLBFLUSH_; } -void -clearmmucache(void) -{ - if(u == 0) - panic("clearmmucache"); - u->mc.next = 0; -} - void kmapinit(void) { diff --git a/pc/main.c b/pc/main.c index c02f77009eedaf4cdc0858a4b8a3fb280550227f..640947dd32a303907df953c7f5542041a5fb09da 100644 --- a/pc/main.c +++ b/pc/main.c @@ -201,7 +201,7 @@ confinit(void) conf.maxialloc = 2*1024*1024; mul = 1; - conf.nproc = 30 + 20*mul; + conf.nproc = 30 + i*5; conf.npgrp = conf.nproc/2; conf.nseg = conf.nproc*3; conf.npagetab = (conf.nseg*14)/10; diff --git a/pc/trap.c b/pc/trap.c index f67f931253cf60d44647b3daf03cc975834f6baa..fd2fb93b683b9c27297f553f80b204c1c97bb824 100644 --- a/pc/trap.c +++ b/pc/trap.c @@ -294,6 +294,9 @@ execregs(ulong entry, ulong ssize, ulong nargs) */ #include "../port/systab.h" +/* + * syscall is called spllo() + */ long syscall(Ureg *ur) { @@ -310,7 +313,6 @@ syscall(Ureg *ur) /* * do something about floating point!!! */ - ax = ur->ax; sp = ur->usp; u->nerrlab = 0; @@ -340,7 +342,7 @@ syscall(Ureg *ur) if(ax == NOTED) noted(ur, *(ulong*)(sp+BY2WD)); - splhi(); + splhi(); /* avoid interrupts during the iret */ if(ax!=FORK && (u->p->procctl || u->nnote)) notify(ur); return ret; diff --git a/port/fault.c b/port/fault.c index c355b442a6654a39ac408268ffd388ef72384197..c008e2263fcf39d1bfd328835a81876e67e4c29b 100644 --- a/port/fault.c +++ b/port/fault.c @@ -76,7 +76,7 @@ fixfault(Segment *s, ulong addr, int read, int doputmmu) case SG_BSS: case SG_STACK: /* Zero fill on demand */ - if(*pg == 0) { + if(*pg == 0) { if(new == 0 && (new = newpage(1, &s, addr)) && s == 0) return -1; *pg = new; diff --git a/port/ipdat.h b/port/ipdat.h index 23b58702949b671c106cb1425dceb7215f5f3f19..9c45a080b0e13e336da9900a4d43f5df78434419 100644 --- a/port/ipdat.h +++ b/port/ipdat.h @@ -106,6 +106,7 @@ struct Ilcb /* Control block */ Block *outoforder; int oblks; /* Number of blocks in queue */ + Lock nxl; ulong next; /* Id of next to send */ ulong recvd; /* Last packet received */ ulong start; /* Local start id */ diff --git a/port/proc.c b/port/proc.c index 3a208dc770c337156b115fff8c3c77ebbc72deb4..919ecd4d049ed0f368d8b592ea287b54eb65b9d8 100644 --- a/port/proc.c +++ b/port/proc.c @@ -682,7 +682,6 @@ kproc(char *name, void (*func)(void *), void *arg) /* * Save time: only copy u-> data and useful stack */ - clearmmucache(); /* so child doesn't inherit any of your mappings */ memmove(up, u, sizeof(User)); n = USERADDR+BY2PG - (ulong)&lastvar; n = (n+32) & ~(BY2WD-1); /* be safe & word align */ diff --git a/port/stil.c b/port/stil.c index 36f8bc5ca3f97ffff72a3f164771af06793a6948..cf97e1a9353949d25afec2319e82a67901964c67 100644 --- a/port/stil.c +++ b/port/stil.c @@ -158,7 +158,9 @@ iloput(Queue *q, Block *bp) hnputs(ih->illen, dlen+IL_HDRSIZE); hnputs(ih->ilsrc, ipc->psrc); hnputs(ih->ildst, ipc->pdst); + lock(&ic->nxl); hnputl(ih->ilid, ic->next++); + unlock(&ic->nxl); hnputl(ih->ilack, ic->recvd); ih->iltype = Ildata; ih->ilspec = 0; diff --git a/port/sysproc.c b/port/sysproc.c index 73564e08aeed26bc984a36ded727126e3a140f69..41de36d450b4eea7732fd0244fafb723dc2359fc 100644 --- a/port/sysproc.c +++ b/port/sysproc.c @@ -55,7 +55,6 @@ rfork(ulong flag) upa = VA(k); /* Save time: only copy u-> data and useful stack */ - clearmmucache(); memmove((void*)upa, u, sizeof(User)); n = USERADDR+BY2PG - (ulong)&lastvar; n = (n+32) & ~(BY2WD-1); /* be safe & word align */ @@ -135,7 +134,6 @@ rfork(ulong flag) * (i.e. has bad properties) and has to be discarded. */ flushmmu(); - clearmmucache(); ready(p); return pid; } @@ -344,7 +342,6 @@ sysexec(ulong *arg) * space and needs to be flushed */ flushmmu(); - clearmmucache(); qlock(&p->debug); u->nnote = 0; u->notify = 0;