From be4030a022992b4e050b30853bcf540d00ec7156 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 19 Jul 2002 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2002-07-19 --- ip/il.c | 2 +- pc/apic.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ip/il.c b/ip/il.c index 5e9744126ad76bb75e7057b323164e2a2ede5c6d..6f618f413f5a292b8885b8151d1bffb9d48d96f3 100644 --- a/ip/il.c +++ b/ip/il.c @@ -417,7 +417,7 @@ ilkick(void *x) static void ilcreate(Conv *c) { - c->rq = qopen(64*1024, Qmsg, 0, c); + c->rq = qopen(64*1024, 0, 0, c); c->wq = qopen(64*1024, Qkick, ilkick, c); } diff --git a/pc/apic.c b/pc/apic.c index 6ce82741fcdb794aabc0e534ca80319a10063a30..c26818dbc6c75f5db20202c15b41b1297dcd584a 100644 --- a/pc/apic.c +++ b/pc/apic.c @@ -94,7 +94,7 @@ struct uvlong hz; ulong max; ulong min; - ulong mult; /* factor to mutiply fast ticks by to get lapicticks<<16 */ + ulong div; } lapictimer; static int @@ -149,7 +149,10 @@ lapictimerinit(void) lapictimer.hz = (0xffffffffUL-lapicr(LapicTCCR))*10; lapictimer.max = lapictimer.hz/HZ; lapictimer.min = lapictimer.hz/(100*HZ); - lapictimer.mult = (lapictimer.hz<<16)/hz; + + if(lapictimer.hz > hz) + panic("lapic clock faster than cpu clock"); + lapictimer.div = hz/lapictimer.hz; } } @@ -351,18 +354,17 @@ lapictimerset(uvlong next) x = splhi(); lock(&m->apictimerlock); + period = lapictimer.max; if(next != 0){ period = next - fastticks(nil); - period *= lapictimer.mult; - period >>= 16; + period /= lapictimer.div; if(period < lapictimer.min) period = lapictimer.min; else if(period > lapictimer.max - lapictimer.min) period = lapictimer.max; } - lapicw(LapicTICR, period); unlock(&m->apictimerlock);