From 1da40af099035b1ca81c1970f78eccde1aef81ed Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 2 Oct 1992 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1992-10-02 --- pc/devfloppy.c | 22 ++++++++++++---------- pc/devhard.c | 28 ++++++++++++---------------- pc/main.c | 6 +++++- port/fault.c | 1 - ss/main.c | 1 - 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/pc/devfloppy.c b/pc/devfloppy.c index e045c723e7eccdf432007a2be5eb65e1660afca6..600f10147f4bdc386a0eb1c191e315a4eba17897 100644 --- a/pc/devfloppy.c +++ b/pc/devfloppy.c @@ -72,6 +72,7 @@ struct Type int tracks; /* tracks/disk */ int gpl; /* intersector gap length for read/write */ int fgpl; /* intersector gap length for format */ + int ring; /* ring of compatible floppy types */ /* * these depend on previous entries and are set filled in @@ -83,12 +84,12 @@ struct Type }; Type floppytype[] = { - { "MF2HD", 512, 18, 2, 1, 80, 0x1B, 0x54, }, - { "MF1DD", 512, 9, 2, 1, 80, 0x1B, 0x54, }, - { "MF4HD", 1024, 18, 2, 1, 80, 0x1B, 0x54, }, - { "F2HD", 512, 15, 2, 1, 80, 0x2A, 0x50, }, - { "F2DD", 512, 8, 2, 2, 40, 0x2A, 0x50, }, - { "F1DD", 512, 8, 1, 2, 40, 0x2A, 0x50, }, +[0] { "MF2HD", 512, 18, 2, 1, 80, 0x1B, 0x54, 1, }, +[1] { "MF1DD", 512, 9, 2, 1, 80, 0x1B, 0x54, 2, }, +[2] { "MF4HD", 1024, 18, 2, 1, 80, 0x1B, 0x54, 0, }, +[3] { "F2HD", 512, 15, 2, 1, 80, 0x2A, 0x50, 4, }, +[4] { "F2DD", 512, 8, 2, 2, 40, 0x2A, 0x50, 5, }, +[5] { "F1DD", 512, 8, 1, 2, 40, 0x2A, 0x50, 3, }, }; #define NTYPES (sizeof(floppytype)/sizeof(Type)) @@ -323,7 +324,7 @@ islegal(Chan *c, long n, Drive *dp) } /* - * check if the floppy has been replaced under foot + * check if the floppy has been replaced under foot. cause a read error if it has. * * a seek and a read clears the condition. this was determined experimentally, * there has to be a better way. @@ -337,9 +338,9 @@ changed(Chan *c, Drive *dp) dp->vers++; dp->ccyl = -1; if(dp->cyl) - floppyxfer(dp, Fread, dp->cache, 0, dp->t->tsize); + floppythrice(dp, Fread, dp->cache, 0, dp->t->tsize); else - floppyxfer(dp, Fread, dp->cache, dp->t->heads*dp->t->tsize, dp->t->tsize); + floppythrice(dp, Fread, dp->cache, dp->t->heads*dp->t->tsize, dp->t->tsize); } old = c->qid.vers; c->qid.vers = dp->vers; @@ -759,7 +760,8 @@ floppyseek(Drive *dp, long off) } /* - * since floppies are so flakey, try 3 times before giving up + * since floppies are so flakey, automaticly retry failed attempts. + * every 3 tries switch to a different density */ static long floppythrice(Drive *dp, int cmd, void *a, long off, long n) diff --git a/pc/devhard.c b/pc/devhard.c index 911673a7a2dcfc8c687a353223e30167353aafa6..cdcfa877af63f2e10e45b4a143c4a10aa6fdce23 100644 --- a/pc/devhard.c +++ b/pc/devhard.c @@ -6,6 +6,8 @@ #include "io.h" #include "../port/error.h" +#include "devtab.h" + #define DPRINT if(1)print typedef struct Drive Drive; @@ -271,7 +273,7 @@ hardwstat(Chan *c, char *dp) } long -hardread(Chan *c, void *a, long n) +hardread(Chan *c, void *a, long n, ulong offset) { Drive *dp; long rv, i; @@ -285,19 +287,16 @@ hardread(Chan *c, void *a, long n) buf = smalloc(Maxxfer); if(waserror()){ - print("hard read error\n"); free(buf); nexterror(); } -if(a&KZERO)print("rd k 0x%lux d 0x%lux\n", a, n); - dp = &hard[DRIVE(c->qid.path)]; pp = &dp->p[PART(c->qid.path)]; - skip = c->offset % dp->bytes; + skip = offset % dp->bytes; for(rv = 0; rv < n; rv += i){ - i = hardxfer(dp, pp, Cread, c->offset+rv-skip, n-rv+skip, buf); + i = hardxfer(dp, pp, Cread, offset+rv-skip, n-rv+skip, buf); if(i == 0) break; i -= skip; @@ -314,7 +313,7 @@ if(a&KZERO)print("rd k 0x%lux d 0x%lux\n", a, n); } long -hardwrite(Chan *c, void *a, long n) +hardwrite(Chan *c, void *a, long n, ulong offset) { Drive *dp; long rv, i, partial; @@ -329,27 +328,24 @@ hardwrite(Chan *c, void *a, long n) pp = &dp->p[PART(c->qid.path)]; buf = smalloc(Maxxfer); if(waserror()){ - print("hard write error\n"); free(buf); nexterror(); } -if(a&KZERO)print("wr k 0x%lux d 0x%lux\n", a, n); - /* * if not starting on a sector boundary, * read in the first sector before writing * it out. */ - partial = c->offset % dp->bytes; + partial = offset % dp->bytes; if(partial){ - hardxfer(dp, pp, Cread, c->offset-partial, dp->bytes, buf); + hardxfer(dp, pp, Cread, offset-partial, dp->bytes, buf); if(partial+n > dp->bytes) rv = dp->bytes - partial; else rv = n; memmove(buf+partial, aa, rv); - hardxfer(dp, pp, Cwrite, c->offset-partial, dp->bytes, buf); + hardxfer(dp, pp, Cwrite, offset-partial, dp->bytes, buf); } else rv = 0; @@ -363,7 +359,7 @@ if(a&KZERO)print("wr k 0x%lux d 0x%lux\n", a, n); if(i > Maxxfer) i = Maxxfer; memmove(buf, aa+rv, i); - i = hardxfer(dp, pp, Cwrite, c->offset+rv, i, buf); + i = hardxfer(dp, pp, Cwrite, offset+rv, i, buf); if(i == 0) break; } @@ -374,9 +370,9 @@ if(a&KZERO)print("wr k 0x%lux d 0x%lux\n", a, n); * it out. */ if(partial){ - hardxfer(dp, pp, Cread, c->offset+rv, dp->bytes, buf); + hardxfer(dp, pp, Cread, offset+rv, dp->bytes, buf); memmove(buf, aa+rv, partial); - hardxfer(dp, pp, Cwrite, c->offset+rv, dp->bytes, buf); + hardxfer(dp, pp, Cwrite, offset+rv, dp->bytes, buf); rv += partial; } diff --git a/pc/main.c b/pc/main.c index 73d2d96345728fd6259bfd6115b0eb5b6cefc98e..b06d0376cb6af5a1e52181a2e6bd07b2a3758aa8 100644 --- a/pc/main.c +++ b/pc/main.c @@ -227,6 +227,7 @@ void confinit(void) { long x, i, j, *l; + int pcnt; ulong ktop; /* @@ -265,7 +266,10 @@ confinit(void) conf.base1 = 1*MB; conf.npage1 = ((i-1)*MB - conf.base1)/BY2PG; conf.npage = conf.npage0 + conf.npage1; - conf.upages = (conf.npage*60)/100; + + pcnt = screenbits()-1; /* Calculate % of memory for page pool */ + pcnt = 70 - (pcnt*10); + conf.upages = (conf.npage*pcnt)/100; ktop = PGROUND((ulong)end); ktop = PADDR(ktop); diff --git a/port/fault.c b/port/fault.c index 5091ac5a02745f2fb6ff157d6756cbd748214f5c..43734a9c4bd9e9b70ca80cba4424cac333f8032c 100644 --- a/port/fault.c +++ b/port/fault.c @@ -247,7 +247,6 @@ pio(Segment *s, ulong addr, ulong soff, Page **p) void faulterror(char *s) { - print("faulterror %s\n", s); if(u->nerrlab) { postnote(u->p, 1, s, NDebug); error(s); diff --git a/ss/main.c b/ss/main.c index f7d199de183d844910a373504cf5acdd079cfe34..c1e56486bec87cc6631be0bf115ffb7e75b39b0c 100644 --- a/ss/main.c +++ b/ss/main.c @@ -300,7 +300,6 @@ confinit(void) * keyboard, too. */ switch(idprom[1]){ - case 0x52: /* IPC */ case 0x54: /* SLC */ conf.monitor = 1; fbslot = 3;