WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [LIBFS] IA64 & PPC aren't making use of t

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [LIBFS] IA64 & PPC aren't making use of this right now, but it's silly to
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 11 Nov 2006 09:10:16 +0000
Delivery-date: Sat, 11 Nov 2006 01:10:12 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxxx
# Node ID 825be74657c314c7b73f8f1cdb39a4445aace2ea
# Parent  d108efc94de79ab8aa34311580c657740300908e
[LIBFS] IA64 & PPC aren't making use of this right now, but it's silly to
have the build fail for some trivial x86 specific assembly.  I snagged the
appropriate bitops for ia64 and ppc (untested) and tossed in an
unoptimized option as well in case we want to make use of it.

Signed-off-by: Alex Williamson <alex.williamson@xxxxxx>
---
 tools/libfsimage/ext2fs/fsys_ext2fs.c     |   61 ++++++++++++++++++++++++++++++
 tools/libfsimage/reiserfs/fsys_reiserfs.c |   57 ++++++++++++++++++++++++++++
 2 files changed, 118 insertions(+)

diff -r d108efc94de7 -r 825be74657c3 tools/libfsimage/ext2fs/fsys_ext2fs.c
--- a/tools/libfsimage/ext2fs/fsys_ext2fs.c     Sat Nov 11 01:23:11 2006 +0000
+++ b/tools/libfsimage/ext2fs/fsys_ext2fs.c     Sat Nov 11 01:25:00 2006 +0000
@@ -232,6 +232,7 @@ struct ext2_dir_entry
 #define S_ISREG(m)      (((m) & S_IFMT) == S_IFREG)
 #define S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)
 
+#if defined(__i386__) || defined(__x86_64__)
 /* include/asm-i386/bitops.h */
 /*
  * ffz = Find First Zero in word. Undefined if no zero exists,
@@ -250,6 +251,66 @@ ffz (unsigned long word)
 :         "r" (~word));
   return word;
 }
+
+#elif defined(__ia64__)
+
+typedef unsigned long __u64;
+
+#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+# define ia64_popcnt(x) __builtin_popcountl(x)
+#else
+# define ia64_popcnt(x)                                     \
+  ({                                                        \
+    __u64 ia64_intri_res;                                   \
+    asm ("popcnt %0=%1" : "=r" (ia64_intri_res) : "r" (x)); \
+    ia64_intri_res;                                         \
+  })
+#endif
+
+static __inline__ unsigned long
+ffz (unsigned long word)
+{
+  unsigned long result;
+
+  result = ia64_popcnt(word & (~word - 1));
+  return result;
+}
+
+#elif defined(__powerpc__)
+
+static __inline__ int
+__ilog2(unsigned long x)
+{
+  int lz;
+
+  asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (x));
+  return BITS_PER_LONG - 1 - lz;
+}
+
+static __inline__ unsigned long
+ffz (unsigned long word)
+{
+  if ((word = ~word) == 0)
+    return BITS_PER_LONG;
+  return __ilog2(word & -word);
+}
+
+#else /* Unoptimized */
+
+static __inline__ unsigned long
+ffz (unsigned long word)
+{
+  unsigned long result;
+
+  result = 0;
+  while(word & 1)
+    {
+      result++;
+      word >>= 1;
+    }
+  return result;
+}
+#endif
 
 /* check filesystem types and read superblock into memory buffer */
 int
diff -r d108efc94de7 -r 825be74657c3 tools/libfsimage/reiserfs/fsys_reiserfs.c
--- a/tools/libfsimage/reiserfs/fsys_reiserfs.c Sat Nov 11 01:23:11 2006 +0000
+++ b/tools/libfsimage/reiserfs/fsys_reiserfs.c Sat Nov 11 01:25:00 2006 +0000
@@ -363,6 +363,8 @@ struct fsys_reiser_info
 #define JOURNAL_START    ((__u32 *) (INFO + 1))
 #define JOURNAL_END      ((__u32 *) (FSYS_BUF + FSYS_BUFLEN))
 
+#if defined(__i386__) || defined(__x86_64__)
+
 #ifdef __amd64
 #define BSF "bsfq"
 #else
@@ -376,6 +378,61 @@ grub_log2 (unsigned long word)
           : "r" (word));
   return word;
 }
+
+#elif defined(__ia64__)
+
+#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+# define ia64_popcnt(x) __builtin_popcountl(x)
+#else
+# define ia64_popcnt(x)                                     \
+  ({                                                        \
+    __u64 ia64_intri_res;                                   \
+    asm ("popcnt %0=%1" : "=r" (ia64_intri_res) : "r" (x)); \
+    ia64_intri_res;                                         \
+  })
+#endif
+
+static __inline__ unsigned long
+grub_log2 (unsigned long word)
+{
+  unsigned long result;
+
+  result = ia64_popcnt((word - 1) & ~word);
+  return result;
+}
+
+#elif defined(__powerpc__)
+
+static __inline__ int
+__ilog2(unsigned long x)
+{
+  int lz;
+
+  asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (x));
+  return BITS_PER_LONG - 1 - lz;
+}
+
+static __inline__ unsigned long
+grub_log2 (unsigned long word)
+{
+  return __ilog2(word & -word);
+}
+
+#else /* Unoptimized */
+
+static __inline__ unsigned long
+grub_log2 (unsigned long word)
+{
+  unsigned long result = 0;
+
+  while (!(word & 1UL))
+    {
+      result++;
+      word >>= 1;
+    }
+  return result;
+}
+#endif
 #define log2 grub_log2
 
 static __inline__ int

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [LIBFS] IA64 & PPC aren't making use of this right now, but it's silly to, Xen patchbot-unstable <=