From 300046b60ba20314441619773f40eadcccac4125 Mon Sep 17 00:00:00 2001 From: Merry Date: Sat, 31 Dec 2022 16:04:56 +0000 Subject: [PATCH] backend/arm64/address_space: Assert that code_cache_size <= 128 MiB --- src/dynarmic/backend/arm64/address_space.cpp | 2 ++ src/dynarmic/interface/A32/config.h | 6 +++--- src/dynarmic/interface/A64/config.h | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/dynarmic/backend/arm64/address_space.cpp b/src/dynarmic/backend/arm64/address_space.cpp index c555ce9b..766203a1 100644 --- a/src/dynarmic/backend/arm64/address_space.cpp +++ b/src/dynarmic/backend/arm64/address_space.cpp @@ -21,6 +21,8 @@ AddressSpace::AddressSpace(size_t code_cache_size) , mem(code_cache_size) , code(mem.ptr()) , fastmem_manager(exception_handler) { + ASSERT_MSG(code_cache_size <= 128 * 1024 * 1024, "code_cache_size > 128 MiB not currently supported"); + exception_handler.Register(mem, code_cache_size); exception_handler.SetFastmemCallback([this](u64 host_pc) { return FastmemCallback(host_pc); diff --git a/src/dynarmic/interface/A32/config.h b/src/dynarmic/interface/A32/config.h index 33f6e194..a71dd03d 100644 --- a/src/dynarmic/interface/A32/config.h +++ b/src/dynarmic/interface/A32/config.h @@ -228,9 +228,9 @@ struct UserConfig { /// in unusual behavior. bool always_little_endian = false; - // Minimum size is about 8MiB. Maximum size is about 2GiB. Maximum size is limited by - // the maximum length of a x64 jump. - size_t code_cache_size = 256 * 1024 * 1024; // bytes + // Minimum size is about 8MiB. Maximum size is about 128MiB (arm64 host) or 2GiB (x64 host). + // Maximum size is limited by the maximum length of a x86_64 / arm64 jump. + size_t code_cache_size = 128 * 1024 * 1024; // bytes }; } // namespace A32 diff --git a/src/dynarmic/interface/A64/config.h b/src/dynarmic/interface/A64/config.h index 409e0048..390f3159 100644 --- a/src/dynarmic/interface/A64/config.h +++ b/src/dynarmic/interface/A64/config.h @@ -285,9 +285,9 @@ struct UserConfig { /// AddTicks and GetTicksRemaining are never called, and no cycle counting is done. bool enable_cycle_counting = true; - // Minimum size is about 8MiB. Maximum size is about 2GiB. Maximum size is limited by - // the maximum length of a x64 jump. - size_t code_cache_size = 256 * 1024 * 1024; // bytes + // Minimum size is about 8MiB. Maximum size is about 128MiB (arm64 host) or 2GiB (x64 host). + // Maximum size is limited by the maximum length of a x86_64 / arm64 jump. + size_t code_cache_size = 128 * 1024 * 1024; // bytes }; } // namespace A64