[systemd-devel] rdrand generated with march=winchip-c6 in systemd-241

tedheadster tedheadster at gmail.com
Sat May 18 22:40:16 UTC 2019


On Sat, May 18, 2019 at 5:30 PM Segher Boessenkool
<segher at kernel.crashing.org> wrote:

> That won't help, the compiler will remove those dead stores.
>
> Add a
>
>   asm("" ::: "memory");
>
> between these two lines?
>

This didn't seem to do anything:

--- cpuid.h.orig 2019-05-14 05:52:11.000000000 -0400
+++ cpuid.h 2019-05-18 18:20:02.000000000 -0400
@@ -251,6 +251,10 @@
   if (__maxlevel == 0 || __maxlevel < __leaf)
     return 0;

+  asm volatile("" ::: "memory");
+  *__ebx = *__ecx = *__edx = 0;
+  asm volatile("" ::: "memory");
+
   __cpuid (__leaf, *__eax, *__ebx, *__ecx, *__edx);
   return 1;
 }


The code looks unchanged to me:

   0xb7e21491 <+81>: test   $0x200000,%eax
   0xb7e21496 <+86>: je     0xb7e214c0 <rdrand+128>
   0xb7e21498 <+88>: xor    %eax,%eax
   0xb7e2149a <+90>: cpuid
   0xb7e2149c <+92>: test   %eax,%eax
   0xb7e2149e <+94>: je     0xb7e214c0 <rdrand+128>
   0xb7e214a0 <+96>: mov    $0x1,%eax
   0xb7e214a5 <+101>: cpuid
   0xb7e214a7 <+103>: shr    $0x1e,%ecx
   0xb7e214aa <+106>: and    $0x1,%ecx
   0xb7e214ad <+109>: mov    %ecx,0x35a0(%esi)
   0xb7e214b3 <+115>: jmp    0xb7e21457 <rdrand+23>

Other ideas?

- Matthew


More information about the systemd-devel mailing list