mirror of https://gitlab.com/nakst/essence
memory: Don't map extra page unnecessarily
When offset2 != 0 it doesn't necessarily mean that we need an extra page. Fix calculation to map extra page only when necesarry. This is needed as next page may be unavailable like when available RAM follows XSDT and hence not available for mapping.
This commit is contained in:
parent
0a70170952
commit
dfac99781c
|
@ -1325,7 +1325,8 @@ void *MMMapPhysical(MMSpace *space, uintptr_t offset, size_t bytes, uint64_t cac
|
|||
|
||||
uintptr_t offset2 = offset & (K_PAGE_SIZE - 1);
|
||||
offset -= offset2;
|
||||
if (offset2) bytes += K_PAGE_SIZE;
|
||||
bytes += offset2;
|
||||
bytes = (bytes + K_PAGE_SIZE - 1) & ~(K_PAGE_SIZE - 1);
|
||||
|
||||
MMRegion *region;
|
||||
|
||||
|
|
Loading…
Reference in New Issue