VMM - touch_page stops at P2 for huge pages

This commit is contained in:
2018-01-03 14:05:27 +01:00
parent e68698ff80
commit 96a877c95b
2 changed files with 12 additions and 2 deletions

View File

@@ -73,6 +73,9 @@ int touch_page(void *P4, uintptr_t addr, uint16_t flags)
{
if(!P4) return -1;
int huge=(flags & PAGE_HUGE)?1:0;
flags ^= PAGE_HUGE*huge;
if((!P4e(P4, addr).present)
&& (!(P4e(P4, addr).value = pmm_alloc())))
return -1;
@@ -83,6 +86,8 @@ int touch_page(void *P4, uintptr_t addr, uint16_t flags)
return -1;
P3e(P4, addr).value |= flags | PAGE_PRESENT;
if(huge) return 0;
if((!P2e(P4, addr).present)
&& (!(P2e(P4, addr).value = pmm_alloc())))
return -1;