]> git.pld-linux.org Git - packages/fio.git/blame - fio-crc32c-intel.patch
- 1.44.1
[packages/fio.git] / fio-crc32c-intel.patch
CommitLineData
317d3296 1--- fio-1.41.6/crc/crc32c-intel.c 2010-07-09 13:48:14.000000000 +0200
2+++ fio-1.41.4/crc/crc32c-intel.c 2010-06-24 10:39:02.000000000 +0200
3@@ -74,30 +74,37 @@
4 return crc;
5 }
6
7-static void do_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx,
8- unsigned int *edx)
9+static void sig_ill(int sig)
10 {
11- int id = *eax;
12-
13- asm("movl %4, %%eax;"
14- "cpuid;"
15- "movl %%eax, %0;"
16- "movl %%ebx, %1;"
17- "movl %%ecx, %2;"
18- "movl %%edx, %3;"
19- : "=r" (*eax), "=r" (*ebx), "=r" (*ecx), "=r" (*edx)
20- : "r" (id)
21- : "eax", "ebx", "ecx", "edx");
22 }
23
24-int crc32c_intel_works(void)
25+static void crc32c_test(void)
26 {
27- unsigned int eax, ebx, ecx, edx;
28+ unsigned char buf[4] = { 1, 2, 3, 4 };
29+ struct sigaction act;
30+
31+ /*
32+ * Check if hw accelerated crc32c is available
33+ */
34+ memset(&act, 0, sizeof(act));
35+ act.sa_handler = sig_ill;
36+ act.sa_flags = SA_RESETHAND;
37+ sigaction(SIGILL, &act, NULL);
38
39- eax = 1;
40+ (void) crc32c_intel(buf, sizeof(buf));
41+}
42
43- do_cpuid(&eax, &ebx, &ecx, &edx);
44- return (ecx & (1 << 20)) != 0;
45+int crc32c_intel_works(void)
46+{
47+ if (!fork()) {
48+ crc32c_test();
49+ exit(0);
50+ } else {
51+ int status;
52+
53+ wait(&status);
54+ return !WIFSIGNALED(status);
55+ }
56 }
57
58 #endif /* ARCH_HAVE_SSE */
This page took 0.068503 seconds and 4 git commands to generate.