]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
<sys/platform/x86.h>: Add Intel LAM support
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 22 Dec 2020 03:56:10 +0000 (19:56 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 22 Dec 2020 11:45:47 +0000 (03:45 -0800)
Add Intel Linear Address Masking (LAM) support to <sys/platform/x86.h>.
HAS_CPU_FEATURE (LAM) can be used to detect if LAM is enabled in CPU.

LAM modifies the checking that is applied to 64-bit linear addresses,
allowing software to use of the untranslated address bits for metadata.

manual/platform.texi
sysdeps/x86/sys/platform/x86.h
sysdeps/x86/tst-get-cpu-features.c

index 8fec2933d6442823ff78caa58575b9b7ec321d7a..b67683aeb3c735c12d6080a3dec622486e34027a 100644 (file)
@@ -377,6 +377,9 @@ the indirect branch predictor barrier (IBPB).
 @item
 @code{KL} -- AES Key Locker instructions.
 
+@item
+@code{LAM} -- Linear Address Masking.
+
 @item
 @code{L1D_FLUSH} -- IA32_FLUSH_CMD MSR.
 
index 3ef92b04e811e78c950be0ae0ac3a39673c57f1b..99d8c9b0ab0e2921b60b33ea72f566f3faaee4c9 100644 (file)
@@ -317,6 +317,7 @@ extern const struct cpu_features *__x86_get_cpu_features (unsigned int)
 #define bit_cpu_FSRS           (1u << 11)
 #define bit_cpu_FSRCS          (1u << 12)
 #define bit_cpu_HRESET         (1u << 22)
+#define bit_cpu_LAM            (1u << 26)
 
 /* COMMON_CPUID_INDEX_19.  */
 
@@ -541,6 +542,7 @@ extern const struct cpu_features *__x86_get_cpu_features (unsigned int)
 #define index_cpu_FSRS         COMMON_CPUID_INDEX_7_ECX_1
 #define index_cpu_FSRCS                COMMON_CPUID_INDEX_7_ECX_1
 #define index_cpu_HRESET       COMMON_CPUID_INDEX_7_ECX_1
+#define index_cpu_LAM          COMMON_CPUID_INDEX_7_ECX_1
 
 /* COMMON_CPUID_INDEX_19.  */
 
@@ -765,6 +767,7 @@ extern const struct cpu_features *__x86_get_cpu_features (unsigned int)
 #define reg_FSRS               eax
 #define reg_FSRCS              eax
 #define reg_HRESET             eax
+#define reg_LAM                        eax
 
 /* COMMON_CPUID_INDEX_19.  */
 
index 667aa27117a620a7cad356629ecae9f2e1ea8596..6f1e925a6ac9bbf041740690aed9a93c78f8e09c 100644 (file)
@@ -227,6 +227,7 @@ do_test (void)
   CHECK_CPU_FEATURE (FSRS);
   CHECK_CPU_FEATURE (FSRCS);
   CHECK_CPU_FEATURE (HRESET);
+  CHECK_CPU_FEATURE (LAM);
   CHECK_CPU_FEATURE (AESKLE);
   CHECK_CPU_FEATURE (WIDE_KL);