Apple Silicon Supports 48-Year-Old Intel 8080 via Secret Extension

Egyptian hieroglyphics, one suspiciously apple-shaped
(Image credit: Lady Escabia on Pexels)

It turns out that Apple has baked in support into its Apple Silicon processors for an instruction that was designed for Intel's 8080 processor that debuted back in 1974, using a secret undocumented extension to execute the very infrequently-used instructions, thus boosting emulation performance.

Apple’s Rosetta 2 is part of macOS that allows applications written for Intel processors to run on Apple Silicon-equipped Macs, and it works rather well. Named for the Rosetta Stone, which allowed Egyptologists to begin decoding the ancient hieroglyphic writing system in the 1820s. Rosetta has been equally mysterious, but may have begun to give up its secrets, as detailed in a blog post by Australian security researcher Dougall Johnson, in which he reveals an undocumented extension while discussing why Rosetta 2 is so fast. 

M1 Ultra

(Image credit: Apple)

The secret extension appears to alter the way the processor stores parity and adjust flags from an application, to provide more accurate emulation. The story is taken up by web developer and retro computing enthusiast Blake Patterson, who explains how and why it does this, with the help of Johnson’s posts on Mastodon.

The whole thing can be traced back to the Intel 8080 from 1974, which was the company’s second-ever chip. This 8-bit microprocessor handled its adjust and parity flags in a particular way, using them to indicate whether to carry numbers in a binary-coded decimal operation, and this has persisted through to today’s x64 chips even though it’s hardly ever used by modern applications. 

The Arm architecture used by Apple Silicon, being unrelated to x64, has no such functionality, so it needed to be emulated. Otherwise, some Intel software wouldn’t work on the new Macs, and computing the same operation without the 8080’s flag-handling would use five times as many instructions and slow the Mac down. 

Rosetta 2 recompiles a binary application meant for an Intel processor at launch rather than providing real-time emulation, but cannot tell if the adjust and parity flags will be used by the app. It uses bits 26 and 27 of the Arm flags register to emulate the 8080’s handling of them to avoid needing to go the long way round every time.

It would break the Arm specification to have this running all the time, so the Apple Silicon processors only do this when running Rosetta 2 - Johnson points out that it doesn’t work when the Apple processor is running a Linux VM, as the processor isn’t as configurable in this situation. 

While not exactly Earth-shattering news, it’s a fascinating insight into the workings of an extremely clever and performant piece of software, albeit one that - in the same way the original Rosetta was introduced in Mac OS X 10.4 Tiger and retired in 10.7 Lion - is likely to fade away once Apple Silicon is a few more generations old.

Ian Evenden
Freelance News Writer

Ian Evenden is a UK-based news writer for Tom’s Hardware US. He’ll write about anything, but stories about Raspberry Pi and DIY robots seem to find their way to him.

  • Axell
    I lol'd hard at the egyptian mural to represent the article... Then sadness hit even harder when I realized I actually used an 8086 processor.
    Reply
  • bradhouser
    The 8080 was Intel's second microprocessor, not second chip. Intel was a memory company at first. Their first microprocessor came after a number of memory products.
    Reply
  • CerianK
    bradhouser said:
    The 8080 was Intel's second microprocessor, not second chip. Intel was a memory company at first. Their first microprocessor came after a number of memory products.
    3rd or 4th microprocessor, I think:
    4004 November 15, 1971
    8008 April, 1972
    4040 1974
    8080 April, 1974
    Reply
  • Alank%
    bradhouser said:
    The 8080 was Intel's second microprocessor, not second chip. Intel was a memory company at first. Their first microprocessor came after a number of memory products.

    Correct about the Intel memory chips, however the 8080 was actually Intel's fourth microprocessor. Their very first microprocessor, and in fact the first microprocessor in the world, was the four-bit Intel 4004. The second was an evolution of the 4004 the 4040, the third was the 8008 and, finally the fourth was the 8080..., and that, along with the January 1975 issue of Popular Elec tronics changed everything.
    Reply
  • bit_user
    Wow, that was confusing! I read the whole article waiting to see what was the secret part of the 8080. Then, I read the blog post it referenced, and finally realized the article wasn't talking about secret extensions of the 8080, but rather a secret extension in the Apple Silicon!

    The secret extension is a mode that causes the Apple CPU core to compute and store the PF and AF in high-order bits of the NZVC register. The reason this is such a big deal is that ARM doesn't allow its customers to make nonstandard extensions to their implementations. That's how ARM achieves such a high degree of software compatibility between CPUs.

    Anyway, the historical asides, sprinkled through the article, really just got in the way more than anything else. Moreover, the 8080 really doesn't need to be referenced.
    Reply