Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Anyone know how they implemented PPC-to-x86 translation?

They licensed Transitive's retargettable binary translator, and renamed it Rosetta; very Apple.

It was originally a startup, but had been bought by IBM by the time Apple was interested.



> It was originally a startup, but had been bought by IBM by the time Apple was interested.

Rosetta shipped in 2005.

IBM bought Transitive in 2008.

The last version of OS X that supported Rosetta shipped in 2009.

I always wondered if the issue was that IBM tried to alter the terms of deal too much for Steve's taste.


A lesser known bit of trivia about this is that IBM would go on to use Transitive's technology for the exact opposite of Rosetta -- x86 to PowerPC translation, in the form of "PowerVM Lx86", released that year (2008).

It's very fascinating to me, since IBM appears to have extended the PowerPC spec with this application specifically in mind. Up until POWER10, the Power/PowerPC ISA specified an optional feature called "SAO", allowing individual pages of memory to be forced to use an x86-style strong memory model, comparable to the proprietary extension in Apple's CPUs, but much more granular (page level and enforced in L1/L2 cache as opposed to the entire core).

As far as I can tell, Transitive's technology was the only application to ever use this feature, though it's mainlined in the Linux kernel, and documented in the mprotect(2) man page. IBM ditched the extension for POWER10, which makes sense, since Lx86 only ever worked on big endian releases of RHEL and SLES which are long out of support now.

One mystery to me, though, is IBM added support for this page marker to the new radix-style MMU in POWER9. It's documented in the CPU manual, but Linux has no code to use it -- unless I've missed it, Linux only has code to set the appropriate bits in HPT mode, and no reference to the new method for marking radix pages SAO as the manual describes. I can't imagine there was any application on AIX which used this mode (it only decreases performance), and unless you backported a modern kernel to a RHEL 5 userland, you couldn't use Lx86 with the new radix mode. Much strangeness...


In theory, PROT_SAO should be useful for qemu, and trivial to make patches implementing there. That's assuming the kernel actually sets it, though. The problem I encountered when I set out to do it a year or so ago, was that I couldn't find a good test case to fail without it...


The kernel definitely sets the WIMG bits at https://github.com/torvalds/linux/blob/master/arch/powerpc/m... (line 336, if HN removes it), though I've never been able to "make it work" either.

I used box64 as a test case, where I had a game that would run in emulation, but only if I pinned it to a single core. On ARM64, it also worked, as the JIT translator on box64 uses manually inserted memory fences to force strongly ordered access.

The game never worked correctly, even after I patched the kernel to mark every page on the system as SAO, and confirmed this worked by checking the set memory flags. This might be a mistake in my understanding of what SAO should do, though. (or another failure in box64 on ppc64le)

One thought I've had recently is perhaps it's like the recently discovered tagged memory extension and only worked in big endian? There's nothing in the docs to suggest this, but since the only test case was BE-only, maybe?


Apple is also not tied to reverse compatibility.

Their customers are not enterprise, and consequently they are probably the best company in the world at dictating well-managed, reasonable shifts in customer behavior at scale.

So they likely had no need for Rosetta as of 2009.


Right, thanks for correcting my faulty memory on the timing.

It is possible that IBM tried to squeeze Apple, but given that IBM's interest in Transitive was for enterprise server migration, I suspect it is more likely that Apple got tired of paying whatever small royalty they'd contracted for with Transitive, and decided enough people had fully migrated to native x86 apps that they wouldn't alienate too many customers.


>"The last version of OS X that supported Rosetta shipped in 2009."

Interesting so was Rosetta 2 written from the ground up then? Did Apple manage to hire any of the former Transitive engineers after IBM acquired them? It seems like this would be a niche group of engineers that worked in this area no?


>"The last version of OS X that supported Rosetta shipped in 2009."

Interesting, so was Rosetta 2 written from the ground up then? Did Apple manage to hire any of the former Transitive engineers after IBM acquired them? It seems like this would be a niche group of engineers that worked in this area no?


I agree it was a bit worryingly short-lived. However the first version of Mac OS X that shipped without Rosetta 1 support was 10.7 Lion in summer 2011 (and many people avoided it since it was problematic). So nearly-modern Mac OS X with Rosetta support was realistic for a while longer.


> However the first version of Mac OS X that shipped without Rosetta 1 support was 10.7 Lion

Yes, but I was pointing out when the last version of OS X that did support Rosetta shipped.

I have no concrete evidence that Apple dropped Rosetta because IBM wanted to alter the terms of the deal after they bought Transitive, but I've always found that timing interesting.

In comparison, the emulator used during the 68k to PPC transition was never removed from Classic MacOS, so the change stood out.


The Classic environment was removed from OS X and all the IP involved was Apple’s.

The timing is interesting, but I wouldn’t put beyond Apple to remove a feature simply to sediment a transition (and decrease support cost).


> In comparison, the emulator used during the 68k to PPC transition was never removed from Classic MacOS, so the change stood out.

It was never removed because Classic MacOS itself was never fully native.


> It was never removed because Classic MacOS itself was never fully native.

Are there any current OSes that have the same level of historical cruft that Mac OS Classic had?


Windows.

Depending on which API you are calling, you have to represent a “string” differently. This is just one example

https://learn.microsoft.com/en-us/cpp/text/how-to-convert-be...


There are still dialog boxes that date back to Windows 3.1 that show up in Windows 10 and 11.


I agree. And I suppose since it was so intrinsic to the operating system, if a 68k app worked in Mac OS 9 (some would some might not), you could continue to run it in the Classic Environment (on a PPC Mac, not Intel Mac) Mac OS 10.4 Tiger in the mid 20 00's!


I could have have sworn that a unibody MacBook Pro where I did an in-place upgrade to Lion somehow held onto Rosetta.


I guess that's perjury because it cannot be true! Even Snow Leopard didn't even include Rosetta 1. But if it was deemed necessary, it would download and install it on-demand, similar to how the Java system worked.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: