diff --git a/src/core/address_space.cpp b/src/core/address_space.cpp index c0102ebcd..394201cf0 100644 --- a/src/core/address_space.cpp +++ b/src/core/address_space.cpp @@ -632,7 +632,7 @@ struct AddressSpace::Impl { mmap(reinterpret_cast(USER_MIN), user_size, protection_flags, map_flags, -1, 0)); #else const auto virtual_size = system_managed_size + system_reserved_size + user_size; -#if defined(ARCH_X86_64) +#if defined(ARCH_X86_64) && !defined(__FreeBSD__) const auto virtual_base = reinterpret_cast(mmap(reinterpret_cast(SYSTEM_MANAGED_MIN), virtual_size, protection_flags, map_flags, -1, 0)); @@ -640,8 +640,10 @@ struct AddressSpace::Impl { system_reserved_base = reinterpret_cast(SYSTEM_RESERVED_MIN); user_base = reinterpret_cast(USER_MIN); #else + // FreeBSD can't stand MAP_FIXED or it may overwrite mmap() itself! // Map memory wherever possible and instruction translation can handle offsetting to the // base. + map_flags &= ~MAP_FIXED; const auto virtual_base = reinterpret_cast(mmap(nullptr, virtual_size, protection_flags, map_flags, -1, 0)); system_managed_base = virtual_base; diff --git a/src/sdl_window.cpp b/src/sdl_window.cpp index 766a336c2..5fece2259 100644 --- a/src/sdl_window.cpp +++ b/src/sdl_window.cpp @@ -141,7 +141,8 @@ WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameControllers* controller window_info.type = WindowSystemType::Windows; window_info.render_surface = SDL_GetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); -#elif defined(SDL_PLATFORM_LINUX) +#elif defined(SDL_PLATFORM_LINUX) || defined(__FreeBSD__) + // SDL doesn't have a platform define for FreeBSD AAAAAAAAAA if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) { window_info.type = WindowSystemType::X11; window_info.display_connection = SDL_GetPointerProperty(