Previous: , Up: Platform-specific facilities   [Contents][Index]


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 HAS_CPU_FEATURE (name)

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

Macro: int CPU_FEATURE_USABLE (name)

This macro returns a nonzero value (true) if the processor has the feature name and the feature is supported by the operating system.

The supported processor features are:

You could query if a processor supports AVX with:

#include <sys/platform/x86.h>

int
support_avx (void)
{
  return HAS_CPU_FEATURE (AVX);
}

and if AVX is usable with:

#include <sys/platform/x86.h>

int
usable_avx (void)
{
  return CPU_FEATURE_USABLE (AVX);
}

Previous: RISC-V-specific Facilities, Up: Platform-specific facilities   [Contents][Index]