summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Liam2023-01-01 12:12:01 -0500
committerGravatar bunnei2023-06-03 00:05:28 -0700
commit7cdeaa90afc4e333af75262df1504aed05767509 (patch)
treeb18694c3293ba1f0264c77e4952362de64052ca4
parentvideo_core: vulkan_device: Device initialization for Adreno. (diff)
downloadyuzu-7cdeaa90afc4e333af75262df1504aed05767509.tar.gz
yuzu-7cdeaa90afc4e333af75262df1504aed05767509.tar.xz
yuzu-7cdeaa90afc4e333af75262df1504aed05767509.zip
device_memory: Use smaller virtual reservation size for compatibility with 39-bit paging
-rw-r--r--src/core/device_memory.cpp8
-rw-r--r--src/core/hle/kernel/k_address_space_info.cpp5
2 files changed, 12 insertions, 1 deletions
diff --git a/src/core/device_memory.cpp b/src/core/device_memory.cpp
index f8b5be2b4..de3f8ef8f 100644
--- a/src/core/device_memory.cpp
+++ b/src/core/device_memory.cpp
@@ -6,9 +6,15 @@
6 6
7namespace Core { 7namespace Core {
8 8
9#ifdef ANDROID
10constexpr size_t VirtualReserveSize = 1ULL << 38;
11#else
12constexpr size_t VirtualReserveSize = 1ULL << 39;
13#endif
14
9DeviceMemory::DeviceMemory() 15DeviceMemory::DeviceMemory()
10 : buffer{Kernel::Board::Nintendo::Nx::KSystemControl::Init::GetIntendedMemorySize(), 16 : buffer{Kernel::Board::Nintendo::Nx::KSystemControl::Init::GetIntendedMemorySize(),
11 1ULL << 39} {} 17 VirtualReserveSize} {}
12DeviceMemory::~DeviceMemory() = default; 18DeviceMemory::~DeviceMemory() = default;
13 19
14} // namespace Core 20} // namespace Core
diff --git a/src/core/hle/kernel/k_address_space_info.cpp b/src/core/hle/kernel/k_address_space_info.cpp
index c36eb5dc4..32173e52b 100644
--- a/src/core/hle/kernel/k_address_space_info.cpp
+++ b/src/core/hle/kernel/k_address_space_info.cpp
@@ -25,7 +25,12 @@ constexpr std::array<KAddressSpaceInfo, 13> AddressSpaceInfos{{
25 { .bit_width = 36, .address = 2_GiB , .size = 64_GiB - 2_GiB , .type = KAddressSpaceInfo::Type::MapLarge, }, 25 { .bit_width = 36, .address = 2_GiB , .size = 64_GiB - 2_GiB , .type = KAddressSpaceInfo::Type::MapLarge, },
26 { .bit_width = 36, .address = Size_Invalid, .size = 8_GiB , .type = KAddressSpaceInfo::Type::Heap, }, 26 { .bit_width = 36, .address = Size_Invalid, .size = 8_GiB , .type = KAddressSpaceInfo::Type::Heap, },
27 { .bit_width = 36, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Alias, }, 27 { .bit_width = 36, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Alias, },
28#ifdef ANDROID
29 // With Android, we use a 38-bit address space due to memory limitations. This should (safely) truncate ASLR region.
30 { .bit_width = 39, .address = 128_MiB , .size = 256_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::Map39Bit, },
31#else
28 { .bit_width = 39, .address = 128_MiB , .size = 512_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::Map39Bit, }, 32 { .bit_width = 39, .address = 128_MiB , .size = 512_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::Map39Bit, },
33#endif
29 { .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::MapSmall }, 34 { .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::MapSmall },
30 { .bit_width = 39, .address = Size_Invalid, .size = 8_GiB , .type = KAddressSpaceInfo::Type::Heap, }, 35 { .bit_width = 39, .address = Size_Invalid, .size = 8_GiB , .type = KAddressSpaceInfo::Type::Heap, },
31 { .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::Alias, }, 36 { .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::Alias, },