From a0742c34ef1f83bdd77daa92468614df575c0656 Mon Sep 17 00:00:00 2001 From: bythos14 <45720552+bythos14@users.noreply.github.com> Date: Mon, 10 Jun 2024 19:26:57 +0200 Subject: [PATCH] vita: Reduce ARAM size to minimum Allows us to take more memory for the heap --- core/linux-dist/main.cpp | 2 +- core/linux/vita_vmem.cpp | 4 ++-- core/types.h | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/linux-dist/main.cpp b/core/linux-dist/main.cpp index 1cbedf7176..098fdcfbd1 100644 --- a/core/linux-dist/main.cpp +++ b/core/linux-dist/main.cpp @@ -21,7 +21,7 @@ #include #include #include -int _newlib_heap_size_user = 246 * 1024 * 1024; +int _newlib_heap_size_user = 250 * 1024 * 1024; unsigned int sceUserMainThreadStackSize = 1 * 1024 * 1024; bool is_standalone = false; diff --git a/core/linux/vita_vmem.cpp b/core/linux/vita_vmem.cpp index d71ac4547f..d5b607e51e 100644 --- a/core/linux/vita_vmem.cpp +++ b/core/linux/vita_vmem.cpp @@ -57,8 +57,8 @@ static SceUID vmem_block = -1; bool init(void **vmem_base_addr, void **sh4rcb_addr, size_t ramSize) { - // Now try to allocate a contiguous piece of memory. - reserved_size = 512 * 1024 * 1024 + ALIGN(sizeof(Sh4RCB), PAGE_SIZE) + ARAM_SIZE_MAX; + // Now try to allocate a contiguous piece of memory. Extra 8MB is for ARAM mapping at 0x20000000 + reserved_size = 512 * 1024 * 1024 + ALIGN(sizeof(Sh4RCB), PAGE_SIZE) + 8_MB; reserved_base = nullptr; reserved_block = kuKernelMemReserve(&reserved_base, reserved_size, SCE_KERNEL_MEMBLOCK_TYPE_USER_RW); verify(reserved_block >= 0); diff --git a/core/types.h b/core/types.h index 67b12e63a7..c56210d800 100644 --- a/core/types.h +++ b/core/types.h @@ -262,9 +262,10 @@ constexpr size_t operator""_GB(unsigned long long x) #ifndef __vita__ constexpr u32 RAM_SIZE_MAX = 32_MB; constexpr u32 VRAM_SIZE_MAX = 16_MB; +constexpr u32 ARAM_SIZE_MAX = 8_MB; #else // Vita does not target Atomiswave/Naomi constexpr u32 RAM_SIZE_MAX = 16_MB; constexpr u32 VRAM_SIZE_MAX = 8_MB; +constexpr u32 ARAM_SIZE_MAX = 2_MB; #endif -constexpr u32 ARAM_SIZE_MAX = 8_MB;