HomeWildfire Games

Fix cpuid call with -fPIC on i386 architectures.


Fix cpuid call with -fPIC on i386 architectures.

GCC < 5 used to reserve the ebx register for PIC (position-independent code) metadata. This meant that we needed to save the state of ebx before calling cpuid (fixed in #2675)
However, the original patch from r15886 did not force a particular register to store this value in. Following the GCC 5 upgrade, GCC stopped reserving ebx, and that register silently got used instead. The code became non-sensical, and our ASM __cpuidex started returning random garbage in edx.

Since we now only support GCC7 and above, the PIC-specific branch is no longer necessary and is removed.

Fixes #6028. The assertion was a result of random data in ebx.
Refs #2675 / reverts rP15890 and reverts rP15886.

Patch by: nwtour

Comments by: vladislavbelov

Differential Revision: https://code.wildfiregames.com/D3575