11

Some early models of Intel 80386 processors had a bug with 32-bit integer multiplication. Those which were found to have the bug were marked "16-bit S/W ONLY" (not sure what S/W is supposed to mean), while the clean ones were marked with ΣΣ. How could software detect if it's running on a buggy CPU? Because not detecting this could lead to some serious erroneous results, even within the OS (unlike the Pentium FDIV bug, which was minor).

4
  • 11
    ‘S/W’ – software. Feb 1 at 13:40
  • 1
    Chris Lueders’ IAPX purports to detect such buggy 386s (although he never came across one himself), and refers to an IAPX.DAT file which is supposed to have more information (but I don’t have it, and can’t find it). Feb 1 at 15:27
  • 2
    As a side note, the double sigma CPUs fixed some other bugs as well, such as a lockup that occurred in conjunction with an 80387. Feb 1 at 19:03
  • Yeah, I recall reading of this back when it happened. Early 386 software used multiply subroutines rather than the built-in microcode.
    – Hot Licks
    Feb 1 at 23:41
16

Software can identify those early steppings on the 386 by checking whether the XBTS and/or IBTS instruction can be executed, since these instructions were dropped in later chip revisions.

Software must, however, first check whether the CPU is really an 80386 and not 486, because the some early steppings of the 486 temporarily re-used the opcodes of these two instructions for the CMPXCHG instruction (what wonderful design decisions ;) ).

Other than that, it is only possible to check by actually multiplying and seeing if you get a proper result. Windows installers apparently did that by computing and verifying the result of 0x81 × 0x0417A000. I cannot verify whether that is a 100% accurate check, but doubt it, because the bug actually seems to be a on-chip power supply problem that might also depend on environmental conditions.

5
  • 1
    Not all early CPUs had the bug. By this method you rule out those bug-free early CPUs which had the same exact instructions as the buggy ones.
    – DarkAtom
    Feb 1 at 13:58
  • So the only 100% accurate check is to multiply all 32-bit numbers by all 32-bit numbers (2^64 multiplications!!) and see if any result is wrong? That seems quite ridiculous. If it is a power supply problem, that means it is also non-deterministic (unlike the FDIV bug which had broken lookup tables), so there could be a case where any multiplication works on a buggy CPU, but next day it doesn't.
    – DarkAtom
    Feb 1 at 14:18
  • @DarkAtom - not only is it ridiculous to exhaustively check, it's mentioned as infeasible in a famous paper (top of page 4) - though hardware has got faster than when the paper was written, we have more bits. On the other hand, if it's known that one particular multiplication gives a bad result on the bad chips, that's all you need to execute to decide if it's a good or bad chip. Feb 1 at 17:08
  • 1
    Yes, but if the bug indeed manifests in a non-deterministic way, it may be undetectable.
    – DarkAtom
    Feb 1 at 20:11
  • 1
    True, but that's independent of the need to exhaustively try all combinations of multiplier and multiplicand. Though the ~600 years it would take you (at about 1 billion multiplications/second) might increase your chances of the glitch happening. Or maybe not, if it still only fails on some operands. Feb 2 at 2:12
2

It can be tested by performing various multiplication operations and verifying the result. List of such code that performs ten tests with various memory and register based operands is available for example at pcjs.org, but as others have already pointed out, the problem may only manifest under certain conditions and can depend on e.g. CPU supply voltage, so it is possible that these tests will not necessarily detect a buggy CPU even if all tests pass.

3
  • 11
    This is basically a link-only answer.
    – abligh
    Feb 1 at 23:12
  • 6
    Where exactly on that site might one find such a list?
    – Polygnome
    Feb 2 at 9:45
  • 1
    I think it already containes enough info to leave, but adding more content would really help a lot.
    – peterh
    Feb 4 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.