From: Farshad Ghanei Date: Wed, 28 Mar 2018 17:34:35 +0000 (-0400) Subject: timer: Fix timer calibration logic. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pintos-anon;a=commitdiff_plain;h=52fd7eb25b15662abfacca92e20416cb29d85395 timer: Fix timer calibration logic. loops_per_tick calculation should get updated with loops_per_tick, not with high_bit. --- diff --git a/src/devices/timer.c b/src/devices/timer.c index befaaae..8b92341 100644 --- a/src/devices/timer.c +++ b/src/devices/timer.c @@ -60,7 +60,7 @@ timer_calibrate (void) /* Refine the next 8 bits of loops_per_tick. */ high_bit = loops_per_tick; for (test_bit = high_bit >> 1; test_bit != high_bit >> 10; test_bit >>= 1) - if (!too_many_loops (high_bit | test_bit)) + if (!too_many_loops (loops_per_tick | test_bit)) loops_per_tick |= test_bit; printf ("%'"PRIu64" loops/s.\n", (uint64_t) loops_per_tick * TIMER_FREQ);