Check that bus freq is not zero
authorChristopher Koch <chrisko@google.com>
Wed, 11 May 2016 19:39:00 +0000 (12:39 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 12 May 2016 12:15:51 +0000 (08:15 -0400)
Change-Id: Ib1e8986c4d1a41b87d854d9b47c301bd585f89ca
Signed-off-by: Christopher Koch <chrisko@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/arch/x86/time.c

index fed0b73..2c3d506 100644 (file)
@@ -39,6 +39,7 @@ void timer_init(void){
        timercount[1] = apicrget(MSR_LAPIC_CURRENT_COUNT);
        __proc_global_info.bus_freq = (timercount[0] - timercount[1])
                                 * LAPIC_TIMER_DIVISOR_VAL;
        timercount[1] = apicrget(MSR_LAPIC_CURRENT_COUNT);
        __proc_global_info.bus_freq = (timercount[0] - timercount[1])
                                 * LAPIC_TIMER_DIVISOR_VAL;
+       assert(__proc_global_info.bus_freq);
        /* The time base for the timer is derived from the processor's bus clock,
         * divided by the value specified in the divide configuration register.
         * Note we mult and div by the divisor, saving the actual freq (even though
        /* The time base for the timer is derived from the processor's bus clock,
         * divided by the value specified in the divide configuration register.
         * Note we mult and div by the divisor, saving the actual freq (even though