SheepShaver on Apple M1

About SheepShaver, a PPC Mac emulator for Windows, MacOS X, and Linux that can run System 7.5.3 to MacOS 9.0.4.

Moderators: Cat_7, Ronald P. Regensburg, ClockWise

Post Reply
shearer
Space Cadet
Posts: 2
Joined: Tue Nov 24, 2020 3:54 am

SheepShaver on Apple M1

Post by shearer »

Is there any possibility of seeing SheepShaver receive a native Apple M1 build in the future?

Currently the emulation runs quite slow compared to Intel, although this slowdown only appears mostly in the Finder. Many of the applications I tried that take over the screen have been running well.

Love this project and would love to see it continue to run well on current and future Macs.
User avatar
Ronald P. Regensburg
Expert User
Posts: 6711
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: SheepShaver on Apple M1

Post by Ronald P. Regensburg »

Good to know that SheepShaver runs on M1 Macs with the help of Rosetta 2.

I expect future arm64 or universal (x86_64 arm64) builds.

kanjitalk755 made his fork ready to build for Apple Silicon. It has not been tested yet. It seems the code was excluded later to avoid errors in Xcode 12.2

See his post in the forum here: viewtopic.php?p=67308#p67308
His fork is here: https://github.com/kanjitalk755/macemu

(kanjitalk755 fork is the source we use since a couple of years for BasiliskII and SheepShaver builds posted here in emaculation forum.)
Elyus
Tinkerer
Posts: 90
Joined: Wed Mar 21, 2012 12:35 am

Re: SheepShaver on Apple M1

Post by Elyus »

I've been experimenting with this on and off for a few days, and kanjitalk's fork does build, although you have to build a universal or native SDL2.framework to embed.

However, in a bizarre set of errors I've not really encountered before, arm64 SheepShaver currently refuses to launch. I've tried all sorts of different signing configurations, beta Xcode, and looking in various places to track down the errors. This is one problem with Apple's new processors which makes it tricky for developers—they're not really exposing enough information for developers to effectively debug certain issues.

Not being able to decrypt the errors or find any helpful resources myself, I gave up and joined Apple's Developer forum yesterday to ask about it: https://developer.apple.com/forums/thread/667698. Of course, it's good to have a post here as well; kanjitalk is exceedingly knowledgeable and may have some ideas about the source of the problem.

It's worth noting, even if we can get the build to launch, there's still some things to overcome. Notably, sigsegv for handling illegal instructions doesn't seem to support arm64 threads and registers. Regardless, I'm confident the jump to M1 will happen soon, and I'm looking forward to seeing the types of speed benefits the single-core focus of Apple's M1 will provide.
shearer
Space Cadet
Posts: 2
Joined: Tue Nov 24, 2020 3:54 am

Re: SheepShaver on Apple M1

Post by shearer »

Good to hear - can’t wait to see how it will perform on the new chips!
emendelson
Forum All-Star
Posts: 1268
Joined: Tue Oct 14, 2008 12:12 am

Re: SheepShaver on Apple M1

Post by emendelson »

Has anyone tried building SS or BII for M1 recently??
User avatar
Ronald P. Regensburg
Expert User
Posts: 6711
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: SheepShaver on Apple M1

Post by Ronald P. Regensburg »

Not that I am aware of. Earlier trials resulted in error messages. I suppose that kanjitalk755 will need assistance with debugging.

BTW: It may be better to speak of building for arm64 or for Apple Silicon, M1 is only the first member of that family.
Jagmn
Student Driver
Posts: 14
Joined: Fri Feb 19, 2021 7:37 am

Re: SheepShaver on Apple M1

Post by Jagmn »

Just a heads up that I've been experimenting with building SS on the M1. It looks like the main issue is that the zeropage_size linker setting results in binaries that just won't run on aarch64 - though I'm willing to be challenged on this.

