Porting Mac OS X to the Nintendo Wii
138 points by calvin
138 points by calvin
This is pretty darned awesome, and it makes me wonder what Leopard would look like on a three core, 1.24 GHz Nintendo Wii U with 2 gigs of memory.
As it is, NetBSD on a Wii U flies! Leopard would be quite interesting.
Unfortunately because of a hardware misfeature, OSes on Wii U would either be stuck in single core mode or have the L2 cache disabled which works as a workaround but at the cost of performance.
https://fail0verflow.com/blog/2014/console-hacking-2013-omake/#espresso
In fact, the SMPization of the 750 in the Espresso is not perfect. There appears to be a bug that affects load-exclusive and store-exclusive instructions (an explicit cache flush is required), which means that using SMP Linux with them will require patching the kernel and libpthread to work around it (and possibly other software that directly uses these instructions to e.g. implement atomics). They would’ve never shipped such a blatant bug on a general-purpose CPU, but I guess they called it good enough for a game console since they can just work around it in the SDK (which they do: the Cafe OS locking primitives have the workaround).
NetBSD fixes the SMP issue without disabling the L2 cache:
https://mastodon.sdf.org/@jmcwhatever/115856648445045001
I wonder how much work it'd be to modify Mac OS X to do the same. I'd say a lot, but then again I'd say it'd be a lot of work to port Mac OS X to run on a Nintendo Wii :)
Given this requires a custom kernel build anyway, it wouldn't be out of the question to modify the kernel Mach-O loader to dynamically patch in the workaround for the buggy stwcx, in the same way that the Wii WinNT port's bootloader does in its PE loader (though that port has recently removed the PE loader stwcx patching in NT itself, given they run with L2 disabled)
It appears there is a second OS X port project that does support the Wii U. No clue if they do SMP, though.
I love how much attention the Wii and Wii U are getting in the retro dev scene. Cheetah isn't the greatest release of the Mac OS, but it's still very impressive to see it running there. And I think it's a bit better in hindsight. A lot of the contemporary complaints of instability were likely because of most apps still running in Classic, since I have an iBook Clamshell running Cheetah that seems to run just fine…