68 ASM(
"fxsave (%0)" : :
"r"(initCtx));
168 ASM(
"fxrstor (%0)" : :
"r"(ctx->
buffer));
#define SELF
Macro to access data in the current cpu.
#define PERCPU_DEFINE_CTOR(type, name)
Macro to define a percpu variable with a constructor.
void simd_ctx_save(simd_ctx_t *ctx)
void simd_ctx_load(simd_ctx_t *ctx)
uint64_t simd_ctx_init(simd_ctx_t *ctx)
void simd_ctx_deinit(simd_ctx_t *ctx)
#define CPU_ID_BOOTSTRAP
ID of the bootstrap CPU.
#define LOG_INFO(format,...)
#define VIRT_TO_PFN(_addr)
Convert a identity mapped higher half virtual address to its PFN.
#define PFN_TO_VIRT(_pfn)
Convert a PFN to its identity mapped higher half virtual address.
size_t pfn_t
Page Frame Number type.
void pmm_free(pfn_t pfn)
Free a single page of physical memory.
pfn_t pmm_alloc(void)
Allocate a single page of physical memory.
static cpuid_instruction_sets_t cpuid_detect_instruction_sets(void)
Helper to detect supported instruction sets.
static void cpuid_feature_info(cpuid_feature_info_t *info)
Wrapper to get CPU feature information.
cpuid_instruction_sets_t
Supported CPU instruction sets.
static void cpuid_extended_feature_info(cpuid_extended_feature_info_t *info)
Wrapper to get CPU extended feature information.
@ CPUID_INSTRUCTION_SET_SSSE3
@ CPUID_INSTRUCTION_SET_SSE2
@ CPUID_INSTRUCTION_SET_SSE4_2
@ CPUID_INSTRUCTION_SET_SSE3
@ CPUID_INSTRUCTION_SET_AVX512
@ CPUID_INSTRUCTION_SET_AVX
@ CPUID_INSTRUCTION_SET_SSE4_1
@ CPUID_INSTRUCTION_SET_SSE
@ CPUID_INSTRUCTION_SET_AVX2
#define ASM(...)
Inline assembly macro.
#define ALIGNED(alignment)
GCC aligned attribute.
#define ERR
Integer error value.
#define PAGE_SIZE
The size of a memory page in bytes.
#define XCR0_AVX512_ENABLE
static uint64_t cr0_read(void)
#define CR0_NUMERIC_ERROR_ENABLE
#define XCR0_ZMM16_32_ENABLE
#define XCR0_XSAVE_SAVE_SSE
static uint64_t cr4_read(void)
#define XCR0_ZMM0_15_ENABLE
#define CR4_SIMD_EXCEPTION
static void cr4_write(uint64_t value)
#define CR0_MONITOR_CO_PROCESSOR
static void cr0_write(uint64_t value)
static void xcr0_write(uint32_t xcr, uint64_t value)
#define XCR0_XSAVE_SAVE_X87
static void simd_xsave_init(void)
_PUBLIC void * memcpy(void *_RESTRICT s1, const void *_RESTRICT s2, size_t n)
CPU extended feature information structure.
cpuid_ebx_features_t featuresEbx
CPU feature information structure.
cpuid_ecx_features_t featuresEcx