From bd093d300e94ab7f597d6cf40f1bd2bdcf4072fd Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 19 Dec 2002 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2002-12-19 --- pc/i8253.c | 8 ++++---- pc/trap.c | 1 - port/edf.c | 15 ++++----------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/pc/i8253.c b/pc/i8253.c index 8e9102e252778fb20d5a6f505b13c996a8cb689b..766b7c1567a43dffcbd102f43800c63aac33f294 100644 --- a/pc/i8253.c +++ b/pc/i8253.c @@ -77,13 +77,14 @@ i8253init(void) ioalloc(T0cntr, 4, 0, "i8253"); ioalloc(T2ctl, 1, 0, "i8253.cntr2ctl"); + i8253.period = Freq/HZ; + /* * enable a 1/HZ interrupt for providing scheduling interrupts */ outb(Tmode, Load0|Square); outb(T0cntr, (Freq/HZ)); /* low byte */ outb(T0cntr, (Freq/HZ)>>8); /* high byte */ - i8253.period = Freq/HZ; /* * enable a longer period counter to use as a clock @@ -91,7 +92,6 @@ i8253init(void) outb(Tmode, Load2|Square); outb(T2cntr, 0); /* low byte */ outb(T2cntr, 0); /* high byte */ - i8253.period = Freq/HZ; x = inb(T2ctl); x |= T2gate; outb(T2ctl, x); @@ -193,7 +193,7 @@ ulong phist[128]; void i8253timerset(uvlong next) { - ulong period; + long period; ulong want; ulong now; @@ -220,7 +220,7 @@ phist[nelem(phist)-1] = period; /* load new value */ outb(Tmode, Load0|Square); outb(T0cntr, period); /* low byte */ - outb(T0cntr, period>>8); /* high byte */ + outb(T0cntr, period >> 8); /* high byte */ /* remember period */ i8253.period = period; diff --git a/pc/trap.c b/pc/trap.c index c78f83e8155f3a8192afebe3f852ec00409d6a3f..d8645ac90793f9ec560045ac683d6e9ad08120d6 100644 --- a/pc/trap.c +++ b/pc/trap.c @@ -266,7 +266,6 @@ intrtime(Mach*, int vno) diff /= m->cpumhz; if(diff >= Ntimevec){ - if (vno == 32) print("timer took %d µs\n", diff); diff = Ntimevec-1; } intrtimes[vno][diff]++; diff --git a/port/edf.c b/port/edf.c index 1f57f17e063d5cd0290e7518c107b0a1cd6d3c0b..c26bb8de37e11bcee4f843d1349cb7f3a3b5f67e 100644 --- a/port/edf.c +++ b/port/edf.c @@ -427,14 +427,11 @@ edfreleaseintr(Ureg*, Timer*) DPRINT("%d edfreleaseintr\n", m->machno); - timerdel(&releasetimer[m->machno]); - releasetimer[m->machno].when = 0; - if(panicking || active.exiting) return; - ilock(&edflock); now = fastticks(nil); + ilock(&edflock); while((t = qwaitrelease.head) && t->r <= now){ /* There's something waiting to be released and its time has come */ edfdequeue(&qwaitrelease); @@ -447,7 +444,7 @@ edfreleaseintr(Ureg*, Timer*) } static void -edfdeadlineintr(Ureg*, Timer *timer) +edfdeadlineintr(Ureg*, Timer *) { /* Task reached deadline */ @@ -460,19 +457,15 @@ edfdeadlineintr(Ureg*, Timer *timer) DPRINT("%d edfdeadlineintr\n", m->machno); - if (timer) - timer->when = 0; - if(panicking || active.exiting) return; + now = fastticks(nil); ilock(&edflock); // If up is not set, we're running inside the scheduler // for non-real-time processes. noted = 0; if (up && isedf(up)) { - now = fastticks(nil); - t = up->task; assert(t->state == EdfRunning); @@ -1075,7 +1068,7 @@ resacquire(Task *t, CSN *c) if (t->curcsn) t->curcsn->S -= used; when = now + c->S; - if (when < deadlinetimer[m->machno].when){ + if (deadlinetimer[m->machno].when == 0 || when < deadlinetimer[m->machno].when){ deadlinetimer[m->machno].when = when; timeradd(&deadlinetimer[m->machno]); }