M pc/i8253.c => pc/i8253.c +4 -4
@@ 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;
M pc/trap.c => pc/trap.c +0 -1
@@ 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]++;
M port/edf.c => port/edf.c +4 -11
@@ 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]);
}