]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/crc32c: skip cpu detection incantation on not x86_64
authorSage Weil <sage@inktank.com>
Sat, 6 Jul 2013 00:21:06 +0000 (17:21 -0700)
committerSage Weil <sage@inktank.com>
Mon, 8 Jul 2013 17:54:53 +0000 (10:54 -0700)
On i386 this fails to build with

common/crc32c-intel.c: In function 'ceph_have_crc32c_intel':
error: common/crc32c-intel.c:79:9: PIC register clobbered by 'ebx' in 'asm'

ARM had more to complain about.

Not sure where this test came from, but it is clearly not meant for
anything other than x86_64.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
src/common/crc32c-intel.c

index 4c3456466637d7ec1c48af70f15ac56ad22f5d11..1c4689e3b76818149292ffa97dc25a9a9c9ba448 100644 (file)
@@ -5,6 +5,11 @@
 #include <signal.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+
+
+/* this probably isn't specific enough for x86_64?  fix me someday */
+#ifdef __LP64__
+
 /*
  *  * Based on a posting to lkml by Austin Zhang <austin.zhang@intel.com>
  *   * Further based on the fio crc32c-intel.c implementation by Jens Axboe.
  *          * Volume 2A: Instruction Set Reference, A-M
  *           */
 
-int crc32c_intel_available = 0;
-
-/* TODO: Need some kind of ifdef here for arch... */
-
 #if BITS_PER_LONG == 64
 #define REX_PRE "0x48, "
 #define SCALE_F 8
@@ -89,12 +90,24 @@ static void do_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx,
 
 int ceph_have_crc32c_intel(void)
 {
-       unsigned int eax, ebx, ecx, edx;
-
-       eax = 1;
-
+       /* i know how to check this on x86_64... */
+       unsigned int eax = 1, ebx, ecx, edx;
        do_cpuid(&eax, &ebx, &ecx, &edx);
        if ((ecx & (1 << 20)) != 0)
                return 1;
        return 0;
 }
+
+#else /* __LP64__ */
+
+uint32_t ceph_crc32c_le_intel(uint32_t crc, unsigned char const *data, unsigned length)
+{
+       return 0;  /* this shouldn't get called! */
+}
+
+int ceph_have_crc32c_intel(void)
+{
+       return 0;       /* clearly not x86_64 */
+}
+
+#endif