From af346b023567f1d7bec07ef3580461de63b96fe6 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 10 Aug 1994 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1994-08-10 --- carrera/l.s | 11 +++++------ pc/clock.c | 17 +---------------- pc/devvga.c | 3 ++- pc/ether8003.c | 2 +- pc/vgas3.c | 8 ++++---- pc/vgatvp3020.c | 14 ++++++++++++++ port/portdat.h | 1 + port/proc.c | 3 ++- 8 files changed, 30 insertions(+), 29 deletions(-) diff --git a/carrera/l.s b/carrera/l.s index 761efb1e5c645c2ce35a71a5f1cb9420ab39189f..52ec0eadad86f9c7fc2a1db955743ebfcb39cf3d 100644 --- a/carrera/l.s +++ b/carrera/l.s @@ -368,9 +368,10 @@ TEXT exception(SB), $-4 wasuser: MOVW SP, R27 - CONST (MACHADDR, SP) /* R27 = m-> */ - MOVW 8(SP), SP /* R26 = m->proc */ - MOVW 8(SP), SP /* R27 = m->proc->kstack */ + CONST (MACHADDR, SP) /* m-> */ + MOVW 8(SP), SP /* m->proc */ + MOVW 8(SP), SP /* m->proc->kstack */ + MOVW M(STATUS), R26 /* redundant test */ ADDU $(KSTACK-UREGSIZE), SP MOVV R31, (Ureg_r31-4)(SP) @@ -381,8 +382,7 @@ wasuser: MOVV R(USER), (Ureg_r24-4)(SP) MOVW $setR30(SB), R30 - CONST (MACHADDR, R1) - MOVW R1, R(MACH) /* R(MACH) = m-> */ + CONST (MACHADDR, R(MACH)) /* R(MACH) = m-> */ MOVW 8(R(MACH)), R(USER) /* up = m->proc */ AND $(EXCMASK<<2), R26, R1 @@ -564,7 +564,6 @@ TEXT rfnote(SB), $0 SUBU $(BY2WD), R26, SP /* pc hole */ JMP restore - TEXT clrfpintr(SB), $0 MOVW M(STATUS), R3 WAIT diff --git a/pc/clock.c b/pc/clock.c index 4b98cef60f0a3c38d7dbccb2c4bafc844abd57d9..0122ecc97a8c6ba03ae94a142cfefa31c55fe3b2 100644 --- a/pc/clock.c +++ b/pc/clock.c @@ -37,7 +37,6 @@ clock(Ureg *ur, void *arg) { Proc *p; int nrun = 0; - int islow = 0; USED(arg); @@ -65,25 +64,11 @@ clock(Ureg *ur, void *arg) sched(); /* user profiling clock */ - if((ur->cs&0xffff) == UESEL){ - islow = 1; - spllo(); /* in case we fault */ + if((ur->cs&0xffff) == UESEL) (*(ulong*)(USTKTOP-BY2WD)) += TK2MS(1); - } - } - - /* - * anything from here down can be running spllo() - */ - if(!islow){ - islow = 1; - spllo(); } mouseclock(); - - if(islow) - splhi(); } /* diff --git a/pc/devvga.c b/pc/devvga.c index bb568d6b9fe2551d39c0cb89279e5bed9d20dff4..0bfaad9835e390d6b6a2a4b31da59f0e44796faa 100644 --- a/pc/devvga.c +++ b/pc/devvga.c @@ -21,11 +21,12 @@ extern Subfont defont0; /* exported */ Bitmap gscreen; +Lock palettelock; /* access to DAC registers */ +Cursor curcursor; /* current cursor */ /* vga screen */ static Lock screenlock; static ulong colormap[256][3]; -Lock palettelock; /* cga screen */ static int cga = 1; /* true if in cga mode */ diff --git a/pc/ether8003.c b/pc/ether8003.c index 8d23e7533e0708e25071d7f42cc00973c886b70a..a8c85a0aadf82e483cb00c6e658dc206ca3286fe 100644 --- a/pc/ether8003.c +++ b/pc/ether8003.c @@ -94,7 +94,7 @@ reset(Ether *ether) */ port = ether->port; sum = 0; - for(i = 0; i < sizeof(ether->ea); i++){ + for(i = 0; i < sizeof(ea); i++){ ea[i] = inb(port+Lar+i); sum += ea[i]; ic[i] = inb(port+i); diff --git a/pc/vgas3.c b/pc/vgas3.c index 5491a03478bcead6db57df780c16ff2f2d1be42b..9b85d1cd8952b811b9ad9834c69b86e2286fb482 100644 --- a/pc/vgas3.c +++ b/pc/vgas3.c @@ -17,9 +17,9 @@ static Lock s3pagelock; static ulong storage; static Point hotpoint; -static Cursor loaded; extern Bitmap gscreen; +extern Cursor curcursor; static void sets3page(int page) @@ -123,13 +123,13 @@ load(Cursor *c) * just make sure it's enabled. */ lock(&s3pagelock); - if(memcmp(c, &loaded, sizeof(Cursor)) == 0){ + if(memcmp(c, &curcursor, sizeof(Cursor)) == 0){ vsyncactive(); vgaxo(Crtx, 0x45, 0x01); unlock(&s3pagelock); return; } - memmove(&loaded, c, sizeof(Cursor)); + memmove(&curcursor, c, sizeof(Cursor)); /* * Disable the cursor. @@ -189,7 +189,7 @@ move(Point p) int x, xo, y, yo; if(canlock(&s3pagelock) == 0) - return -1; + return 1; /* * Mustn't position the cursor offscreen even partially, diff --git a/pc/vgatvp3020.c b/pc/vgatvp3020.c index da2e59ba6927294bf4bb3158d5343f9914fd8b20..ff84cc48213b97beae282cd9654a76b380dfb9cb 100644 --- a/pc/vgatvp3020.c +++ b/pc/vgatvp3020.c @@ -9,6 +9,8 @@ #include "screen.h" #include "vga.h" +extern Cursor curcursor; + /* * TVP3020 Viewpoint Video Interface Pallette. * Assumes hooked up to an S3 86C928. @@ -59,7 +61,19 @@ load(Cursor *c) uchar p, p0, p1; int x, y; + /* + * Lock the DAC registers so we can update the + * cursor bitmap if necessary. + * If it's the same as the last cursor we loaded, + * just make sure it's enabled. + */ lock(&palettelock); + if(memcmp(c, &curcursor, sizeof(Cursor)) == 0){ + tvp3020xo(0x06, 0x40|0x10); /* Cursor Control Register */ + unlock(&palettelock); + return; + } + memmove(&curcursor, c, sizeof(Cursor)); /* * Make sure cursor is off by initialising the cursor diff --git a/port/portdat.h b/port/portdat.h index f90d55f7df1116f1ba5dbe209db7261098d50eec..cff3fffa3736fcfe1a043bcb635b94f800aac8c1 100644 --- a/port/portdat.h +++ b/port/portdat.h @@ -580,6 +580,7 @@ struct Proc ulong priority; /* priority level */ ulong basepri; /* base priority level */ ulong movetime; /* last time process switched processors */ + ulong readyticks; /* time process went ready */ void *ureg; /* User registers for notes */ void *dbgreg; /* User registers for devproc */ diff --git a/port/proc.c b/port/proc.c index 575f09a6462ae351dd9cdcd36ee3aa3cd2773c97..62e96732af75a6429108cadd92eb2cd1e412572a 100644 --- a/port/proc.c +++ b/port/proc.c @@ -141,6 +141,7 @@ ready(Proc *p) rq->tail = p; rq->n++; nrdy++; + p->readyticks = m->ticks; p->state = Ready; unlock(runq); splx(s); @@ -737,7 +738,7 @@ procdump(void) for(rq = runq; rq < &runq[Nrq]; rq++){ print("rq%d:", rq-runq); for(p = rq->head; p; p = p->rnext) - print(" %d", p->pid); + print(" %d(%d)", p->pid, m->ticks - p->readyticks); print("\n"); } print("nrdy %d\n", nrdy);