Open VorpalBlade opened 10 months ago
Looking further into this it seems to happen because of this code:
#if REAL_ADDRESSING && HAVE_LINKER_SCRIPT
if (vm_mac_acquire_fixed(0, RAMSize) == 0) {
D(bug("Could allocate RAM from 0x0000\n"));
RAMBase = 0;
RAMBaseHost = Mac2HostAddr(RAMBase);
memory_mapped_from_zero = true;
}
#endif
if (!memory_mapped_from_zero) {
#ifndef PAGEZERO_HACK
// Create Low Memory area (0x0000..0x3000)
if (vm_mac_acquire_fixed(0, 0x3000) < 0) {
sprintf(str, GetString(STR_LOW_MEM_MMAP_ERR), strerror(errno));
ErrorAlert(str);
goto quit;
}
lm_area_mapped = true;
#endif
It appears that on my system REAL_ADDRESSING and HAVE_LINKER_SCRIPT is true (so the first block is executed). That creates a mapping up to ram size successfully. However, the call to vm_protect in vm_alloc.cpp then fails for some odd reason. This makes the whole call fail. Which in turn causes the second branch (!memory_mapped_from_zero
in main_unix.cpp) to be entered incorrectly.
I have created a bug report in Arch Linux against the arch kernel, but I will need to figure out if this is an upstream kernel regression also.
Any word on this? It's doesn't seem distro dependent as it's still a problem in fedora 39 against kernel 6.6.12
It was a kernel regression. It was fixed in 6.5.7. I haven't used sheepshaver in a while now, are you saying it is broken again? If so, you should probably show it can be reproduced on an upstream kernel and report it.
Unfortunately for me it was never fixed. It has been a problem since 6.5. I've been testing it periodically since. Perhaps whatever patch was made never made it into fedora?
I believe it was fixed upstream, and Arch Linux uses close to upstream kernels.
current ubuntu 22.04.03 is using 6.5.0-15-generic kernel and is not fixed. i try to use 6.5.11 and see if it is fixed. but that kernel version might not run with 22.04.3
edit: the later kernels 6.5.11 / 6.6 do not work and create an error when installing. so the issue remains. pity as sheepshaver is much better performing than qemu.
This is not only an Arch Linux problem but also occurring on other distros. I have the same problem on an Ubuntu 23.10 variant. uname -a output
6.5.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:59:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Yeah I can see that being a problem on more "stable" distros for a while.
I had found out a couple days ago that when I run Sheepshaver in terminal I no longer get the "ERROR: Cannot map Low Memory Globals: Cannot allocate memory." So maybe I did get the patch.
The issue is when I open sheepshaver I still get a message that I can't not load extensions because there is no virtual ram. Really odd as I don't think that was ever emulated properly in sheepshaver. I'm a little disappointed because I started having that issue when this issue popped up so I was sure it was the same problem.. I didn't make any other changes but the normal updates
For some reason, it seems
sysctl vm.mmap_min_addr=0
is no longer enough to make SheepShaver work on kernel 6.5.2-arch1-1 (from Arch Linux).I now keep getting
ERROR: Cannot map Low Memory Globals: Cannot allocate memory.
though this worked fine yesterday.In addition it segfaults if I try to build with direct addressing mode instead (I will investigate that and possibly open a separate bug about it).