hle: kernel: KCodeMemory: Correct m_page_group number of pages.

Credits to @xerpi for finding this issue and pointing it out on #7519.
This commit is contained in:
bunnei 2022-02-08 18:47:11 -08:00 committed by GitHub
parent b720009dc0
commit d134ca68c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/alignment.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "core/device_memory.h" #include "core/device_memory.h"
#include "core/hle/kernel/k_auto_object.h" #include "core/hle/kernel/k_auto_object.h"
@ -29,7 +30,7 @@ ResultCode KCodeMemory::Initialize(Core::DeviceMemory& device_memory, VAddr addr
// Construct the page group. // Construct the page group.
KMemoryInfo kBlockInfo = page_table.QueryInfo(addr); KMemoryInfo kBlockInfo = page_table.QueryInfo(addr);
m_page_group = KPageLinkedList(kBlockInfo.GetAddress(), kBlockInfo.GetNumPages()); m_page_group = KPageLinkedList(addr, Common::DivideUp(size, PageSize));
// Lock the memory. // Lock the memory.
R_TRY(page_table.LockForCodeMemory(addr, size)) R_TRY(page_table.LockForCodeMemory(addr, size))