PowerPC үшін Mac 68k эмуляторы: Классикалық Mac OS-тағы үйлесімділік шешімі
Mac 68k emulator
PowerPC Mac OS жүйесіндегі 68k эмуляторы: Ескі бағдарламаларды іске қосу, жылдамдық төмендеуімен, үйлесімділікті қамтамасыз ету. Гари Дэвидан және Эрик Траут еңбектері.
Ағылшыншамен салыстырыңыз: абзацты басыңыз — түпнұсқа терезеде ашылады. Абзац астындағы EN түймесі оны мәтін ішінде көрсетеді.
Мазмұны
Кіріспе
Mac 68k эмуляторы – PowerPC үшін Mac OS классикалық жүйесінің барлық нұсқаларына кіріктірілген бағдарламалық эмулятор. Бұл эмулятор бастапқыда 680x0 процессорларында жұмыс ілген Macintosh модельдері үшін жазылған қосымшаларды және жүйелік кодты іске қосуға мүмкіндік берді. Connectix-тің RAM Doubler сияқты бірнеше ерекшеліктерді қоспағанда, эмулятор барлық бағдарламаларды PowerPC үшін компиляцияланған нұсқаларымен салыстырғанда өнімділікті азайтудан басқа ешқандай көзге көрінбейтін әсерсіз іске қосты.
Software emulator built into classic Mac OS for PowerPC
The Mac 68k emulator is a software emulator built into all versions of the classic Mac OS for PowerPC. This emulator enabled running applications and system code that were originally written for the 680x0 based Macintosh models. With a few exceptions, notably Connectix's RAM Doubler, the emulator ran all software with no noticeable impact other than lower performance relative to the same program when compiled for PowerPC.
Шығу тегі
Бірінші нұсқаны Гари Дэвидян жазды, ол бастапқыда Motorola 88000 процессоры үшін жасаған, ол Apple компаниясының RISC платформасын құрудағы алғашқы сәтсіз талпынысында қолданылған. Кейінірек Эрик Траут динамикалық қайта компиляцияны пайдалана отырып, жаңа нұсқасын жасады, ол кейін Connectix компаниясында Virtual Game Station және Virtual PC сияқты табысты эмуляция жобаларында жұмыс істеді. Траут келгенге дейін Connectix Speed Doubler бағдарламасын шығарды, оның құрамында одан да жылдам PowerPC 68k эмуляторы болды.
The first version was written by Gary Davidian, who had originally created it for use on the Motorola 88000 CPU, used in Apple's abortive first attempt at a RISC target platform. A later version, using dynamic recompilation, was developed by Eric Traut, who later worked on successful emulation projects at Connectix such as Virtual Game Station and Virtual PC. Prior to Traut's arrival there, Connectix had released Speed Doubler, which included an even faster PowerPC 68k emulator.
Іске асыру
Бұл эмулятордың барлық нұсқалары 68EC040 нұсқаулар жиынтығының "пайдаланушы" кіші жиынтығын 68020/68030 ерекшелік стек фреймімен эмуляциялады. Apple әзірлеушілер құжаттарында эмулятордың Macintosh Centris 610 операциялық ортасына ең жақын, Motorola 68LC040 микропроцессоры негізінде құрылған жүйеге ұқсас екендігі көрсетілген. Алғашқы нұсқалар әрбір нұсқауды декодтап, бірден PowerPC нұсқауларының тізбесін орындау арқылы эмуляциялады. PCI PowerMac үшін өнімділікті арттыру мақсатында динамикалық қайта құрастыру эмуляторы қолданылды. Динамикалық қайта құрастыру кодтың жиі кездесетін бөлімдерін жылдам, PowerPC-ге арналған тізбектерге "қайта құрастыру" арқылы жұмыс істейді, олар жергілікті кэште сақталады. Эмулятор 680x0 кодының бірдей тізбесін тани алады және аударманы қайта жасау қажеттігін болдырмау үшін бұрын сақталған PowerPC кодын орындай алады. Теориялық тұрғыдан алғанда, бұл эмулятор 680x0 кодын кез келген нақты 680x0 процессордан жылдам эмуляциялай алатын еді. 68LC040 процессорда қозғалатын нүктелік есептеулерге арналған нұсқаулар болмағандықтан, бұл жетістік сәл оңай болды, бірақ бәрібір әсерлі. Бұл эмуляцияның сәтті болуының бір себебі - Mac OS жүйесінің көптеген API-лері бастапқыда 680x0 процессорында "тұзақтар" ретінде жүзеге асырылған; сондықтан API-ді шақыру 680x0 үшін қате жағдайға тең болып танылды, бұл аппараттық векторлардың бірі арқылы қатені өңдеуге әкелді. Бұл вектор ROM немесе RAM-нан операциялық жүйе процедурасын іздеп, орындайтын еді. Эмуляторда мұндай тұзақтарды PowerPC-ге арналған түпкілікті кодпен алмастыруға болады, сондықтан эмуляцияланатын жалғыз код - қолданбаның өзі, ал оның шақырған кез келген жүйелік API-і PowerPC-ге арналған түпкілікті кодпен үдетілуі мүмкін. Бұл Apple компаниясына операциялық жүйені PowerPC-ге көшіруге уақыт берді. Бастапқыда тек өте маңызды бөлімдері түпкілікті кодқа қайта жазылды, ал операциялық жүйенің көп бөлігі эмуляцияланды. Бірте-бірте операциялық жүйенің көп бөлігі түпкілікті кодқа қайта жазылды, сондықтан операциялық жүйе уақыт өте жылдамдады. Бағдарламашы үшін PowerPC-ге көшу оңай болды, өйткені эмулятор автоматты түрде іске қосылып, тоқтатылды. Бұл жаңа типтегі көрсеткіштің көмегімен іске асырылды, ол Универсалды Процедуралық Көрсеткіш (UPP) деп аталды. 68k коды үшін бұл көрсеткіш кодқа қарапайым көрсеткіш ретінде көрінетін және осылай қолданылатын еді. Алайда, ол шын мәнінде арнайы тұзақ нұсқауын және шақырылған кодтың нұсқаулар жиынтығы архитектурасын (ISA) көрсететін жалаушаларды қамтитын дерек құрылымын қамтыды. PowerPC кодынан бұл UPP CallUniversalProc() функциясына беріліп, шақырылуы мүмкін еді. 68k эмуляторы сұраныс бойынша ISA үшін дұрыс ретпен берілген параметрлерді ұсыну және қажет болған жағдайда эмуляторды іске қосу және тоқтату сияқты егжей-тегжейлі мәселелермен айналысты. Mac OS компиляторлары тиісті макростар қолданылған кезде мұндай UPP-терді автоматты түрде жасады, ал PowerPC жүйелік кітапханаларында қажеттілікке қарай түпкілікті немесе әлі 68k функцияларын ашық түрде шақыруға арналған түпкілікті шұңқырлар болды. Бұл екі архитектурамен жұмыс істеу бағдарламашы үшін өте аз жұмыс талап етті және операциялық жүйе сияқты, қолданбалар 680x0 және PowerPC кодын оңай араластыра алатын еді.
All versions of this emulator emulated the "user" subset of the 68EC040 instruction set with a 68020/68030 exception stack frame. Apple developer documents indicate that the emulator provided an operating environment most closely resembling that of the Macintosh Centris 610, a system based on the Motorola 68LC040 microprocessor. Early versions emulated it by decoding each instruction and immediately carrying out a series of equivalent PowerPC instructions. For the PCI PowerMacs, the dynamic recompilation emulator was used to boost performance. Dynamic recompilation works by "recompiling" common sections of the code into faster, PowerPC native, sequences that were locally cached. The emulator could recognise the same sequence of 680x0 code and run the previously cached PowerPC code to avoid doing the translation again. This emulator was theoretically capable of emulating 680x0 code faster than any real 680x0 was capable of running it. The 68LC040 had no floating point instructions, making this feat slightly simpler but no less impressive. 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; therefore, 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. In turn, this vector 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, and any system API it called could be accelerated with native PowerPC code. This 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, because 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 to be an ordinary pointer to code and could be used as such. However, it actually led to a data structure which contained a special trap instruction and flags indicating the instruction set architecture (ISA) of the called code. From PowerPC code, this UPP could 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. This meant that 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.
Ағымдағы жағдай
Ол классикалық Mac OS-тің барлық PowerPC нұсқаларына кіріктірілгендіктен, эмулятор Mac OS X-тегі Classic ортасының да бөлігі болды. Сондықтан, SheepShaver сияқты PowerPC Macintosh эмуляторлары классикалық Mac OS-ті іске қосқанда осы эмуляторды пайдаланады. Classic режимінен тыс Mac OS X-тің түпнұсқа нұсқалары эмуляторды ешқашан қолданған жоқ.
Because it was built into all PowerPC versions of the classic Mac OS, the emulator was also part of the Classic environment in Mac OS X. PowerPC Macintosh emulators such as SheepShaver therefore use the emulator as well when running the classic Mac OS. Native Mac OS X outside of Classic never used the emulator.