15-412 iMac Plan 9 Project
Plan 9 is a research operating system developed since the 1980's at Bell Laboratories. Background information about the system can be found here. As a distributed system, it was written to be (and has been) easily portable to many different processor architectures, including x86, Alpha and even older PowerPC architectures.
The motivation for a port to the newer iMac G4 processor family/PowerPC 74xx architectures came from the fact that a large number of G4 machines were being phased out of use as OS X workstations, but possessed sufficient hardware to run as powerful Plan 9 systems. With some work, these machines could be usefully incorporated into existing Plan 9 systems, expanding Plan 9's user base and attracting new attention to the system.
Our WorkIn our port of Plan 9 to the iMac, we built on the source of previous ports to the PowerPC 603 (BeBox), 750/755 (G3) and 8260 processors in the existing source trees. The G3 port was the main contributor to our new source tree. There were a number of architectural differences between the G3 and G4 processor families, including new registers, instructions and virtual memory management mechanisms that required significant updates, as well as many changes to the core Plan 9 source itself. We were also able to utilize OpenFirmware as both a primary bootloader and device virtualization subsystem due to its prevalence on Macintosh systems. Loading the Plan 9 kernel image, though, required the addition of a secondary bootloader (named Shim) to correctly parse the XCOFF binary image produced by the Plan 9 PowerPC compiler suite.
We have completed a proof-of-concept port of Plan 9 to the PowerPC architecture. The system runs standalone on both older iMac systems and the newer Mac minis, mounting the local main memory as a ramfs and providing the user a console and small set of commands. Due to time constraints, it lacks device drivers, notably an ethernet driver for network support, a VGA driver for graphical displays, and a hard disk driver for persistent file storage (though with OpenFirmware virtualizing these devices the actual implementation would not be a lot of work).
Our hope is that once released, the Plan 9 community will provide a continuing effort to implement the missing pieces and improve the quality of the port.
The most annoying unresolved issue is the inability to restore OpenFirmware's preexisting memory state when calling into it from a running kernel. OpenFirmware uses page tabling as its virtual memory management system, while our kernel utilizes a now-defunct system (removed from the PowerPC G5 specification) known as Block-Address Translation (BAT). The kernel mappings are left untouched when restoring OpenFirmware's page tables and therefore may be written to; this has not been linked to any known problems to date, but may be a source of issues in the future.
[Last modified Tuesday May 30, 2006]