Page 1 of 1

[macOS] make PPC software run natively on macOS – Rosetta

Posted: Thu Oct 25, 2018 10:18 pm
by mePy2
I’ll go to the point, I’m going to update this post later.

I don’t know if I’m in the right place or not. But since I know SheepShaver I decided to write here.

Sure this isn’t something new.
I want (!) old PPC Macintosh software run natively on new Mac OSes.
That’s it.

Rosetta for the new Macintosh.

Please, help me. Write everything you know about it.

Thank you.

Re: [macOS] make PPC software run natively on macOS – Rosett

Posted: Fri Oct 26, 2018 3:46 am
by macplus
I don't think that is possible, because PPC and x86 are so different.

Re: [macOS] make PPC software run natively on macOS – Rosett

Posted: Fri Oct 26, 2018 9:18 am
by mabam
Hasn't there been a project or something long ago to make Rosetta run on OS X beyond Snow Leopard, but never succeeded? I can't find anything on the web regarding that.

There is some information on PowerPC to X86 binary translation on ... index.html. I don't understand half of what it says there, but I think it doesn't look very promising as far as doing this on an OS X/macOS system.

Re: [macOS] make PPC software run natively on macOS – Rosett

Posted: Fri Oct 26, 2018 1:33 pm
by 24bit
From what I heard back in the days, it was proven impossible to make Rosetta run even with 10.7 Lion.
There are some stubs or left-overs from Snow Leo so it was thought of doable - which it was not, sadly.
As of today, you may run OSX 10.5 or 10.6 in VMWare.
That way you may still run some PPC only apps fairly easy.

See here for 10.5 Server:
A little further down, 8th comment or so, is a a link for a ready made VMWare appliance found on the net years ago.
The VMWare appliance woks on my side in macOS Sierra (Sandy Bridge or Xeon X3210), VMWare Fusion 10.
Maybe a starting point?

Re: [macOS] make PPC software run natively on macOS – Rosett

Posted: Fri Oct 26, 2018 3:59 pm
by adespoton
The problem with getting Rosetta to run with 10.7+ was partially a licensing thing; Apple wasn't licensing it after 10.6, so they pulled the framework from 10.7 that supported it on the OS side, and also added in some checks to prevent it from working for those enterprising souls who attempt to move the Rosetta framework over.

There was a project started back around 2013 to try and take SheepShaver and do something "Rosetta-like" with it for 10.7+, but there's a bunch of components totally missing from the OS with the move to a 64-bit architecture (Rosetta was PPC to 32-bit Intel only) that would have had to be written -- so above the issue of changing hardware architectures and doing JIT translation/emulation from PPC to Intel, there was also the hurdle of getting 32-bit code running as 64-bit (Intel currently does much of the heavy lifting for this in hardware, but some of the bits depend on the OS, and Apple's no longer supporting the code needed to do this and will soon retire it altogether).

So instead, what I do is wrap SheepShaver or QEMU (or BII or Mini vMac) around any specific software I want to run; really easy for games, where instead of booting to Finder, I boot to the game itself, and then capture quit with an applescript that both quits and shuts down. I haven't found much use for this with OS X PPC software as there's generally better software equivalents for all OS X PPC software already available for Intel; but eventually I'll probably find something. In the meantime, I run 10.6.8 in a VM, which allows me to run pretty much everything written for 10.2 through 10.6. I'm kind of worried about what's going to happen when Apple finally drops 32-bit support, as that may mean that VMs will no longer be able to boot 32-bit OSes and we'll need yet another emulator.

Re: [macOS] make PPC software run natively on macOS – Rosett

Posted: Fri Oct 26, 2018 8:26 pm
by mePy2
Thank you for your replies.

I love SheepShaver and my new Mac OS 9. But I cannot think about how all this is possible in 2018!

We are talking about software written twenty years ago and still there is nobody in the world that succeeded in doing this?

I know, nobody cares about PowerPC and "old" software. But take as example Age of Empires II. There is NO Age of Empires II available for Macintosh if not the one for PowerPC Macs.

... I don’t want to install Windows on my Mac only for this game.
I’m sure Age is not the only program they did not make an Intel version of.

Bye, thank you for reading my outburst.

Re: [macOS] make PPC software run natively on macOS – Rosett

Posted: Fri Oct 26, 2018 9:17 pm
by adespoton
Age of Empires II runs just fine under WineSkin AFAIK; no need to install Windows. It also runs just fine under VirtualBox, VMWare Fusion, or Parallels Desktop Lite running Snow Leopard.

There's all sorts of software that doesn't run natively under modern OSes -- but it works fine under emulation.

It's highly unlikely someone is going to create an entire run-time framework for a modern OS to run older software when there are already other methods available for doing so.

Re: [macOS] make PPC software run natively on macOS – Rosett

