aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
diff options
context:
space:
mode:
authorAlex Richardson <arichardson@FreeBSD.org>2021-02-02 09:52:52 +0000
committerAlex Richardson <arichardson@FreeBSD.org>2021-02-02 09:53:39 +0000
commit83c20b8a2da04937cf4af127366b3dc92c855784 (patch)
tree58182915f7e11feb7dc6d7d8518fd6e79035db48 /sys/sys
parentc69047ca7526090cc2aa92c57d9f21a77a82fc2e (diff)
downloadsrc-83c20b8a2da04937cf4af127366b3dc92c855784.tar.gz
src-83c20b8a2da04937cf4af127366b3dc92c855784.zip
tests/sys/kern/crc32: Check for SSE4.2 before using it
This avoids a SIGILL when running these tests on QEMU (which defaults to a basic amd64 CPU without SSE4.2). This commit also tests the table-based implementations in addition to testing the hw-accelerated crc32 versions. Reviewed By: cem, kib, markj Differential Revision: https://reviews.freebsd.org/D28395
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/gsb_crc32.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/sys/gsb_crc32.h b/sys/sys/gsb_crc32.h
index c5a42d3d3152..dc126a5258fb 100644
--- a/sys/sys/gsb_crc32.h
+++ b/sys/sys/gsb_crc32.h
@@ -32,10 +32,10 @@ crc32(const void *buf, size_t size)
crc = crc32_raw(buf, size, ~0U);
return (crc ^ ~0U);
}
+#endif
uint32_t calculate_crc32c(uint32_t crc32c, const unsigned char *buffer,
unsigned int length);
-#endif
#if defined(__amd64__) || defined(__i386__)
uint32_t sse42_crc32c(uint32_t, const unsigned char *, unsigned);
@@ -44,4 +44,9 @@ uint32_t sse42_crc32c(uint32_t, const unsigned char *, unsigned);
uint32_t armv8_crc32c(uint32_t, const unsigned char *, unsigned int);
#endif
+#ifdef TESTING
+uint32_t singletable_crc32c(uint32_t, const void *, size_t);
+uint32_t multitable_crc32c(uint32_t, const void *, size_t);
+#endif
+
#endif /* !_SYS_GSB_CRC32_H_ */