Overview: In 2020, Apple ditched Intel processors and began releasing Macs powered by their own custom chips. Because of this change, Apple had to find a method to emulate x64-based programs on the new silicon. Apple has found a way, a very old way.
Apple unveiled its first custom processor, the Apple M1, at an event in November 2020. The chip won praise for cramming a lot of power into a small space. Apple’s M1 had people wondering if SoCs were the future of computing.
Due to the switch to an ARM architecture, Apple had to find a way to allow M1 Macs to use programs designed for Intel-based Macs.
Apple chose the simplest but most effective method: emulating the x64 architecture of the Apple M1 itself. The emulation method is called “Rosetta 2”, named after the Rosetta stone.
People were surprised by the effectiveness of Rosetta 2. Dougall Johnson, an Australian security researcher, now thinks he knows why.
There is an unpublished extension in Rosetta 2 that streamlines the process of storing parity and adjusting flags in an application. This allows for more accurate and “fast” emulation, according to Johnson. The most amazing part is where the extension came from – it was included in Intel’s second processor, the Intel 8080, from 1974.
The older 8-bit microprocessor handled these parity adjustments and stores very specifically, and this feature has continued to find its way into today’s Intel processors. If you have a new Core i9-13900K, there is a direct (albeit minor) correlation to the processors that powered some computers nearly 50 years ago.
Bits 26 and 27 of ARM’s flag register are dedicated to this process, although these two bits are only assigned to this operation when Rosetta 2 is active. Rosetta 2 activates only if it detects that a program is designed for Intel-based Macs and reassigns the two bits, allowing Rosetta 2 to run at its usual brisk pace.
It’s interesting to see the methods Apple is rolling out to allow users to continue using programs designed for older Intel-based Macs. The idea of an entire architecture rerouting two bits to handle operations similar to a CPU released during the Nixon administration is fascinating.