1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-27 06:12:15 +00:00

kern: fix bug in page table mapping calculations

This commit is contained in:
Michael Scire 2020-07-25 02:47:07 -07:00 committed by SciresM
parent a4d376cc0f
commit 0af44d2875

View file

@ -645,7 +645,7 @@ namespace ams::kern::arch::arm64 {
size_t alignment; size_t alignment;
for (alignment = ContiguousPageSize; (virt_addr & (alignment - 1)) == (phys_addr & (alignment - 1)); alignment = GetLargerAlignment(alignment)) { for (alignment = ContiguousPageSize; (virt_addr & (alignment - 1)) == (phys_addr & (alignment - 1)); alignment = GetLargerAlignment(alignment)) {
/* Check if this would be our last map. */ /* Check if this would be our last map. */
const size_t pages_to_map = (alignment - (virt_addr & (alignment - 1))) & (alignment - 1); const size_t pages_to_map = ((alignment - (virt_addr & (alignment - 1))) & (alignment - 1)) / PageSize;
if (pages_to_map + (alignment / PageSize) > remaining_pages) { if (pages_to_map + (alignment / PageSize) > remaining_pages) {
break; break;
} }