Incorrect detection of MMX support in Intel Family 5 CPU's

Erwin Bronkhorst erwinbronkhorst at gmail.com
Sun Jan 7 18:13:01 UTC 2018


Hi,

I am running Debian Jessie on an Intel Galileo Gen 2 board, which is powered
by an Intel Quark CPU. I noticed a SIGILL on this system quite often,
especially when running gcc or wget. Running a debug session with gdb showed
me the following:

    Catchpoint 1 (signal SIGILL), 0xb7d4bc80 in __gmpn_lshift_pentium_mmx ()
from /usr/lib/i386-linux-gnu/libgmp.so.10

Long story short: on line 263 of fat.c [1], MMX support is enabled for CPU's
with model version 4 or higher. The Intel Quark is Model 9, but does not
support MMX instructions. I fixed the SIGILL problem locally by adding " &&
model != 9" in the if-statement. I'm not sure if all other Family 5 models >
4 support MMX, the documentation about model numbers seems to be scarce. I
found an indication that the Model 7 also does not (always?) support MMX
[2], so the problem might occur on non-Quark systems as well.

I think that at least the Model 9 should be handled differently to fix
issues on Quark systems. A nice improvement would be to retrieve the support
for MMX from the CPUID.

The output of lscpu for the Quark system:

    root at Galileo:~# lscpu
    Architecture:          i586
    CPU op-mode(s):        32-bit
    Byte Order:            Little Endian
    CPU(s):                1
    On-line CPU(s) list:   0
    Thread(s) per core:    1
    Core(s) per socket:    1
    Socket(s):             1
    Vendor ID:             GenuineIntel
    CPU family:            5
    Model:                 9
    Model name:            Quark SoC X1000
    Stepping:              0
    CPU MHz:               399.076
    BogoMIPS:              798.15

Kind regards,
Erwin Bronkhorst

[1] https://gmplib.org/repo/gmp/file/tip/mpn/x86/fat/fat.c#l263
[2]
http://scp.s-scptuj.mb.edus.si/~murkos/Teorija%20in%20vaje/RSM/techref%20-%2
0%20HW%20za%20PCje%20-%20film%20Modherboard,%20IDE,Modem.BIOS,opti%E8ni%20di
ski%20-%20CD%20ob%20knjigi%20OPRAVKA%20RA%C8%20MRE%8EA/mobile.pdf



More information about the gmp-bugs mailing list