summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-01-01 18:12:01 +0100
committerbunnei <bunneidev@gmail.com>2023-06-03 09:05:28 +0200
commit7cdeaa90afc4e333af75262df1504aed05767509 (patch)
treeb18694c3293ba1f0264c77e4952362de64052ca4
parentvideo_core: vulkan_device: Device initialization for Adreno. (diff)
downloadyuzu-7cdeaa90afc4e333af75262df1504aed05767509.tar
yuzu-7cdeaa90afc4e333af75262df1504aed05767509.tar.gz
yuzu-7cdeaa90afc4e333af75262df1504aed05767509.tar.bz2
yuzu-7cdeaa90afc4e333af75262df1504aed05767509.tar.lz
yuzu-7cdeaa90afc4e333af75262df1504aed05767509.tar.xz
yuzu-7cdeaa90afc4e333af75262df1504aed05767509.tar.zst
yuzu-7cdeaa90afc4e333af75262df1504aed05767509.zip
-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 @@
namespace Core {
+#ifdef ANDROID
+constexpr size_t VirtualReserveSize = 1ULL << 38;
+#else
+constexpr size_t VirtualReserveSize = 1ULL << 39;
+#endif
+
DeviceMemory::DeviceMemory()
: buffer{Kernel::Board::Nintendo::Nx::KSystemControl::Init::GetIntendedMemorySize(),
- 1ULL << 39} {}
+ VirtualReserveSize} {}
DeviceMemory::~DeviceMemory() = default;
} // 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{{
{ .bit_width = 36, .address = 2_GiB , .size = 64_GiB - 2_GiB , .type = KAddressSpaceInfo::Type::MapLarge, },
{ .bit_width = 36, .address = Size_Invalid, .size = 8_GiB , .type = KAddressSpaceInfo::Type::Heap, },
{ .bit_width = 36, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Alias, },
+#ifdef ANDROID
+ // With Android, we use a 38-bit address space due to memory limitations. This should (safely) truncate ASLR region.
+ { .bit_width = 39, .address = 128_MiB , .size = 256_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::Map39Bit, },
+#else
{ .bit_width = 39, .address = 128_MiB , .size = 512_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::Map39Bit, },
+#endif
{ .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::MapSmall },
{ .bit_width = 39, .address = Size_Invalid, .size = 8_GiB , .type = KAddressSpaceInfo::Type::Heap, },
{ .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::Alias, },