[PATCH] enable 64-bit printk on 2.2.17 - Backport of 64-bit code from 2.4

From: Michael Rothwell (rothwell@holly-springs.nc.us)
Date: Wed Aug 23 2000 - 09:32:45 EST


diff -B --unidirectional-new-file --exclude-from=DiffExcludeList
--recursive --unified linux-2.2.16/include/asm-alpha/div64.h
linux/include/asm-alpha/div64.h
--- linux-2.2.16/include/asm-alpha/div64.h Wed Dec 31 19:00:00 1969
+++ linux/include/asm-alpha/div64.h Fri Aug 11 20:04:18 2000
@@ -0,0 +1,14 @@
+#ifndef __ALPHA_DIV64
+#define __ALPHA_DIV64
+
+/*
+ * Hey, we're already 64-bit, no
+ * need to play games..
+ */
+#define do_div(n,base) ({ \
+ int __res; \
+ __res = ((unsigned long) (n)) % (unsigned) (base); \
+ (n) = ((unsigned long) (n)) / (unsigned) (base); \
+ __res; })
+
+#endif
diff -B --unidirectional-new-file --exclude-from=DiffExcludeList
--recursive --unified linux-2.2.16/include/asm-arm/div64.h
linux/include/asm-arm/div64.h
--- linux-2.2.16/include/asm-arm/div64.h Wed Dec 31 19:00:00 1969
+++ linux/include/asm-arm/div64.h Fri Aug 11 20:05:41 2000
@@ -0,0 +1,14 @@
+#ifndef __ASM_ARM_DIV64
+#define __ASM_ARM_DIV64
+
+/* We're not 64-bit, but... */
+#define do_div(n,base) \
+({ \
+ int __res; \
+ __res = ((unsigned long)n) % (unsigned int)base; \
+ n = ((unsigned long)n) / (unsigned int)base; \
+ __res; \
+})
+
+#endif
+
diff -B --unidirectional-new-file --exclude-from=DiffExcludeList
--recursive --unified linux-2.2.16/include/asm-i386/div64.h
linux/include/asm-i386/div64.h
--- linux-2.2.16/include/asm-i386/div64.h Wed Dec 31 19:00:00 1969
+++ linux/include/asm-i386/div64.h Fri Aug 11 20:06:05 2000
@@ -0,0 +1,17 @@
+#ifndef __I386_DIV64
+#define __I386_DIV64
+
+#define do_div(n,base) ({ \
+ unsigned long __upper, __low, __high, __mod; \
+ asm("":"=a" (__low), "=d" (__high):"A" (n)); \
+ __upper = __high; \
+ if (__high) { \
+ __upper = __high % (base); \
+ __high = __high / (base); \
+ } \
+ asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (base), "0" (__low), "1"
(__upper)); \
+ asm("":"=A" (n):"a" (__low),"d" (__high)); \
+ __mod; \
+})
+
+#endif
diff -B --unidirectional-new-file --exclude-from=DiffExcludeList
--recursive --unified linux-2.2.16/include/asm-m68k/div64.h
linux/include/asm-m68k/div64.h
--- linux-2.2.16/include/asm-m68k/div64.h Wed Dec 31 19:00:00 1969
+++ linux/include/asm-m68k/div64.h Fri Aug 11 20:06:57 2000
@@ -0,0 +1,35 @@
+#ifndef _M68K_DIV64_H
+#define _M68K_DIV64_H
+
+/* n = n / base; return rem; */
+
+#if 1
+#define do_div(n, base) ({ \
+ union { \
+ unsigned long n32[2]; \
+ unsigned long long n64; \
+ } __n; \
+ unsigned long __rem, __upper; \
+ \
+ __n.n64 = (n); \
+ if ((__upper = __n.n32[0])) { \
+ asm ("divul.l %2,%1:%0" \
+ : "=d" (__n.n32[0]), "=d" (__upper) \
+ : "d" (base), "0" (__n.n32[0])); \
+ } \
+ asm ("divu.l %2,%1:%0" \
+ : "=d" (__n.n32[1]), "=d" (__rem) \
+ : "d" (base), "1" (__upper), "0" (__n.n32[1])); \
+ (n) = __n.n64; \
+ __rem; \
+})
+#else
+#define do_div(n,base) ({ \
+ int __res; \
+ __res = ((unsigned long) n) % (unsigned) base; \
+ n = ((unsigned long) n) / (unsigned) base; \
+ __res; \
+})
+#endif
+
+#endif /* _M68K_DIV64_H */
diff -B --unidirectional-new-file --exclude-from=DiffExcludeList
--recursive --unified linux-2.2.16/include/asm-mips/div64.h
linux/include/asm-mips/div64.h
--- linux-2.2.16/include/asm-mips/div64.h Wed Dec 31 19:00:00 1969
+++ linux/include/asm-mips/div64.h Fri Aug 11 20:41:49 2000
@@ -0,0 +1,20 @@
+/* $Id: div64.h,v 1.1.2.1 2000/08/12 00:41:49 zapman Exp $
+ *
+ * This file is subject to the terms and conditions of the GNU General
Public
+ * License. See the file "COPYING" in the main directory of this
archive
+ * for more details.
+ */
+#ifndef _ASM_DIV64_H
+#define _ASM_DIV64_H
+
+/*
+ * Hey, we're already 64-bit, no
+ * need to play games..
+ */
+#define do_div(n,base) ({ \
+ int __res; \
+ __res = ((unsigned long) n) % (unsigned) base; \
+ n = ((unsigned long) n) / (unsigned) base; \
+ __res; })
+
+#endif
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Aug 23 2000 - 21:00:08 EST