[patch] mips gettimeofday

Andrea Arcangeli (andrea@e-mind.com)
Tue, 29 Dec 1998 16:29:48 +0100 (CET)


I have a mips pending patch in my tree. If I remeber well it was to avoid
a div by zero in the kernel when jiffies overflow.

Index: linux/arch/mips/kernel/time.c
diff -u linux/arch/mips/kernel/time.c:1.1.1.1 linux/arch/mips/kernel/time.c:1.1.1.1.2.2
--- linux/arch/mips/kernel/time.c:1.1.1.1 Fri Nov 20 00:03:53 1998
+++ linux/arch/mips/kernel/time.c Tue Dec 29 02:47:38 1998
@@ -64,7 +64,7 @@

quotient = cached_quotient;

- if (last_jiffies != tmp) {
+ if (tmp && last_jiffies != tmp) {
last_jiffies = tmp;
__asm__(".set\tnoreorder\n\t"
".set\tnoat\n\t"
@@ -363,6 +363,16 @@
timerlo = count;

timer_interrupt(irq, dev_id, regs);
+
+ if (!jiffies)
+ {
+ /*
+ * If jiffies has overflowed in this timer_interrupt we must
+ * update the timer[hi]/[lo] to make do_fast_gettimeoffset()
+ * quotient calc still valid. -arca
+ */
+ timerhi = timerlo = 0;
+ }
}

/* Converts Gregorian date to seconds since 1970-01-01 00:00:00.

Andrea Arcangeli

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/