aboutsummaryrefslogtreecommitdiffstats
path: root/main/qemu/qemu-170-ffsl.patch
blob: 5da3d07eefea395aa3464772b256e8b38310ab06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--- qemu-1.7.0.org/kvm-all.c
+++ qemu-1.7.0/kvm-all.c
@@ -374,6 +374,19 @@
     return 0;
 }
 
+#ifndef HAVE_FFSL
+#include <limits.h>
+#if ULONG_MAX == UINT_MAX
+#define ffsl(X) ffs(X)
+#else
+static int ffsl(long i) {
+    unsigned long x = i & -i;
+    if (x <= 0xffffffff) return ffs (i);
+    else return 32 + ffs (i >> 32);
+}
+#endif
+#endif
+
 /* get kvm's dirty pages bitmap and update qemu's */
 static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
                                          unsigned long *bitmap)