Posted: Mon Jan 07, 2019 12:08 am
by classicmacreborn
It is 'possible' to get OSX applications to run on x86 OSX with a PPC emulator core (although the software for it does not yet exist). It would be way easier to build something with an open source PPC emulator than try to modify or wrap Rosetta. It's called "user mode emulation". QEMU can do it with a Linux guest but not a Mac guest.

It would not work with OS9 applications as they rely on the classic mac libraries. There was someone briefly working on an OS9 compatibility layer. It didn't get very far and I don't think it's been worked on for a number of years. It's an immensely daunting task.

I've been a lot more interested recently in replicating the Classic Mac environment in x86 OSX. After all the work I've been doing on WrapperFinder, it naturally made me think of using the Toolbox's Window Manager to render windows to a graphics object and pass the object back to the host OS with a custom Finder. The graphics object would then be displayed by SDL. This would enable the emulator to display Mac OS 9 windows inside of OSX the way that Classic used to. There's a very good chance that these APIs or similar ones already exist in OS9 to support Classic. However, it should definitely be possible regardless. At the worst case, I already know that Window Manager has an API to get window coordinates, so it can pass that back to the emulator and SDL can crop it. It would be a lot of fun to build, and also a bit of work. But nothing even close to the complexity of reverse engineering the OS9 libraries.

Re: [macOS] make PPC software run natively on macOS – Rosett

Posted: Sat Jan 12, 2019 3:14 pm
by hifi

I just randomly I started writing a user mode emulation for an OS 7 application based on the single file (emul_ppc.c) BeOS PPC CPU emulator from SheepShaver. I guess that codebase has been abandoned for over 10 years but the CPU emulator was simple enough to start hacking. There's not much to see yet but I compiled an stdio Hello World application and I can basically run it now.

It's likely to be abandoned after I lose interest but here's an example output of it running the application and what it's internally doing, this is on x64-bit Linux. It took a good while to get the PEF loader working with all the pattern sections and relocations but I've tried to start more complex applications and it seems to initialize them just fine.

After minimal cleanups I can push it to GitHub under GPL if someone's interested. It's a huge hacky mess right now and it can barely do this. The libraries (like StdCLib) are implemented in native code and passed a CPU state to pull the arguments and set the return value to register r3.

The last 4 lines are prints (including the actual Hello World) from the native implementations of the functions that are being called from the emulated PPC CPU.

Code: Select all

$ ./peftool run hello

Running image 'hello' (756 bytes)

  RAM = 0x7f0be15c5010 (67108864 bytes)

Loading section 0 as code at 0x01000000
Loading section 1 as pattern at 0x02000000
 zero fill 36 bytes
 interleaveRepeatBlockWithZero(commonSize = 3, customSize = 1, repeatCount = 4)
 block copy 13 bytes
 zero fill 4 bytes
 block copy 8 bytes

Loading libraries:
 ... ./

Executing 1 relocation sections...
 5 relocations for section 1...
    RelocSmSetSectD section=1
     sectionD = 02000000
    RelocImportRun for 9 imports
     symbol _BreakPoint (using stub, emul__BreakPoint not found in any lib)
     symbol printf (found!)
     symbol __setjmp (found!)
     symbol _IntEnv (using memory)
     symbol __C_phase (using memory)
     symbol __target_for_exit (using memory)
     symbol _exit_status (using memory)
     symbol exit (found!)
     symbol __NubAt3 (using memory)
    RelocBySectD * 2
    RelocIncrPosition incr=4
     relocAddress += 4
    RelocTVector8 * 1
    @ 02000030 -> 00000028 + 01000000 (sectionC)
    @ 02000034 -> 0000002C + 02000000 (sectionD)
Emulation starting at 0x01000028 with TOC at 0x0200002C
Hello World!

Re: [macOS] make PPC software run natively on macOS – Rosett

Posted: Sun Jan 13, 2019 1:15 am
by adespoton
Thanks for sharing! This looks really interesting; of course, there's a lot more to running most Classic and OS X software than properly handling PEF and emulating the CPU calls, but these are the building blocks that enable further work down the line -- just look at how far we've come with QEMU in a few short years.

Re: [macOS] make PPC software run natively on macOS – Rosett

Posted: Sun Jan 13, 2019 8:13 am
by hifi
Here's the code pretty much as-is in the ugly state it's in:

It needs a lot of cleanup and refactoring (including some sort of memory allocator) but if someone finds the concept interesting enough maybe it could be continued. My goal was to run a few old MacOS games on Linux without the need of an actual copy of MacOS or boot ROM. Most simple games seem to depend only on InterfaceLib so that would be the biggest task to reimplement.

Re: [macOS] make PPC software run natively on macOS – Rosett

Posted: Mon Jan 28, 2019 9:02 am
by mePy2
Thanks for sharing :)

If I’m not replying it is because I don’t understand these things (yet!!!) xD
Have a nice day ya