mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-18 17:11:23 +00:00
kern: fix bug in page table mapping calculations
This commit is contained in:
parent
a4d376cc0f
commit
0af44d2875
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user