V10 [PATCH] x86: Support usable check for all CPU features

H.J. Lu hjl.tools@gmail.com
Mon Jul 13 12:40:54 GMT 2020


On Mon, Jul 13, 2020 at 4:19 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu:
>
> > EDX are checked.  Did you mean EAX/EBX from INDEX_1 and EAX from INDEX_7?
> > They aren't used for CPU feature detection.
>
> Could they be used in the future?  Then we should clear the usable view
> of this.
>
> Apart from this, I have no further comments.
>

Here is the updated patch with this change, which I am checking in:

diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index ec150761a9..4c24ba7c31 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -79,6 +79,12 @@ update_usable (struct cpu_features *cpu_features)
   CPU_FEATURE_UNSET (cpu_features, INDEX_7_EDX_21);
   CPU_FEATURE_UNSET (cpu_features, INDEX_7_EDX_23);

+  /* EAX/EBX from COMMON_CPUID_INDEX_1 and EAX from COMMON_CPUID_INDEX_7
+     aren't used for CPU feature detection.  */
+  cpu_features->features[COMMON_CPUID_INDEX_1].usable.eax = 0;
+  cpu_features->features[COMMON_CPUID_INDEX_1].usable.ebx = 0;
+  cpu_features->features[COMMON_CPUID_INDEX_7].usable.eax = 0;
+
   /* Starting from COMMON_CPUID_INDEX_80000001, copy the cpuid bits to
      usable bits.  */
   CPU_FEATURE_SET_USABLE (cpu_features, LAHF64_SAHF64);

Thanks.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-Support-usable-check-for-all-CPU-features.patch
Type: text/x-patch
Size: 155175 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20200713/1c0e81ff/attachment-0001.bin>


More information about the Libc-alpha mailing list