E.3 X86-specific Facilities

Facilities specific to X86 that are not specific to a particular operating system are declared in sys/platform/x86.h.

Function: const struct cpuid_feature * __x86_get_cpuid_feature_leaf (unsigned int leaf)

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

Return a pointer to x86 CPU feature structure used by query macros for x86 CPU feature leaf.

Macro: int CPU_FEATURE_PRESENT (name)

This macro returns a nonzero value (true) if the processor has the feature name.

Macro: int CPU_FEATURE_ACTIVE (name)

This macro returns a nonzero value (true) if the processor has the feature name and the feature is active. There may be other preconditions, like sufficient stack space or further setup for AMX, which must be satisfied before the feature can be used.

The supported processor features are:

You could query if a processor supports AVX with:

#include <sys/platform/x86.h>

int
avx_present (void)
{
  return CPU_FEATURE_PRESENT (AVX);
}

and if AVX is active and may be used with:

#include <sys/platform/x86.h>

int
avx_active (void)
{
  return CPU_FEATURE_ACTIVE (AVX);
}