Browse Source

[hle] memory_manager: keep allocating on non-4KiB

pull/4181/head
Exverge 7 days ago
parent
commit
6a933f9d90
No known key found for this signature in database GPG Key ID: DAD399BCC5FB77E4
  1. 4
      src/core/hle/kernel/k_memory_manager.cpp

4
src/core/hle/kernel/k_memory_manager.cpp

@ -289,7 +289,7 @@ Result KMemoryManager::AllocatePageGroupImpl(KPageGroup* out, size_t num_pages,
const size_t pages_per_alloc = KPageHeap::GetBlockNumPages(index); const size_t pages_per_alloc = KPageHeap::GetBlockNumPages(index);
for (Impl* cur_manager = this->GetFirstManager(pool, dir); cur_manager != nullptr; for (Impl* cur_manager = this->GetFirstManager(pool, dir); cur_manager != nullptr;
cur_manager = this->GetNextManager(cur_manager, dir)) { cur_manager = this->GetNextManager(cur_manager, dir)) {
while (num_pages >= pages_per_alloc) {
while (num_pages > 0 && (num_pages >= pages_per_alloc || index == min_index)) {
// Allocate a block. // Allocate a block.
KPhysicalAddress allocated_block = cur_manager->AllocateBlock(index, random); KPhysicalAddress allocated_block = cur_manager->AllocateBlock(index, random);
if (allocated_block == 0) { if (allocated_block == 0) {
@ -342,7 +342,7 @@ Result KMemoryManager::AllocatePageGroupImpl(KPageGroup* out, size_t num_pages,
} }
} }
// Only succeed if we allocated as many pages as we wanted.
// Only succeed if we allocated as many pages as we wanted. (this should never happen?)
R_UNLESS(num_pages == 0, ResultOutOfMemory); R_UNLESS(num_pages == 0, ResultOutOfMemory);
// We succeeded! // We succeeded!

Loading…
Cancel
Save