The Emotion Engine (EE) of the PlayStation 2 is known to have several hardware bugs. One of the earliest bugs was the Short-Loop bug, which causes loops to possibly execute only once or twice under certain conditions. This is what was written in the comments for GCC v2.95 that was shipped with the PS2Linux BETA: This was documented in the SONY PS2SDK, and was documented to have been worked around since release v1.3 (before the PlayStation 2 release). However, in the beta's 2nd patch and the final release, this was added after the third point and is not mentioned in the SONY PS2SDK documentation: The system manuals that came with PS2Linux were the 5th edition, but this newer version of the glitch was not documented there. There was a newer version that was eventually shipped with the newer SDKs, the 6th edition. But even the 6th edition does not document this "newer" glitch. Digging through the SCE DEVNET messages, I found this: Version 0x2E14 is the CXD9542GB, which is mounted on the DTL-H10000, SCPH-10000/SCPH-15000/SCPH-18000 (GH-003) and the DTL-T10000(H). It also means that the "revision" numbers that SONY sometimes mentions in some documents is not the same as the version reported by the chip itself. Perhaps this is a sign that the old EE was later on discovered to have more bugs... but SONY decided that it wasn't worth dealing with and hence the documentation wasn't ever updated? The comment said "and later", so perhaps that also means that the CXD9615GB is also affected. Unless, it was referring to some internal revisions to the EE that weren't used in any model that was ever used outside of SONY. I don't have the sources for the GCC used in anything else other than PS2Linux, so I don't know if they only used the newer version of the short-loop bug workaround in only PS2Linux. *** On a side note, the same message also said: I didn't know that there were TOOL units without the CD/DVD drive....
Do you pass the EE revision to the compiler in PS2Linux? To me it sounds like the bug doesn't happen in EE2.9 later if the instruction in the branch delay slot is a nop, but you could ignore that and avoid all the other conditions and your code would still work on every processor. I'm surprised they tried to fix it, once you can work round a bug and you start shipping them then it's pretty dangerous to make any changes. The only one that springs to mind is the banding on the original PS1. Which is why you had to test every game on a blue and green debug console.
It's not my code, but SCEI's. The revision is never passed to GCC and Binutils. The new version of the workaround is enabled at compile-time of GCC, so it would be either always on or off. Given the define statement in the GCC source code, I would say that it would have been always on, so that the generated code would work on all EE revisions. Now that you mentioned this. I guess that it makes sense if the documentation wasn't updated, as not satisfying the first condition (the loop must not be shorter than 6 instructions) would already prevent the bug from occurring. The only thing that SONY never did then, was to document the details of the bug itself. Thanks. I don't think that we actually know if they actually fixed the bug, although logic tells us that they would have. Wouldn't it be perfectly safe, if the developers simply used the SONY tools (GCC+Binutils) and followed their assembly coding guideliens (regarding this bug)? After all, the TOOL units all had the CXD9542GB, so the short-loop bug would surely trigger off if bad code was used on them.
I was making a new short-loop bug patch for GCC v5.3.0, and I think that I know what the new fix for the short loop bug was about. Without it, GCC would traditionally lengthen all short loops to 7 instructions, inclusive of the branch delay (BD) slot and the jump itself. But if that new fix is enabled (applicable to only EE v2.9 and later), the loops do not have to be lengthened if the BD slot contains a NOP. That means that SONY actually partially fixed the short loop bug, starting from the CXD9542GB. That is the very first EE that is we know of.