-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Basilisk II crash on Linux aarch64 #141
base: master
Are you sure you want to change the base?
Conversation
ugh seems SheepShaver needs some real porting work to run on aarch64: cebix/macemu#197 |
I've confirmed building SheepShaver does not hit the DIRECT_ADDRESSING case thus is unaffected by this patch. I haven't broken SheepShaver any more than it was already. I recommend merging. |
I can't speak for any of the other developers who have contributed to this project over the years, but the single goal of this fork is to build toward functional automated testing. Many of the architectures on which this emulator first ran are now antiques, which (to my mind) is an existential threat to the future of the codebase:
All this is to say: tell me how you'd test for the bug that's fixed by this patch, and I'll be glad to help set up CI to cover that case across all the platforms that modern CI will support. If the tests pass on CI, that's 90% the approval (the rest being whether the docs have been updated, and whether the changes are commented enough for the next contributor to follow along). I'l update the README with some of this. |
I remembered assert() exists so I improved the error reporting. :) Forcing MAP_BASE to 0x0 results in:
|
Can confirm this branch builds and runs on Raspbian 64 bit ( |
I just had an... interesting exchange with upstream then discovered the action is over here. But it did improve my understanding of the various addressing modes. So I offer my patch here. :)
Basilisk II fails to start a VM on Debian aarch64, in my case a Raspi4.
Add a printf debug and you can see this is because MAP_BASE defaults to 0x0 which is unavailable for security reasons on recent Linux distributions thus the memory allocator falls back on a standard allocation way up in 64bit address space, which fails the "sanity check" and returns a misleading "not enough memory" error to the user.
There are two fixes for this. Direct addressing mode can be fixed by bumping MAP_BASE up past the security/debug guard. Direct addressing mode is what configure currently defaults to on aarch64.
The other fix is to use banked addressing mode instead. This still requires a fix to not perform the "sanity check" which is not needed in this case.
This patch fixes both addressing modes. The default remains on direct addressing mode.
I have not touched the linux i386|FreeBSD|HAVE_LINKER_SCRIPT case as I assume its working properly but the more I learn the codebase, the more inclined i am to revise that bit as well... :)
This should fix Basilisk II on aarch64 without breaking current cases. I've also tested Linux x86_64. Please test and tell me if it breaks anything. (windows and macOS have their own code paths and should be unaffected)
I have not gotten around to getting SheepShaver running yet so I have not tested it.