mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 00:45:46 -04:00
CMake: Determine host page size at build time
Needed for running on Asahi Linux.
This commit is contained in:
@ -105,7 +105,12 @@ if(ANDROID)
|
||||
target_link_libraries(common PRIVATE log)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
if(LINUX)
|
||||
# We need -lrt for shm_unlink
|
||||
target_link_libraries(common PRIVATE rt)
|
||||
endif()
|
||||
|
||||
# If the host size was detected, we need to set it as a macro.
|
||||
if(HOST_PAGE_SIZE)
|
||||
target_compile_definitions(common PUBLIC "-DOVERRIDE_HOST_PAGE_SIZE=${HOST_PAGE_SIZE}")
|
||||
endif()
|
||||
|
@ -1,7 +1,8 @@
|
||||
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||
|
||||
#pragma once
|
||||
#include <bit>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
@ -170,7 +171,11 @@ struct dependent_int_false : std::false_type
|
||||
#endif
|
||||
|
||||
// Host page sizes.
|
||||
#if defined(__APPLE__) && defined(__aarch64__)
|
||||
#if defined(OVERRIDE_HOST_PAGE_SIZE)
|
||||
static constexpr u32 HOST_PAGE_SIZE = OVERRIDE_HOST_PAGE_SIZE;
|
||||
static constexpr u32 HOST_PAGE_MASK = HOST_PAGE_SIZE - 1;
|
||||
static constexpr u32 HOST_PAGE_SHIFT = std::bit_width(HOST_PAGE_MASK);
|
||||
#elif defined(__APPLE__) && defined(__aarch64__)
|
||||
static constexpr u32 HOST_PAGE_SIZE = 0x4000;
|
||||
static constexpr u32 HOST_PAGE_MASK = HOST_PAGE_SIZE - 1;
|
||||
static constexpr u32 HOST_PAGE_SHIFT = 14;
|
||||
|
@ -135,7 +135,6 @@ static constexpr u32 RECOMPILER_FAR_CODE_CACHE_SIZE = 16 * 1024 * 1024;
|
||||
#endif
|
||||
|
||||
#ifdef USE_STATIC_CODE_BUFFER
|
||||
static constexpr u32 RECOMPILER_GUARD_SIZE = 4096;
|
||||
alignas(HOST_PAGE_SIZE) static u8 s_code_storage[RECOMPILER_CODE_CACHE_SIZE + RECOMPILER_FAR_CODE_CACHE_SIZE];
|
||||
#endif
|
||||
|
||||
@ -170,8 +169,8 @@ bool CPU::CodeCache::ProcessStartup()
|
||||
|
||||
#ifdef ENABLE_RECOMPILER_SUPPORT
|
||||
#ifdef USE_STATIC_CODE_BUFFER
|
||||
const bool has_buffer = s_code_buffer.Initialize(s_code_storage, sizeof(s_code_storage),
|
||||
RECOMPILER_FAR_CODE_CACHE_SIZE, RECOMPILER_GUARD_SIZE);
|
||||
const bool has_buffer =
|
||||
s_code_buffer.Initialize(s_code_storage, sizeof(s_code_storage), RECOMPILER_FAR_CODE_CACHE_SIZE, HOST_PAGE_SIZE);
|
||||
#else
|
||||
const bool has_buffer = false;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user