From 5cc42e31208637a6e65809698933b63c4987142e Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Mon, 9 Jul 1990 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1990-07-09 --- gnot/main.c | 10 ++++++---- gnot/mmu.c | 7 +++++-- gnot/page.c | 2 ++ gnot/screen.c | 2 +- port/devbit.c | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 46 insertions(+), 7 deletions(-) diff --git a/gnot/main.c b/gnot/main.c index beea439541ef795b49abf8d0c1d3357a5e1f3586..a097e64ea087380098d15b756ca26512f4a53487 100644 --- a/gnot/main.c +++ b/gnot/main.c @@ -290,7 +290,7 @@ confinit(void) conf.npage = conf.npage0+conf.npage1; mul = 1 + (conf.npage1>0); conf.nproc = 40*mul; - conf.npgrp = 15*mul; + conf.npgrp = 12*mul; conf.npte = 700*mul; conf.nmod = 400*mul; conf.nalarm = 1000; @@ -300,15 +300,17 @@ confinit(void) conf.nenvchar = 8000*mul; conf.npgenv = 200*mul; conf.nmtab = 50*mul; - conf.nmount = 100*mul; + conf.nmount = 80*mul; conf.nmntdev = 10*mul; conf.nmntbuf = 2*conf.nmntdev; conf.nmnthdr = 2*conf.nmntdev; - conf.nstream = 64*mul; + conf.nstream = 64; conf.nqueue = 5 * conf.nstream; conf.nblock = 12 * conf.nstream; conf.nsrv = 32*mul; conf.nbitmap = 100*mul; - conf.nbitbyte = 300*1024*mul*mul; + conf.nbitbyte = 300*1024*mul; + if(*(uchar*)MOUSE & (1<<4)) + conf.nbitbyte *= 2; /* ldepth 1 */ conf.nfont = 10*mul; } diff --git a/gnot/mmu.c b/gnot/mmu.c index 974aa2070f71217d47cc8555d80f783c178c034e..3c90915cb6786d38eb360325a61daaceb5d67959 100644 --- a/gnot/mmu.c +++ b/gnot/mmu.c @@ -63,7 +63,7 @@ kmapinit(void) if(kmapalloc.init == 0){ k = &kmapalloc.arena[0]; - k->va = KZERO|(3*1024*1024); + k->va = KZERO|(4*1024*1024-256*1024-BY2PG); k->next = 0; kmapalloc.free = k; kmapalloc.init = 1; @@ -71,6 +71,7 @@ kmapinit(void) } e = (4*1024*1024 - 256*1024)/BY2PG; /* screen lives at top 256K */ i = (((ulong)ialloc(0, 0))&~KZERO)/BY2PG; + print("%lud free map registers\n", e-i); kmapalloc.free = 0; for(k=&kmapalloc.arena[i]; iva = i*BY2PG|KZERO; @@ -85,8 +86,10 @@ kmap(Page *pg) lock(&kmapalloc); k = kmapalloc.free; - if(k == 0) + if(k == 0){ + dumpstack(); panic("kmap"); + } kmapalloc.free = k->next; unlock(&kmapalloc); k->pa = pg->pa; diff --git a/gnot/page.c b/gnot/page.c index 2846e56897dcc75e396b22a64424d1d1e55132ea..cd6e44462a5e3c7a8d9c2eb23cb0127873342bf0 100644 --- a/gnot/page.c +++ b/gnot/page.c @@ -71,6 +71,8 @@ ialloc(ulong n, int align) palloc.addr += BY2PG-1; palloc.addr &= ~(BY2PG-1); } + if(palloc.addr >= (4*1024*1024-256*1024-BY2PG)) + panic("keep bill joy away"); return (void*)(p|KZERO); } diff --git a/gnot/screen.c b/gnot/screen.c index 0edec44c7f1de9d023dcd6d39447499d1d7c644e..146de93531c0c3baeaaac72db3d62be2f05354dd 100644 --- a/gnot/screen.c +++ b/gnot/screen.c @@ -275,7 +275,7 @@ duartintr(Ureg *ur) * Is it 0? */ if(cause & IM_CRDY){ - kproftimer(ur->pc); +/* kproftimer(ur->pc);/**/ c = duart[1].scc_ropbc; duart[0].ctur = (Kptime)>>8; duart[0].ctlr = (Kptime)&255; diff --git a/port/devbit.c b/port/devbit.c index 01be0513dc277da75cc41fd1eef52e37d5997f7b..5c8fa65d9755aa61500aa4776209ffa9f833f321 100644 --- a/port/devbit.c +++ b/port/devbit.c @@ -120,11 +120,13 @@ enum{ Qdir, Qbitblt, Qmouse, + Qscreen, }; Dirtab bitdir[]={ "bitblt", Qbitblt, 0, 0600, "mouse", Qmouse, 0, 0600, + "screen", Qscreen, 0, 0400, }; #define NBIT (sizeof bitdir/sizeof(Dirtab)) @@ -425,6 +427,36 @@ bitread(Chan *c, void *va, long n) } error(0, Ebadblt); + case Qscreen: + if(c->offset==0){ + if(n < 5*12) + error(0, Eio); + sprint(va, "%11d %11d %11d %11d %11d ", + screen.ldepth, screen.r.min.x, + screen.r.min.y, screen.r.max.x, + screen.r.max.y); + n = 5*12; + break; + } + ws = 1<<(3-screen.ldepth); /* pixels per byte */ + l = (screen.r.max.x+ws-1)/ws - screen.r.min.x/ws; + t = c->offset-5*12; + miny = t/l; + maxy = (t+n)/l; + if(miny >= screen.r.max.y) + return 0; + if(maxy >= screen.r.max.y) + maxy = screen.r.max.y; + n = 0; + p = va; + for(y=miny; y