diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2024-01-10 08:48:47 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2024-01-11 20:35:24 -0800 |
commit | f2b65a44714e8fa13c7637cd9413169590795879 (patch) | |
tree | 8365442e1989ac5f3635013d4e3cfcadaba97b23 /sysdeps/x86/sys | |
parent | db57da5be27a0887ce5131c071e2240f5c17aae1 (diff) | |
download | glibc-f2b65a44714e8fa13c7637cd9413169590795879.tar.gz glibc-f2b65a44714e8fa13c7637cd9413169590795879.tar.xz glibc-f2b65a44714e8fa13c7637cd9413169590795879.zip |
x86-64/cet: Make CET feature check specific to Linux/x86
CET feature bits in TCB, which are Linux specific, are used to check if CET features are active. Move CET feature check to Linux/x86 directory. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
Diffstat (limited to 'sysdeps/x86/sys')
-rw-r--r-- | sysdeps/x86/sys/platform/x86.h | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/sysdeps/x86/sys/platform/x86.h b/sysdeps/x86/sys/platform/x86.h index 4d77c0991d..b8066ccc9f 100644 --- a/sysdeps/x86/sys/platform/x86.h +++ b/sysdeps/x86/sys/platform/x86.h @@ -22,6 +22,7 @@ #include <features.h> #include <stdbool.h> #include <bits/platform/x86.h> +#include <bits/platform/features.h> __BEGIN_DECLS @@ -46,22 +47,8 @@ static __inline__ _Bool x86_cpu_active (unsigned int __index) { if (__index == x86_cpu_IBT || __index == x86_cpu_SHSTK) - { -#ifdef __x86_64__ - unsigned int __feature_1; -# ifdef __LP64__ - __asm__ ("mov %%fs:72, %0" : "=r" (__feature_1)); -# else - __asm__ ("mov %%fs:40, %0" : "=r" (__feature_1)); -# endif - if (__index == x86_cpu_IBT) - return __feature_1 & x86_feature_1_ibt; - else - return __feature_1 & x86_feature_1_shstk; -#else - return false; -#endif - } + return x86_cpu_cet_active (__index); + const struct cpuid_feature *__ptr = __x86_get_cpuid_feature_leaf (__index / (8 * sizeof (unsigned int) * 4)); unsigned int __reg |