Skip to content
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 crash on aarch64 linux. #225

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion BasiliskII/src/CrossPlatform/vm_alloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ typedef unsigned long vm_uintptr_t;
#define MAP_ANONYMOUS 0
#endif

/* NOTE: on linux MAP_32BIT is only implemented on AMD64
it is a null op on all other architectures
thus the MAP_BASE setting below is the only thing
ensuring low addresses on aarch64 for example */
#define MAP_EXTRA_FLAGS (MAP_32BIT)

#ifdef HAVE_MMAP_VM
Expand All @@ -91,7 +95,18 @@ typedef unsigned long vm_uintptr_t;
don't get addresses above when the program is run on AMD64.
NOTE: this is empirically determined on Linux/x86. */
#define MAP_BASE 0x10000000
#else
#elif !REAL_ADDRESSING
/* linux does not implement any useful fallback behavior
such as allocating the next available address
and the first 4k-64k of address space is marked unavailable
for security reasons (see https://wiki.debian.org/mmap_min_addr)
so we must start requesting after the first page
(or we get a high 64bit address and break on aarch64)

leaving NULL unmapped is a good idea anyway for debugging reasons
so we do this unconditionally on all platforms */
#define MAP_BASE 0x00010000
#else /* must be 0x0 when REAL_ADDRESSING=1 */
#define MAP_BASE 0x00000000
#endif
static char * next_address = (char *)MAP_BASE;
Expand Down