After some considerable delving into SS's memory management, I've got something booting that creates a more dynamic Mac<->host memory map but I need to spend more time understanding and cleaning everything up before it'd be ready for a patch. If anyone has a cleaner approach (amidst the plethora of memory approaches there already seems to be) do shout out!
Jagmn
Student Driver
Posts: 14
Joined: Fri Feb 19, 2021 7:37 am

Re: SheepShaver on Apple M1

Post by Jagmn »

For those interested in a native M1 build:

I've managed to get a fairly minimal set of changes to build SS for the M1 using the NATMEM_OFFSET build time option.

Running MacBench 5 against a few build combinations on the M1 shows that the SheepShaver JIT on x86_64 (under Rosetta 2) beats the native aarch64 build (which does not have JIT enabled / needs more work to port the JIT across). If you disable the x86_64 JIT then the aarch64 native build is faster but not by orders of magnitude.
User avatar
Ronald P. Regensburg
Expert User
Posts: 6711
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: SheepShaver on Apple M1

Post by Ronald P. Regensburg »

What is the difference between aarch64 and arm64, or is it the same? Apple refers to it as arm64 (or Apple Silicon).
User avatar
adespoton
Forum All-Star
Posts: 3341
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: SheepShaver on Apple M1

Post by adespoton »

aarch64 is what the QEMU project calls its ARM 64-bit Architecture core. It's essentially synonymous with ARM64.
Jagmn
Student Driver
Posts: 14
Joined: Fri Feb 19, 2021 7:37 am

Re: SheepShaver on Apple M1

Post by Jagmn »

Whew. So I've managed to get the JIT running on the M1. What a learning experience that has been! No-where near ready to have anything to submit upstream but it seems to work and boosts performance well above the x86_64-JIT-on-Rosetta experience (nearly 2x).

Probably not the right thread for the query but: it looks like SheepShaver's JIT was based on an old version of QEMU. Has anyone looked at getting a modern QEMU JIT working instead?
User avatar
adespoton
Forum All-Star
Posts: 3341
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: SheepShaver on Apple M1

Post by adespoton »

I stopped using JIT over 5 years ago, due to it being less stable, and no-JIT being more than fast enough.

Do you see an advantage to running M1 JIT over M1 no-JIT? Is M1 no-JIT faster than R2-JIT?
Jagmn
Student Driver
Posts: 14
Joined: Fri Feb 19, 2021 7:37 am

Re: SheepShaver on Apple M1

Post by Jagmn »

I see definite speed advantages with JIT vs no-JIT. This is helpful as I like to do graphics work in OS9 apps and the boost makes it easier/nicer for me to work with larger files.

I've been using MacBench 5.0 to compare speeds. My current set of results all running under Apple's M1:
  • SS Downloaded running w/JIT in Rosetta 2: 271%
  • SS Built for M1 running w/JIT: 470%
  • SS Downloaded running w/NoJIT in Rosetta 2: 73%
  • SS Built for M1 running w/NoJIT: 96%
The benchmark number (100%) is against a PowerMac G3 300Mhz.
User avatar
adespoton
Forum All-Star
Posts: 3341
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: SheepShaver on Apple M1

Post by adespoton »

Interesting... so M1 JIT is performing at an approximate equivalent of a 1.4GHz PPC!
I should run MacBench 5 on my Intel machine and see how it compares.

One note of worth is that the old benchmarking tools often show wildly skewed results on emulators due to what does and doesn't get emulated accurately. I presume you have "Don't Use CPU When Idle" disabled?
Jagmn
Student Driver
Posts: 14
Joined: Fri Feb 19, 2021 7:37 am

Re: SheepShaver on Apple M1

Post by Jagmn »

I do have "idlewait true" in my preferences file. I haven't experimented with flipping it.

With regards to the JIT being buggy: I do see some flakiness occasionally and am zoning in on where I think the problem is (jit-cache invalidate + branching/block behaviour around that).
Post Reply