6#include "mos/platform/platform_defs.h"
13#define do_static_assert(feat) MOS_STATIC_ASSERT(X86_CPUID_LEAF_ENUM(feat) >= 0);
14#define test_ensure_all_leaves_are_supported(feature) do_static_assert(CPU_FEATURE_##feature)
16#undef test_ensure_all_leaves_are_supported
17#undef do_static_assert
25#define impl_fill_leaf(_l, _sl, _r) cpuinfo->cpuid[X86_CPUID_LEAF_ENUM(_l, _sl, _r, _)] = x86_cpuid(_r, _l, _sl);
39 pr_dinfo2(x86_startup,
"setting up xsave area...");
51 size_t xsave_size = 512;
61 static const char *
const xcr0_names[] = {
67 [5] =
"AVX-512 OPMASK",
68 [6] =
"AVX-512 ZMM0-15",
69 [7] =
"AVX-512 ZMM16-31",
74 for (
size_t state_component = 2; state_component < 64; state_component++)
77 __cpuid_count(0xd, state_component,
size, offset, ecx, edx);
78 if (
size && offset && ((ecx &
BIT(0)) == 0))
80 const char *
const name = state_component <
MOS_ARRAY_SIZE(xcr0_names) ? xcr0_names[state_component] :
"<unknown>";
81 pr_dinfo2(x86_startup,
"XSAVE state component '%s': size=%d, offset=%d",
name,
size, offset);
83 if (xcr0 &
BIT(state_component))
91 pr_dinfo2(x86_startup,
"XSAVE area size: %zu", xsave_size);
93 __asm__
volatile(
"xsetbv" : :
"c"(0),
"a"(xcr0),
"d"(xcr0 >> 32));
#define MOS_ASSERT_X(cond, msg,...)
void x86_cpu_initialise_caps(void)
#define test_ensure_all_leaves_are_supported(feature)
void x86_cpu_setup_xsave_area(void)
#define impl_fill_leaf(_l, _sl, _r)
#define FOR_ALL_CPU_FEATURES(M)
#define CPU_FEATURE_XSAVE
#define cpu_has_feature(feat)
#define CPU_FEATURE_FSGSBASE
#define FOR_ALL_SUPPORTED_CPUID_LEAF(M)
#define MOS_ARRAY_SIZE(x)
#define pr_dcont(feat, fmt,...)
#define pr_dinfo2(feat, fmt,...)
#define memzero(ptr, size)
#define x86_cpu_get_cr4()
#define x86_cpu_get_cr0()
#define x86_cpu_set_cr4(val)
#define x86_cpu_set_cr0(val)