CAPABILITIES(3) Library Functions Manual CAPABILITIES(3)

KS_x86_capabilitiesprocessor capability functions

#include <libks/capabilities.h>

const struct KS_x86_capabilities *
KS_x86_capabilities(void);

The () function reports the capabilities enumerated by the processor. It returns a non-zero pointer while running on x86 hardware and NULL otherwise. The KS_x86_capabilities structure is defined as follows:

struct KS_x86_capabilites {
	enum KS_x86_uarch uarch;
	uint32_t mode;
	uint32_t avx;
	uint32_t bmi;
	uint32_t sse;
	uint32_t lzcnt:1
		 fsgsbase:1;

	struct {
		uint32_t bw;
	} avx512;
};
uarch
Micro architecture. Defaults to KS_X86_UNKNOWN if the processor cannot be identified.
mode
Operating mode, can be either 32 or 64.
avx
Supported AVX version, can be either 0, 1, 2 or 512.
bmi
Supported BMI version, can be either 0, 1 or 2.
sse
Supported SSE version in which the upper nibble denotes the major version and the lower nibble the minor version. Can be either 0x00, 0x10, 0x20, 0x30, 0x41 or 0x42.
lzcnt
Support for the LZCNT instruction, can be either 0 or 1.
fsgsbase
Support for the FSGSBASE instructions, can be either 0 or 1.
avx512.bw
Support for AVX-512 Byte and Word instructions. Can only be non-zero if avx is equal to 512.

Anton Lindqvist <anton@basename.se>

OpenBSD 7.8 July 10, 2025 CAPABILITIES(3)