Mac 68K

emulatore software incluso nelle versioni di Mac OS per i processori PowerPC
Versione del 7 set 2008 alle 11:43 di Hellis (discussione | contributi) (Nuova pagina: {{WIP|hellis}} Il '''Mac 68K''' era emulatore software incluso in tutte le versioni di Mac OS per i processori PowerPC. L'emulatore permetteva l'esecuzi...)
(diff) ← Versione meno recente | Versione attuale (diff) | Versione più recente → (diff)

Il Mac 68K era emulatore software incluso in tutte le versioni di Mac OS per i processori PowerPC. L'emulatore permetteva l'esecuzione delle applicazioni e delle componenti del sistema operativo scritte in codice 68000 sui processori PowerPC. L'emulatore era totalmente trasparente per l'utente e quasi trasparente per il programmatore. Inizialmente l'emulatore venne scritto da Gary Davidian per i processori 88000, i processori RISC che inizialmente Apple voleva utilizzare per sostituire i processori 68000. In seguito l'emulatore venne scritto per PowerPC e venne utilizzata la ricompilazione dinamica al fine di migliorarne le prestazioni, questa versione venne scritta da Eric Traut che in seguitò lavoro allo sviluppo della Virtual Game Station e dell'emulatore Virtual PC.

Tutte le versione emulavano le istruzioni utente del Motorola 68EC040 e il gestore delle eccezioni dei processori 68020/68030. La macchina emulata era simile al Centris 610, un computer basato su Motorola 68EC040.[1] La prima versione prelevava le singole istruzioni 68000 e le convertiva in equivalenti istruzioni PowerPC, in seguito con i sistemi PCI PowerMac venne presentata una nuova versione dotata di ricompilazione dinamica del software. La ricompilazione dinamica analizzava intere sezioni di codice e le convertiva in codice PowerPC. Questi frammenti di codice venivano tenuti in memoria al fine di poterli riutilizzare direttamente senza ricompilazione in caso fossero stati nuovamente necessari. Questo permetteva all'emulatore di essere anche più veloce di un'equivalente processore 68EC040.


One reason that this emulation was so successful is that many of the APIs for the Mac OS were originally implemented as traps on the 680x0 processor - calling an API actually was recognised by the 680x0 as the equivalent of an error condition, which would cause it to handle that error through one of its hardware vectors, which in turn would look up and run the operating system routine from ROM or RAM. In the emulator, such traps could be replaced by native PowerPC code, so the only code being emulated was the application itself - any system API it called could be accelerated with native PowerPC code. It also allowed Apple time to port the OS to the PowerPC - at first only time critical aspects were rewritten in native code, leaving much of the OS emulated. Gradually most of the OS was rewritten to be native, so the OS got faster over time.

For the programmer, the transition to the PowerPC was made fairly painless, as the emulator was started and stopped automatically. This was achieved using a new type of pointer called a Universal Procedure Pointer (UPP). For 68k code, this pointer appeared and used as an ordinary pointer to code, but actually led to a special data structure, which contained a special trap instruction and flags indicating the instruction set architecture (ISA) of the called code, and from PowerPC code, can be passed to the CallUniversalProc() function to call it. The 68k emulator then dealt with details such as presenting passed parameters in the right order for the ISA in question, as well as starting and stopping the emulator as required. The compilers for Mac OS created such UPPs automatically when the proper macros were used, and the PowerPC system libraries contained native stubs to transparently call through to native or still-68k functions as needed, so dealing with the dual architecture required very little work for the programmer. And just like the OS, applications themselves could mix and match 680x0 and PowerPC code fairly easily.

The emulator is no longer part of Mac OS X, though it remains as an integral part of the Classic environment.

See also