aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/bitops.h
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-02-14 16:23:43 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2006-02-14 16:23:43 +0100
commit193af2f5c726788dd836c42561550029eadd7ce6 (patch)
tree5af8d09c5aff63c7e0205755acab8ee26c616274 /xen/include/xen/bitops.h
parent45fb1a8c3fcff16ba782347c450b748e35b4829b (diff)
downloadxen-193af2f5c726788dd836c42561550029eadd7ce6.tar.gz
xen-193af2f5c726788dd836c42561550029eadd7ce6.tar.bz2
xen-193af2f5c726788dd836c42561550029eadd7ce6.zip
Upgrade arch/x86/cpu/* files to their equivalents in
linux-2.6.16-rc2/arch/i386/kernel/cpu/*. Also include kernel taint tracking and include that information, and Xen release info, in our crash dumps. Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/include/xen/bitops.h')
-rw-r--r--xen/include/xen/bitops.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index e743c0059d..190d96baa7 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -76,6 +76,33 @@ static __inline__ int generic_fls(int x)
*/
#include <asm/bitops.h>
+
+static inline int generic_fls64(__u64 x)
+{
+ __u32 h = x >> 32;
+ if (h)
+ return fls(x) + 32;
+ return fls(x);
+}
+
+static __inline__ int get_bitmask_order(unsigned int count)
+{
+ int order;
+
+ order = fls(count);
+ return order; /* We could be slightly more clever with -1 here... */
+}
+
+static __inline__ int get_count_order(unsigned int count)
+{
+ int order;
+
+ order = fls(count) - 1;
+ if (count & (count - 1))
+ order++;
+ return order;
+}
+
/*
* hweightN: returns the hamming weight (i.e. the number
* of bits set) of a N-bit word
@@ -126,4 +153,26 @@ static inline unsigned long hweight_long(unsigned long w)
return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w);
}
+/*
+ * rol32 - rotate a 32-bit value left
+ *
+ * @word: value to rotate
+ * @shift: bits to roll
+ */
+static inline __u32 rol32(__u32 word, unsigned int shift)
+{
+ return (word << shift) | (word >> (32 - shift));
+}
+
+/*
+ * ror32 - rotate a 32-bit value right
+ *
+ * @word: value to rotate
+ * @shift: bits to roll
+ */
+static inline __u32 ror32(__u32 word, unsigned int shift)
+{
+ return (word >> shift) | (word << (32 - shift));
+}
+
#endif