Skip to contentSkip to conversation

__div64_32 for 31 bit.

S390 Martin Schwidefsky 1 participant 1 message Sep 28, 2006 s390

lore
Share & tools
lore
#0 lore raw

From: Martin Schwidefsky <[email protected]>

[S390] __div64_32 for 31 bit.

The clocksource infrastructure introduced with commit ad596171ed635c51a9eef829187af100cbf8dcf7 broke 31 bit s390. The reason is that the do_div() primitive for 31 bit always had a restriction: it could only divide an unsigned 64 bit integer by an unsigned 31 bit integer. The clocksource code now uses do_div() with a base value that has the most significant bit set. The result is that clock->cycle_interval has a funny value which causes the linux time to jump around like mad.
The solution is "obvious": implement a proper __div64_32 function for 31 bit s390.

---

 arch/s390/Kconfig        |    4 +
 arch/s390/lib/Makefile   |    1 
 arch/s390/lib/div64.c    |  151 +++++++++++++++++++++++++++++++++++++++++++++++
 include/asm-s390/div64.h |   48 --------------
 4 files changed, 156 insertions(+), 48 deletions(-)
arch/s390/Kconfig +4 -0
diff -urpN linux-2.6/arch/s390/Kconfig linux-2.6-patched/arch/s390/Kconfig
@@ -51,6 +51,10 @@ config 64BIT
 	  Select this option if you have a 64 bit IBM zSeries machine
 	  and want to use the 64 bit addressing mode.
 
+config 32BIT
+	bool
+	default y if !64BIT
+
 config SMP
 	bool "Symmetric multi-processing support"
 	---help---
arch/s390/lib/div64.c +151 -0

151 lines not on this page · raw message

arch/s390/lib/Makefile +1 -0
diff -urpN linux-2.6/arch/s390/lib/Makefile linux-2.6-patched/arch/s390/lib/Makefile
@@ -5,5 +5,6 @@
 EXTRA_AFLAGS := -traditional
 
 lib-y += delay.o string.o uaccess_std.o
+lib-$(CONFIG_32BIT) += div64.o
 lib-$(CONFIG_64BIT) += uaccess_mvcos.o
 lib-$(CONFIG_SMP) += spinlock.o
include/asm-s390/div64.h +0 -48

49 lines not on this page · raw message