This first patch replaces two magic numbers with symbolic constants.
Maybe MAXPHASE should be the largest possible unsigned value, but
this is according to the reference implementation.
--- time.c 1996/04/30 22:17:24 1.3
+++ time.c 1996/05/02 19:34:17
@@ -176,8 +176,8 @@
xtime = *tv;
time_state = TIME_BAD;
- time_maxerror = 0x70000000;
- time_esterror = 0x70000000;
+ time_maxerror = MAXPHASE;
+ time_esterror = MAXPHASE;
sti();
}
This second patch just #ifdefs away the pentium routines that aren't used
when the APM driver is configured. It is believed that APM can change
the CPU clock; thus the cycle counter can be wrong.
--- time.c 1996/04/30 22:17:24 1.3
+++ time.c 1996/04/22 21:12:19 1.2
@@ -29,6 +29,7 @@
extern int setup_x86_irq(int, struct irqaction *);
+#ifndef CONFIG_APM /* cycle counter may be unreliable */
/* Cycle counter value at the previous timer interrupt.. */
static unsigned long long last_timer_cc = 0;
static unsigned long long init_timer_cc = 0;
@@ -82,6 +83,7 @@
quotient = 1000000/HZ-1;
return quotient;
}
+#endif
/* This function must be called with interrupts disabled
* It was inspired by Steve McCanne's microtime-i386 for BSD. -- jrs
@@ -271,6 +273,7 @@
}
+#ifndef CONFIG_APM /* cycle counter may be unreliable */
/*
* This is the same as the above, except we _also_ save the current
* cycle counter value at the time of the timer interrupt, so that
@@ -284,6 +287,7 @@
"=d" (((unsigned long *) &last_timer_cc)[1]));
timer_interrupt(irq, NULL, regs);
}
+#endif
/* Converts Gregorian date to seconds since 1970-01-01 00:00:00.
* Assumes input in normal date format, i.e. 1980-12-31 23:59:59