On Mon, May 20, 2019 at 2:57 PM Uros Bizjak <ubiz...@gmail.com> wrote:
>
> On Mon, May 20, 2019 at 6:12 PM tedheadster <tedheads...@gmail.com> wrote:
> > Did you instead mean "zeroing %EBX and %ECX regs should be enough"?
>
> Ah, yes. This is what I meant to say. The patch clears %ebx and %ecx.
>

Uros,
  your patch worked on real 32-bit hardware. The assembly output is
nearly identical to mine, with merely a re-ordering when setting the
%eax, %ebx, and %ecx registers.

But of course your code does not compile into x86_64 systems (nice touch).

 test   $0x200000,%eax
 je     0xb7e214c0 <rdrand+128>
 xor    %edi,%edi <--- zero for use below
 mov    %edi,%eax
 cpuid
 test   %eax,%eax
 je     0xb7e214c0 <rdrand+128>
 mov    $0x1,%eax
 mov    %edi,%ebx <--- zero register
 mov    %edi,%ecx <--- zero register
 cpuid

If this is accepted upstream, can we please get it backported to some
of the major releases: 8.2.0, 7.3.0, 6.4.0 and 5.4.0?

- Matthew

Reply via email to