SheepShaver on Apple M1
Moderators: Cat_7, Ronald P. Regensburg, ClockWise
SheepShaver on Apple M1
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.
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.
- Ronald P. Regensburg
- Expert User
- Posts: 7830
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: SheepShaver on Apple M1
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.)
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.)
Re: SheepShaver on Apple M1
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.
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.
Re: SheepShaver on Apple M1
Good to hear - can’t wait to see how it will perform on the new chips!
-
- Forum All-Star
- Posts: 1726
- Joined: Tue Oct 14, 2008 12:12 am
Re: SheepShaver on Apple M1
Has anyone tried building SS or BII for M1 recently??
- Ronald P. Regensburg
- Expert User
- Posts: 7830
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: SheepShaver on Apple M1
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.
BTW: It may be better to speak of building for arm64 or for Apple Silicon, M1 is only the first member of that family.
Re: SheepShaver on Apple M1
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!
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!
Re: SheepShaver on Apple M1
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.
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.
- Ronald P. Regensburg
- Expert User
- Posts: 7830
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: SheepShaver on Apple M1
What is the difference between aarch64 and arm64, or is it the same? Apple refers to it as arm64 (or Apple Silicon).
- adespoton
- Forum All-Star
- Posts: 4274
- Joined: Fri Nov 27, 2009 5:11 am
- Location: Emaculation.com
- Contact:
Re: SheepShaver on Apple M1
aarch64 is what the QEMU project calls its ARM 64-bit Architecture core. It's essentially synonymous with ARM64.
Re: SheepShaver on Apple M1
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?
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?
- adespoton
- Forum All-Star
- Posts: 4274
- Joined: Fri Nov 27, 2009 5:11 am
- Location: Emaculation.com
- Contact:
Re: SheepShaver on Apple M1
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?
Do you see an advantage to running M1 JIT over M1 no-JIT? Is M1 no-JIT faster than R2-JIT?
Re: SheepShaver on Apple M1
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:
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%
- adespoton
- Forum All-Star
- Posts: 4274
- Joined: Fri Nov 27, 2009 5:11 am
- Location: Emaculation.com
- Contact:
Re: SheepShaver on Apple M1
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?
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?
Re: SheepShaver on Apple M1
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).
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).
Re: SheepShaver on Apple M1
It looks like we now have a native build for M1 and this is working well for others! Very excited to try it out.
Unfortunately it won't run on my M1 Mac Mini, it closes immediately at startup.
The Intel version of SheepShaver still launches just fine. What should I be looking at to troubleshoot this? It's as if the M1 SheepShaver can't locate my Mac OS ROM file, is there a file I can edit to point it in the right direction?
I've looked at the documentation and other threads but couldn't find an answer, thanks in advance.
Edit: Interestingly, when I open the app using Rosetta it does launch just like the Intel build. But this doesn't give me any speed advantages.
Unfortunately it won't run on my M1 Mac Mini, it closes immediately at startup.
The Intel version of SheepShaver still launches just fine. What should I be looking at to troubleshoot this? It's as if the M1 SheepShaver can't locate my Mac OS ROM file, is there a file I can edit to point it in the right direction?
I've looked at the documentation and other threads but couldn't find an answer, thanks in advance.
Edit: Interestingly, when I open the app using Rosetta it does launch just like the Intel build. But this doesn't give me any speed advantages.
Last edited by shearer on Tue May 18, 2021 9:08 pm, edited 1 time in total.
- Ronald P. Regensburg
- Expert User
- Posts: 7830
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: SheepShaver on Apple M1
The app should be installed in the same location as the working Intel version.
If it is, and it quits on launch, you may have been bitten by a security feature in macOS.
Try this:
- Copy the SheepShaver application to a different location, like your desktop
- Trash the original application
- Move the copy back to the location where you installed the original
If it is, and it quits on launch, you may have been bitten by a security feature in macOS.
Try this:
- Copy the SheepShaver application to a different location, like your desktop
- Trash the original application
- Move the copy back to the location where you installed the original
Re: SheepShaver on Apple M1
Thanks, I have followed these steps but it hasn't given me a different result. It still won't launch, however when I tell it to open in Rosetta, it does launch (at a similar or the same speeds as the Intel build on a M1 Mac).Ronald P. Regensburg wrote: ↑Tue May 18, 2021 9:08 pm The app should be installed in the same location as the working Intel version.
If it is, and it quits on launch, you may have been bitten by a security feature in macOS.
Try this:
- Copy the SheepShaver application to a different location, like your desktop
- Trash the original application
- Move the copy back to the location where you installed the original
- Ronald P. Regensburg
- Expert User
- Posts: 7830
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: SheepShaver on Apple M1
This build is supposed to run natively on arm64. I cannot test it myself, the M1 iMac I ordered will arrive next month. The Intel part of this first universal build should be identical to the final Intel build, so you might as well use that one for now.
Re: SheepShaver on Apple M1
Will do, I'll keep an eye out to see anyone else mention similar issues.
Re: SheepShaver on Apple M1
The Universal build (SheepShaver_universal_20210428.zip) seems to run fine for me (well; a boot, reboot, launch-app test works without issue).
What do you see if you try running it from Terminal.app? You can launch terminal then run the following:
Code: Select all
/path/to/SheepShaver.app/Contents/MacOS/SheepShaver
When I run that build with my ROM and OS9.0.4 disk, I get:
Code: Select all
SheepShaver V2.5 by Christian Bauer and Mar"c" Hellwig
Reading ROM file...
Using SDL/coreaudio audio output
selected Ethernet device type slirp
Using SDL_Renderer driver: metal
PowerPC CPU emulator by Gwenole Beauchesne
ioctl(DKIOCCDREADTOC) failed: Bad file descriptor
ioctl(DKIOCCDREADTOC) failed: Bad file descriptor
WARNING: Unknown DiskStatus(6)
WARNING: Unknown DiskStatus(6)
Re: SheepShaver on Apple M1
Thanks for this, when I launch it via the terminal I can launch SheepShaver on this M1 Mac Mini.Jagmn wrote: ↑Wed May 19, 2021 12:39 pmThe Universal build (SheepShaver_universal_20210428.zip) seems to run fine for me (well; a boot, reboot, launch-app test works without issue).
What do you see if you try running it from Terminal.app? You can launch terminal then run the following:(You can drag-n-drop the SheepShaver.app file to get the /path/to/SheepShaver.app portion, then add the /Contents/MacOS/SheepShaver part.)Code: Select all
/path/to/SheepShaver.app/Contents/MacOS/SheepShaver
When I run that build with my ROM and OS9.0.4 disk, I get:Code: Select all
SheepShaver V2.5 by Christian Bauer and Mar"c" Hellwig Reading ROM file... Using SDL/coreaudio audio output selected Ethernet device type slirp Using SDL_Renderer driver: metal PowerPC CPU emulator by Gwenole Beauchesne ioctl(DKIOCCDREADTOC) failed: Bad file descriptor ioctl(DKIOCCDREADTOC) failed: Bad file descriptor WARNING: Unknown DiskStatus(6) WARNING: Unknown DiskStatus(6)
When I double click the app icon in the Finder it doesn't launch.
This is what it tells me:
Code: Select all
SheepShaver V2.5 by Christian Bauer and Mar"c" Hellwig
Reading ROM file...
Using SDL/coreaudio audio output
selected Ethernet device type slirp
Using SDL_Renderer driver: metal
Detected CPU features: MMX SSE SSE2 SSE3 SSSE3
PowerPC CPU emulator by Gwenole Beauchesne
WARNING: Unknown DiskStatus(6)
WARNING: Unknown DiskStatus(6)
WARNING: Unknown DiskStatus(6)
WARNING: Unknown DiskStatus(6)
My old Intel Macbook Pro runs SheepShaver about 3x faster, so that doesn't seem right.
Last edited by shearer on Thu May 20, 2021 7:02 pm, edited 2 times in total.
Re: SheepShaver on Apple M1
I just noticed I had set my entire Terminal to run using Rosetta for another project.
When I disable that and launch SheepShaver with your instructions, it fails to launch and sends me this message:
EDIT: And this solves the problem. I had my SheepShaver setup to use 1,024MB in RAM. I booted in Rosetta and changed this to 512MB, and now it launches just fine (and fast!) without Rosetta!
When I disable that and launch SheepShaver with your instructions, it fails to launch and sends me this message:
Code: Select all
SheepShaver V2.5 by Christian Bauer and Mar"c" Hellwig
ERROR: Cannot map ROM: Cannot allocate memory.
EDIT: And this solves the problem. I had my SheepShaver setup to use 1,024MB in RAM. I booted in Rosetta and changed this to 512MB, and now it launches just fine (and fast!) without Rosetta!
- Ronald P. Regensburg
- Expert User
- Posts: 7830
- Joined: Thu Feb 09, 2006 10:24 pm
- Location: Amsterdam, Netherlands
Re: SheepShaver on Apple M1
SheepShaver is inflexible in which location in memory it uses. The error is typical for when other processes are occupying that specific location in memory. I was about to ask you if SheepShaver would launch after a restart of your Mac Mini. Usually that solves the problem.
Good that you solved it by assigning less RAM. And 512 MB is plenty for most purposes.
Good that you solved it by assigning less RAM. And 512 MB is plenty for most purposes.
- adespoton
- Forum All-Star
- Posts: 4274
- Joined: Fri Nov 27, 2009 5:11 am
- Location: Emaculation.com
- Contact:
Re: SheepShaver on Apple M1
Hmm... you just gave me an idea. SheepShaver uses fixed memory references and so needs that particular chunk of memory. I wonder how difficult it would be to add a memmap routine such that it still requires a contiguous chunk, but it doesn't have to start at 0? Windows, macOS and Linux all support this now, so in theory it *should* be possible with a single added function in the setup routine.Ronald P. Regensburg wrote: ↑Thu May 20, 2021 7:19 pm SheepShaver is inflexible in which location in memory it uses. The error is typical for when other processes are occupying that specific location in memory. I was about to ask you if SheepShaver would launch after a restart of your Mac Mini. Usually that solves the problem.
Good that you solved it by assigning less RAM. And 512 MB is plenty for most purposes.