Use cpuid intrinsics instead of asm code #10820

pull sipa wants to merge 2 commits into bitcoin:master from sipa:20170717_cpuid changing 1 files +7 −12
  1. sipa commented at 11:43 PM on July 13, 2017: member

    Less platform-specific code is better.

  2. Use cpuid intrinsics instead of asm code a9e82f6512
  3. laanwj commented at 7:15 AM on July 14, 2017: member

    Let's see if this works on all platforms...

    It builds on OpenBSD at least! Keeping #10670 in mind that probably means it will work on anything.

  4. laanwj added the label Refactoring on Jul 14, 2017
  5. in src/random.cpp:80 in a9e82f6512 outdated
      86 | -    __asm__ ("cpuid": "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "a"(1));
      87 | -#endif
      88 | -    //! When calling cpuid function #1, ecx register will have this set if RDRAND is available.
      89 | -    if (ecx & CPUID_F1_ECX_RDRAND) {
      90 | +    uint32_t eax, ebx, ecx, edx;
      91 | +    if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) && (ecx & CPUID_F1_ECX_RDRAND)) {
    


    laanwj commented at 7:17 AM on July 14, 2017:

    Definitely an improvement...

  6. Clarify entropy source 674848fe1c
  7. TheBlueMatt commented at 10:52 PM on July 14, 2017: member

    ACK 674848fe1c43fb88870cf5ba16fca4e2524da793 (I didnt actually test on other platforms, so I'm just kinda assuming they support this stuff).

  8. gmaxwell approved
  9. gmaxwell commented at 1:43 PM on July 16, 2017: contributor

    ACK.

  10. sipa merged this on Jul 16, 2017
  11. sipa closed this on Jul 16, 2017

  12. sipa referenced this in commit ef37f2033c on Jul 16, 2017
  13. PastaPastaPasta referenced this in commit 80e57d5ee2 on Jul 6, 2019
  14. PastaPastaPasta referenced this in commit 16a223f90e on Jul 8, 2019
  15. PastaPastaPasta referenced this in commit c687a28c94 on Jul 9, 2019
  16. PastaPastaPasta referenced this in commit 9053161e8f on Jul 11, 2019
  17. PastaPastaPasta referenced this in commit 0962b9520a on Jul 13, 2019
  18. PastaPastaPasta referenced this in commit b46154d5b9 on Jul 13, 2019
  19. PastaPastaPasta referenced this in commit cc9a0a8e10 on Jul 17, 2019
  20. PastaPastaPasta referenced this in commit dc9709c1c8 on Jul 17, 2019
  21. PastaPastaPasta referenced this in commit 6d856aeb43 on Jul 18, 2019
  22. barrystyle referenced this in commit 19ddbd028c on Jan 22, 2020
  23. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 09:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me