diff options
| author | 2023-01-01 12:12:01 -0500 | |
|---|---|---|
| committer | 2023-06-03 00:05:28 -0700 | |
| commit | 7cdeaa90afc4e333af75262df1504aed05767509 (patch) | |
| tree | b18694c3293ba1f0264c77e4952362de64052ca4 | |
| parent | video_core: vulkan_device: Device initialization for Adreno. (diff) | |
| download | yuzu-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.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_address_space_info.cpp | 5 |
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 | ||
| 7 | namespace Core { | 7 | namespace Core { |
| 8 | 8 | ||
| 9 | #ifdef ANDROID | ||
| 10 | constexpr size_t VirtualReserveSize = 1ULL << 38; | ||
| 11 | #else | ||
| 12 | constexpr size_t VirtualReserveSize = 1ULL << 39; | ||
| 13 | #endif | ||
| 14 | |||
| 9 | DeviceMemory::DeviceMemory() | 15 | DeviceMemory::DeviceMemory() |
| 10 | : buffer{Kernel::Board::Nintendo::Nx::KSystemControl::Init::GetIntendedMemorySize(), | 16 | : buffer{Kernel::Board::Nintendo::Nx::KSystemControl::Init::GetIntendedMemorySize(), |
| 11 | 1ULL << 39} {} | 17 | VirtualReserveSize} {} |
| 12 | DeviceMemory::~DeviceMemory() = default; | 18 | DeviceMemory::~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, }, |