Skip to content

[x86] System DEFs for some x86 CPU features

Summary

This merge request builds on the features of !485 (merged) that requires a compile-side indication of whether the BSWAP instruction is supported (only present on the 486 and later, not the original 386). Three flags are introduced:

  • CPUX86_HAS_BSWAP - the BSWAP instruction is available (486 and later). Always defined for x86_64 (although the code still checks to see if the feature flag is set).
  • CPUX86_HAS_CMOV - the CMOV family of instructions are available (Pentium II and later). Always defined for x86_64 (although the code still checks to see if the feature flag is set).
  • CPUX86_HAS_MOVBE - the MOVBE instruction is available (AMD Jaguar and later, and Intel Core AVX2 and later). Not available under i8086 since support for the AMD Jaguar and Intel Core processors does not stretch that far.

System

  • Processor architecture: i8086, i386, x86_64

What is the current bug behavior?

The new i386 assembly language procedure for SHA1Transform is not actually used because defined(CPUX86_HAS_BSWAP) always returns false (unless CPUX86_HAS_BSWAP is manually defined).

What is the behavior after applying this patch?

The assembly language version of SHA1Transform should now be used under i386 when default CPU settings are used (Pentium II), but will safely fall back to the Pascal version under pure i386 without the risk of a SIGILL when run on a pure 386 processor.

Edited by J. Gareth "Kit" Moreton

Merge request reports