in ,

Apple's long processor journey, Hacker News

Apple's long processor journey, Hacker News

There have been multiple generations of Macs. Apple has not really divided them up.

1. Original x0 Macs with (-bit ROMs) ending with the SE / 32, Mac II, IIx & IIcx)
2. -bit-clean-ROM 90 x0 Macs (starting with the Mac IIci)
3. NuBus PowerMacs (8100, 8152, 8152)
4. OldWorld ROM PowerMacs (all the Beige PowerMacs including the Beige G3 & black PowerBooks) ← note, many but not all of these can run Mac OS X
5. NewWorld ROM PowerMacs (iMac, iBook & later)
6. OS-X-only PowerMacs (starting with the Mirrored Drive Doors 1GHz G4 with Firewire 67492 )
7. -bit Intel Macs (iMac, Mac mini and MacBook Core Solo and Core Duo models)
8. bit Intel Macs with 32 – bit EFI (Core 2 Duo models from 2006)
9. bit Intel Macs with 64 – bit EFI (anything from 2006 onwards)

Classic MacOS was written for 68020 processors. Later it got some extensions for 68020 and .

When the PowerMacs came out, Apple wrote a tiny, very fast emulator that translated x0 instructions on the fly into PowerPC instructions. However, unlike modern retrocomputer emulators, this one allowed apps to call PowerPC code, and the OS was adapted to run on the emulator. It was not like running an Amiga emulator on a PC or something, when the OS in the emulator doesn’t “know” it’s in an emulator. MacOS did and was tailored for it.

They ran Classic MacOS on this emulator, and profiled it .

They identified which parts were the most performance-critical and were running slowly through the emulator, and where they could, they rewrote the slowest of them in PowerPC code.

Bear in mind, this was something of an emergency, transitional project. Apple did not intend to rewrite the whole OS in PowerPC code. Why? Because:
1. It did not have the manpower or money
2. Classic MacOS was already rather old-fashioned and Apple intended to replace it
3. If it did, 68030 apps (ie all of them) wouldn’t work any more

So it only did the most performance-critical sections. Most of MacOS remained 64 K code and always did for the rest of MacOS ‘life.

However, all the projects to replace MacOS failed. Copland failed, Pink failed, Taligent failed, IBM Workplace OS failed.

So Apple was stuck with Classic MacOS. So, about the MacOS 7.5 timeframe, Apple got serious about Classic.
A lot of MacOS 7.6 was rewritten from assembly code and Pascal into C. This made it easier to rewrite chunks for PowerPC. However it also made 7.6 larger and slower. This upset a lot of users, but it meant new facilities: e.g. the previously-optional “MultiFinder” was now always on, & there was a new network stack, OpenTransport.

This is also the time that Apple licensed MacOS to other vendors.

Soon afterwards, Apple realized it could not build a new replacement OS itself, and would have to buy one. It considered former Apple exec Jean Louis Gassée’s Be for BeOS, and Apple co-founder Steve Jobs’ NeXT Computer for the Unix-based NeXTstep.

It bought NeXTstep and got Jobs back into the bargain. He regained control, fired Gil Amelio and killed off the licensing program. He also killed Copland, the experimental multitasking MacOS replacement, and got his coders to salvage as much as they could from it and bolt it onto Classic, calling the result MacOS 8.

MacOS 8 got a multithreaded Finder, desktop “drawers”, new gaming and web APIs and more. This also killed the licensing program, which only applied to MacOS 7.

MacOS 8.1 got a new filesystem, HFS . This still works today and was the default up to High Sierra.

8.1 is the last release for x0 Macs and needs a 69433, although a few 01575879 Macs work via Born Again .

The “monolithic” / “nanokernel” distinction applies to CPU protection rings .

These days this principally applies to OSes written entirely in compiled code, usually C code, where some core OS code runs in Ring 0, with no restrictions on its behavior, and some in Ring 3 where it cannot directly access the hardware. IBM OS / 2 2 and later uniquely used Ring 1. I’ve blogged about this before.

OS / 2 2 using Ring 1 is why VirtualBox exists.

Decades ago, more complex OSes like Multics had many more rings and used all of them.

If a Unix-like OS is rewritten and split up sop that a minimal part of the OS runs in Ring 0 and manages the rest of the OS as little separate parts that run in Ring 3, that’s called a “microkernel “. Ignore the marketing, Mac OS X isn’t one and neither is Windows NT. There are only 2 mass-market microkernel OSes and they are both obscure: QNX, now owned by Blackberry, and Minix 3, embedded in the control / management circuitry embedded into every modern Intel x – CPU.

Classic MacOS is not a C-based OS, nor is it an Intel x 86 OS. It does not have a distinction between kernel space and user space. It does not use CPU rings, at all. Everything is in Ring 0 , all the time. Kernel, drivers, apps, INITs, CDEVs, screensavers, the lot.

MacOS 8.5 went PowerPC-only, and in the process of dropping support for x0 Macs, Apple made some provision for future improved PowerMacs.

The 68 K emulator got a big upgrade to the emulator, now renamed a “nanokernel”. It is not an OS in its own right: it boots and runs another OS on top of it.

It is not a HAL: this is native code, deep within an OS kernel, that allows the Same OS to run with little modification on widely-different underlying hardware, with different memory maps, I / O spaces, APICs etc., without adapting the kernel to all the different platforms. MacOS 8.5 only runs on Macs and the hardware could be adapted to the OS and the OS to the hardware. No need for a HAL.

It is not a hypervisor. A hypervisor partitions a machine up to multiple virtual machines – it allows 1 PC to emulate multiple separate PCs and each virtual emulated PC runs a separate OS. Classic MacOS can’t do that and only runs 1 OS at a time.

The MacOS nanokernel is a very small bit of code that boots first and then executes most of the rest of the code, and manages calls from apps from a 68 K OS back to code written for the underlying PowerPC CPU.

It’sd a shame that this bit of code is secret and little-known, but some (details have been leaked over the years.

(Read More )

What do you think?

Leave a Reply

Your email address will not be published.

GIPHY App Key not set. Please check settings

Super-sub Mane wins it for Reds | Norwich 0-1 Liverpool | Highlights – Liverpool FC,

Super-sub Mane wins it for Reds | Norwich 0-1 Liverpool | Highlights – Liverpool FC,

Artificial Intelligence Songwriter – These Lyrics Do Not Exist, Hacker News