/* Data structure for x86 CPU features.
Copyright (C) 2020-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#ifndef _PRIVATE_CPU_FEATURES_H
#define _PRIVATE_CPU_FEATURES_H 1
#ifdef _CPU_FEATURES_H
# error this should be impossible
#endif
/* Get data structures without inline functions. */
#define _SYS_PLATFORM_X86_H
#include <bits/platform/x86.h>
enum
{
CPUID_INDEX_MAX = CPUID_INDEX_14_ECX_0 + 1
};
enum
{
/* The integer bit array index for the first set of preferred feature
bits. */
PREFERRED_FEATURE_INDEX_1 = 0,
/* The current maximum size of the feature integer bit array. */
PREFERRED_FEATURE_INDEX_MAX
};
/* Only used directly in cpu-features.c. */
#define CPU_FEATURE_SET(ptr, name) \
ptr->features[index_cpu_##name].active.reg_##name |= bit_cpu_##name;
#define CPU_FEATURE_UNSET(ptr, name) \
ptr->features[index_cpu_##name].active.reg_##name &= ~bit_cpu_##name;
#define CPU_FEATURE_SET_ACTIVE(ptr, name) \
ptr->features[index_cpu_##name].active.reg_##name \
|= ptr->features[index_cpu_##name].cpuid.reg_##name & bit_cpu_##name;
#define CPU_FEATURE_PREFERRED_P(ptr, name) \
((ptr->preferred[index_arch_##name] & bit_arch_##name) != 0)