aboutsummaryrefslogtreecommitdiff
path: root/sys/libkern/crc32.c
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2017-09-22 12:45:15 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2017-09-22 12:45:15 +0000
commit75e3597abbcde25f749973d4af9e8419b47e9f37 (patch)
tree4c695261bd72057048524953f67f8647ef8e0319 /sys/libkern/crc32.c
parentaeb9ac0df5d5f0bfe073f4111e47ba0a3c77c948 (diff)
Notes
Diffstat (limited to 'sys/libkern/crc32.c')
-rw-r--r--sys/libkern/crc32.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/libkern/crc32.c b/sys/libkern/crc32.c
index 7eaacd454661..149de3de6dee 100644
--- a/sys/libkern/crc32.c
+++ b/sys/libkern/crc32.c
@@ -46,6 +46,8 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+
+#ifdef _KERNEL
#include <sys/libkern.h>
#include <sys/systm.h>
@@ -57,6 +59,7 @@ __FBSDID("$FreeBSD$");
#if defined(__aarch64__)
#include <machine/cpu.h>
#endif
+#endif /* _KERNEL */
const uint32_t crc32_tab[] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
@@ -759,6 +762,7 @@ calculate_crc32c(uint32_t crc32c,
const unsigned char *buffer,
unsigned int length)
{
+#ifdef _KERNEL
#if defined(__amd64__) || defined(__i386__)
if ((cpu_feature2 & CPUID2_SSE42) != 0) {
return (sse42_crc32c(crc32c, buffer, length));
@@ -776,6 +780,7 @@ calculate_crc32c(uint32_t crc32c,
return (armv8_crc32c(crc32c, buffer, length));
} else
#endif
+#endif /* _KERNEL */
if (length < 4) {
return (singletable_crc32c(crc32c, buffer, length));
} else {