Apple built support for instructions designed for Intel’s 8080 processor, which debuted in 1974, into Apple silicon processors, using secret undocumented extensions to execute very rarely used instructions. and found to improve emulation performance.
Apple’s Rosetta 2 is part of macOS and allows applications written for Intel processors to run on Apple Silicon. (opens in new tab)– Works pretty well on an equipped Mac. Named after Rosetta his stone that allowed Egyptologists to begin deciphering ancient hieroglyphs in the 1820s.Rosetta was similarly mysterious, but may have begun to abandon that secret, as detailed in a blog post (opens in new tab) Australian security researcher Dougall Johnson discusses why Rosetta 2 is so fast while revealing undocumented enhancements.
The secret extension seems to change how the processor stores parity and adjust flags from applications to provide more accurate emulation. This story is picked up by web developers and retro computing enthusiasts. Blake Paterson (opens in new tab)with the help of Johnson’s post, explains how and why to do this Mastodon (opens in new tab).
All can be traced back to the 1974 Intel 8080. This was his second chip for the company. (opens in new tab)This 8-bit microprocessor treats alignment and parity flags in a particular way and uses them to indicate whether numbers are to be carried in binary decimal arithmetic. It’s rarely used in modern applications, but has survived to today’s x64 chips. .
The Arm architecture used in Apple Silicon, which has nothing to do with x64, does not have such a feature, so it had to be emulated. Otherwise, some Intel software won’t work on newer Macs and computing the same operation without 8080 flagging will use 5x more instructions and slow down your Mac.
Rosetta 2 recompiles binary applications for Intel processors on startup rather than providing real-time emulation, but I don’t know if the adjustment and parity flags are used by the app. It uses bits 26 and 27 of the Arm flags register to emulate 8080 operations so you don’t have to travel a long way each time.
Apple Silicon processors only do this when running Rosetta 2, as doing this all the time violates Arm’s specs – Johnson said that if the Apple processor is running a Linux VM, I’m pointing out that it doesn’t work. Not configurable in this situation.
It’s not exactly shocking news, but it’s a fascinating insight into how very clever and performant software works. But the same way the original Rosetta was introduced in Mac OS X 10.4 Tiger and discontinued in 10.7 Lion. If Apple Silicon is a few generations old, it’s likely to disappear.