mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-24 20:36:24 -05:00
core: hle: kernel: KPageTable: SetHeapSize: Cleanup & take physical memory lock.
This commit is contained in:
parent
6d8e498f76
commit
0137f2e6e1
1 changed files with 7 additions and 4 deletions
|
@ -885,6 +885,9 @@ ResultCode KPageTable::SetMaxHeapSize(std::size_t size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode KPageTable::SetHeapSize(VAddr* out, std::size_t size) {
|
ResultCode KPageTable::SetHeapSize(VAddr* out, std::size_t size) {
|
||||||
|
// Lock the physical memory lock.
|
||||||
|
std::lock_guard phys_lk(map_physical_memory_lock);
|
||||||
|
|
||||||
// Try to perform a reduction in heap, instead of an extension.
|
// Try to perform a reduction in heap, instead of an extension.
|
||||||
VAddr cur_address{};
|
VAddr cur_address{};
|
||||||
std::size_t allocation_size{};
|
std::size_t allocation_size{};
|
||||||
|
@ -1014,12 +1017,12 @@ ResultVal<VAddr> KPageTable::AllocateAndMapMemory(std::size_t needed_num_pages,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_map_only) {
|
if (is_map_only) {
|
||||||
CASCADE_CODE(Operate(addr, needed_num_pages, perm, OperationType::Map, map_addr));
|
R_TRY(Operate(addr, needed_num_pages, perm, OperationType::Map, map_addr));
|
||||||
} else {
|
} else {
|
||||||
KPageLinkedList page_group;
|
KPageLinkedList page_group;
|
||||||
CASCADE_CODE(system.Kernel().MemoryManager().Allocate(page_group, needed_num_pages,
|
R_TRY(system.Kernel().MemoryManager().Allocate(page_group, needed_num_pages, memory_pool,
|
||||||
memory_pool, allocation_option));
|
allocation_option));
|
||||||
CASCADE_CODE(Operate(addr, needed_num_pages, page_group, OperationType::MapGroup));
|
R_TRY(Operate(addr, needed_num_pages, page_group, OperationType::MapGroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
block_manager->Update(addr, needed_num_pages, state, perm);
|
block_manager->Update(addr, needed_num_pages, state, perm);
|
||||||
|
|
Loading…
Reference in a new issue