aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/x86/cpu-features.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-09-15 05:49:27 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-09-16 05:56:10 -0700
commitf2c679d4b2c73a95f437c705f960a4af1fa23498 (patch)
tree1f30bd0a05a25caa79dda87c9330fb7c6de901bd /sysdeps/x86/cpu-features.c
parenta140ff9162f353e804d6a8c83c8f3c18511850dd (diff)
downloadglibc-f2c679d4b2c73a95f437c705f960a4af1fa23498.zip
glibc-f2c679d4b2c73a95f437c705f960a4af1fa23498.tar.gz
glibc-f2c679d4b2c73a95f437c705f960a4af1fa23498.tar.bz2
<sys/platform/x86.h>: Add Intel Key Locker support
Add Intel Key Locker: https://software.intel.com/content/www/us/en/develop/download/intel-key-locker-specification.html support to <sys/platform/x86.h>. Intel Key Locker has 1. KL: AES Key Locker instructions. 2. WIDE_KL: AES wide Key Locker instructions. 3. AESKLE: AES Key Locker instructions are enabled by OS. Applications should use if (CPU_FEATURE_USABLE (KL)) and if (CPU_FEATURE_USABLE (WIDE_KL)) to check if AES Key Locker instructions and AES wide Key Locker instructions are usable.
Diffstat (limited to 'sysdeps/x86/cpu-features.c')
-rw-r--r--sysdeps/x86/cpu-features.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index b0ded20..a9945b9 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -269,6 +269,14 @@ update_usable (struct cpu_features *cpu_features)
/* Determine if PKU is usable. */
if (CPU_FEATURES_CPU_P (cpu_features, OSPKE))
CPU_FEATURE_SET (cpu_features, PKU);
+
+ /* Determine if Key Locker instructions are usable. */
+ if (CPU_FEATURES_CPU_P (cpu_features, AESKLE))
+ {
+ CPU_FEATURE_SET (cpu_features, AESKLE);
+ CPU_FEATURE_SET_USABLE (cpu_features, KL);
+ CPU_FEATURE_SET_USABLE (cpu_features, WIDE_KL);
+ }
}
static void
@@ -341,6 +349,12 @@ get_common_indices (struct cpu_features *cpu_features,
cpu_features->features[COMMON_CPUID_INDEX_D_ECX_1].cpuid.ecx,
cpu_features->features[COMMON_CPUID_INDEX_D_ECX_1].cpuid.edx);
+ if (cpu_features->basic.max_cpuid >= 0x19)
+ __cpuid_count (0x19, 0,
+ cpu_features->features[COMMON_CPUID_INDEX_19].cpuid.eax,
+ cpu_features->features[COMMON_CPUID_INDEX_19].cpuid.ebx,
+ cpu_features->features[COMMON_CPUID_INDEX_19].cpuid.ecx,
+ cpu_features->features[COMMON_CPUID_INDEX_19].cpuid.edx);
}
_Static_assert (((index_arch_Fast_Unaligned_Load