From: Avi Kivity <[EMAIL PROTECTED]>

Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>

diff --git a/kernel/external-module-compat.c b/kernel/external-module-compat.c
index 7b0b983..1eca5fc 100644
--- a/kernel/external-module-compat.c
+++ b/kernel/external-module-compat.c
@@ -77,3 +77,32 @@ int kvm_smp_call_function_single(int cpu, void (*func)(void 
*info),
 #define smp_call_function_single kvm_smp_call_function_single
 
 #endif
+
+/* div64_64 is fairly new */
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,21)
+
+#ifndef CONFIG_64BIT
+
+/* 64bit divisor, dividend and result. dynamic precision */
+uint64_t div64_64(uint64_t dividend, uint64_t divisor)
+{
+       uint32_t high, d;
+
+       high = divisor >> 32;
+       if (high) {
+               unsigned int shift = fls(high);
+
+               d = divisor >> shift;
+               dividend >>= shift;
+       } else
+               d = divisor;
+
+       do_div(dividend, d);
+
+       return dividend;
+}
+
+#endif
+
+#endif
+
diff --git a/kernel/external-module-compat.h b/kernel/external-module-compat.h
index acc7a03..8723ae3 100644
--- a/kernel/external-module-compat.h
+++ b/kernel/external-module-compat.h
@@ -332,24 +332,7 @@ static inline uint64_t div64_64(uint64_t dividend, 
uint64_t divisor)
 
 #else
 
-/* 64bit divisor, dividend and result. dynamic precision */
-static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor)
-{
-       uint32_t high, d;
-
-       high = divisor >> 32;
-       if (high) {
-               unsigned int shift = fls(high);
-
-               d = divisor >> shift;
-               dividend >>= shift;
-       } else
-               d = divisor;
-
-       do_div(dividend, d);
-
-       return dividend;
-}
+uint64_t div64_64(uint64_t dividend, uint64_t divisor);
 
 #endif
 

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-commits mailing list
kvm-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-commits

Reply via email to