aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils/cpu_feature.h
blob: d7300a30a683e947ef7f5b2bbe4156fb089cd89f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * Copyright (C) 2015 Martin Willi
 * Copyright (C) 2015 revosec AG
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */

/**
 * @defgroup cpu_feature cpu_feature
 * @{ @ingroup utils
 */

#ifndef CPU_FEATURE_H_
#define CPU_FEATURE_H_

#include <library.h>

typedef enum {
	/** x86/x64 extensions */
	CPU_FEATURE_MMX =							(1 <<  0),
	CPU_FEATURE_SSE =							(1 <<  1),
	CPU_FEATURE_SSE2 =							(1 <<  2),
	CPU_FEATURE_SSE3 =							(1 <<  3),
	CPU_FEATURE_SSSE3 =							(1 <<  4),
	CPU_FEATURE_SSE41 =							(1 <<  5),
	CPU_FEATURE_SSE42 =							(1 <<  6),
	CPU_FEATURE_AVX =							(1 <<  7),
	CPU_FEATURE_RDRAND =						(1 <<  8),
	CPU_FEATURE_AESNI =							(1 <<  9),
	CPU_FEATURE_PCLMULQDQ =						(1 << 10),
} cpu_feature_t;

/**
 * Get a bitmask for all supported CPU features
 */
cpu_feature_t cpu_feature_get_all();

/**
 * Check if a given set of CPU features is available.
 */
bool cpu_feature_available(cpu_feature_t feature);

#endif /** CPU_FEATURE_H_ @}*/