mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-27 16:02:37 +00:00
kernel: default flexible memory to 448 MiB and charge loaded modules' segments to it
This commit is contained in:
1 parent
2483573651
commit
0a140911ad
5 files changed
+84
-3
No files matched your search
+24
-1
@@ -67,7 +67,7 @@ constexpr uint64_t PAGE_TABLE_POOL_SIZE = 4ull * 1024ull * 1024ull * 1024ull;
|
||||
constexpr uint64_t PAGE_TABLE_GRANULARITY = 2ull * 1024ull * 1024ull;
|
||||
constexpr int PAGE_TABLE_POOL_ENTRIES =
|
||||
static_cast<int>(PAGE_TABLE_POOL_SIZE / PAGE_TABLE_GRANULARITY);
|
||||
constexpr uint64_t DEFAULT_FLEXIBLE_MEMORY_SIZE = 1ull * 1024ull * 1024ull * 1024ull;
|
||||
constexpr uint64_t DEFAULT_FLEXIBLE_MEMORY_SIZE = 448ull * 1024ull * 1024ull;
|
||||
|
||||
static uint64_t g_flexible_memory_size = DEFAULT_FLEXIBLE_MEMORY_SIZE;
|
||||
static bool g_flexible_memory_size_frozen = false;
|
||||
@@ -738,6 +738,8 @@ public:
|
||||
|
||||
static uint64_t Size() { return g_flexible_memory_size; }
|
||||
uint64_t Available();
|
||||
void Charge(uint64_t size);
|
||||
void Release(uint64_t size);
|
||||
|
||||
bool Map(uint64_t vaddr, size_t len, int prot, VirtualMemory::Mode mode, GpuAccessMode gpu_mode,
|
||||
const char* name);
|
||||
@@ -1967,6 +1969,19 @@ uint64_t FlexibleMemory::Available() {
|
||||
return (Size() >= m_allocated_total ? Size() - m_allocated_total : 0);
|
||||
}
|
||||
|
||||
void FlexibleMemory::Charge(uint64_t size) {
|
||||
Common::LockGuard lock(m_mutex);
|
||||
|
||||
m_allocated_total += size;
|
||||
}
|
||||
|
||||
void FlexibleMemory::Release(uint64_t size) {
|
||||
Common::LockGuard lock(m_mutex);
|
||||
|
||||
EXIT_IF(size > m_allocated_total);
|
||||
m_allocated_total -= size;
|
||||
}
|
||||
|
||||
void PooledMemory::AddFreeUnlocked(uint64_t start, uint64_t size) {
|
||||
if (size == 0) {
|
||||
return;
|
||||
@@ -3770,6 +3785,14 @@ uint64_t AllocateProgramMemory(uint64_t search_addr, uint64_t size, VirtualMemor
|
||||
return AllocateGuestRuntimeMemory(search_addr, size, mode, name, VirtualRangeType::Code, false);
|
||||
}
|
||||
|
||||
void ChargeFlexibleMemory(uint64_t size) {
|
||||
g_flexible_memory->Charge(size);
|
||||
}
|
||||
|
||||
void ReleaseFlexibleMemory(uint64_t size) {
|
||||
g_flexible_memory->Release(size);
|
||||
}
|
||||
|
||||
void SetProgramMemoryProtection(uint64_t vaddr, uint64_t size, VirtualMemory::Mode mode) {
|
||||
std::lock_guard<std::recursive_mutex> memory_operation_lock(g_memory_operation_mutex);
|
||||
|
||||
|
||||
Reference in new issue
Block a user