FreeBSD kernel libkern code
crc32_sse42.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/gsb_crc32.h>
Include dependency graph for crc32_sse42.c:

Go to the source code of this file.

Macros

#define POLY   0x82f63b78
 
#define LONG   128
 
#define SHORT   64
 

Functions

 __FBSDID ("$FreeBSD$")
 
static __inline uint32_t _mm_crc32_u8 (uint32_t x, uint8_t y)
 
static __inline uint32_t _mm_crc32_u32 (uint32_t x, uint32_t y)
 
static uint32_t gf2_matrix_times (uint32_t *mat, uint32_t vec)
 
static void gf2_matrix_square (uint32_t *square, uint32_t *mat)
 
static void crc32c_zeros_op (uint32_t *even, size_t len)
 
static void crc32c_zeros (uint32_t zeros[][256], size_t len)
 
static uint32_t crc32c_shift (uint32_t zeros[][256], uint32_t crc)
 
static void crc32c_init_hw (void)
 
 SYSINIT (crc32c_sse42, SI_SUB_LOCK, SI_ORDER_ANY, crc32c_init_hw, NULL)
 
uint32_t sse42_crc32c (uint32_t crc, const unsigned char *buf, unsigned len)
 

Variables

static uint32_t crc32c_long [4][256]
 
static uint32_t crc32c_2long [4][256]
 
static uint32_t crc32c_short [4][256]
 
static uint32_t crc32c_2short [4][256]
 

Macro Definition Documentation

◆ LONG

#define LONG   128

Definition at line 78 of file crc32_sse42.c.

◆ POLY

#define POLY   0x82f63b78

Definition at line 72 of file crc32_sse42.c.

◆ SHORT

#define SHORT   64

Definition at line 79 of file crc32_sse42.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ _mm_crc32_u32()

static __inline uint32_t _mm_crc32_u32 ( uint32_t  x,
uint32_t  y 
)
static

Definition at line 64 of file crc32_sse42.c.

Referenced by sse42_crc32c().

Here is the caller graph for this function:

◆ _mm_crc32_u8()

static __inline uint32_t _mm_crc32_u8 ( uint32_t  x,
uint8_t  y 
)
static

Definition at line 42 of file crc32_sse42.c.

Referenced by sse42_crc32c().

Here is the caller graph for this function:

◆ crc32c_init_hw()

static void crc32c_init_hw ( void  )
static

Definition at line 205 of file crc32_sse42.c.

References crc32c_2long, crc32c_2short, crc32c_long, crc32c_short, crc32c_zeros(), LONG, and SHORT.

Here is the call graph for this function:

◆ crc32c_shift()

static uint32_t crc32c_shift ( uint32_t  zeros[][256],
uint32_t  crc 
)
inlinestatic

Definition at line 193 of file crc32_sse42.c.

Referenced by sse42_crc32c().

Here is the caller graph for this function:

◆ crc32c_zeros()

static void crc32c_zeros ( uint32_t  zeros[][256],
size_t  len 
)
static

Definition at line 177 of file crc32_sse42.c.

References crc32c_zeros_op(), and gf2_matrix_times().

Referenced by crc32c_init_hw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ crc32c_zeros_op()

static void crc32c_zeros_op ( uint32_t *  even,
size_t  len 
)
static

Definition at line 133 of file crc32_sse42.c.

References gf2_matrix_square(), and POLY.

Referenced by crc32c_zeros().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gf2_matrix_square()

static void gf2_matrix_square ( uint32_t *  square,
uint32_t *  mat 
)
inlinestatic

Definition at line 117 of file crc32_sse42.c.

References gf2_matrix_times().

Referenced by crc32c_zeros_op().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gf2_matrix_times()

static uint32_t gf2_matrix_times ( uint32_t *  mat,
uint32_t  vec 
)
inlinestatic

Definition at line 98 of file crc32_sse42.c.

Referenced by crc32c_zeros(), and gf2_matrix_square().

Here is the caller graph for this function:

◆ sse42_crc32c()

uint32_t sse42_crc32c ( uint32_t  crc,
const unsigned char *  buf,
unsigned  len 
)

Definition at line 218 of file crc32_sse42.c.

References _mm_crc32_u32(), _mm_crc32_u8(), crc32c_2long, crc32c_2short, crc32c_long, crc32c_shift(), crc32c_short, LONG, and SHORT.

Here is the call graph for this function:

◆ SYSINIT()

SYSINIT ( crc32c_sse42  ,
SI_SUB_LOCK  ,
SI_ORDER_ANY  ,
crc32c_init_hw  ,
NULL   
)

Variable Documentation

◆ crc32c_2long

uint32_t crc32c_2long[4][256]
static

Definition at line 87 of file crc32_sse42.c.

Referenced by crc32c_init_hw(), and sse42_crc32c().

◆ crc32c_2short

uint32_t crc32c_2short[4][256]
static

Definition at line 89 of file crc32_sse42.c.

Referenced by crc32c_init_hw(), and sse42_crc32c().

◆ crc32c_long

uint32_t crc32c_long[4][256]
static

Definition at line 86 of file crc32_sse42.c.

Referenced by crc32c_init_hw(), and sse42_crc32c().

◆ crc32c_short

uint32_t crc32c_short[4][256]
static

Definition at line 88 of file crc32_sse42.c.

Referenced by crc32c_init_hw(), and sse42_crc32c().