Vendor Unique iSCSI CRC32C
August 2016 Data Integrity Validation 257
/********************/
#if defined(__sparc)
#include <sys/auxv.h> /* getisax() */
#include <sys/auxv_SPARC.h> /* crc32c instruction support bit
*/
#include <sys/archsystm.h>
#include <sys/fsr.h>
extern void _t4_crc32c(uint64_t *, uint64_t *, int);
#else
#include <sys/auxv.h> /* getisax() */
#include <sys/auxv_386.h> /* AV_386_SSE4_2 bit */
#endif
/*************************/
/* End Solaris ONLY */
/*************************/
#else
/*************************/
/* Linux ONLY */
/*************************/
typedef u_int8_t uchar_t;
typedef u_int32_t uint32_t;
typedef u_int32_t uint_t;
typedef u_int8_t uint8_t;
typedef u_int64_t uint64_t;
static inline void cpuid(uint_t info[4], uint_t function)
{
__asm__ __volatile__ ("cpuid":
"=a" (info[0]),/* ax */
"=b" (info[1]),/* bx */
"=c" (info[2]),/* cx */
"=d" (info[3]) :/* dx */
"a" (function)
);
}
static int hasSSE42(void)
{
int sse42 = 0;
uint_t info[4];
cpuid(info, 0x000000000);
int ids = info[0];
if (ids >= 1) {
cpuid(info, 0x00000001);
sse42 = (info[2] & ((int)1 << 20)) != 0;
}
return sse42;
}
/*************************/