VMM - set_page does not overwrite 4kb pages with 2mb
This commit is contained in:
parent
518eaf73c3
commit
e68698ff80
@ -56,6 +56,8 @@ int vmm_set_page(void *P4, uintptr_t addr, uintptr_t page, uint16_t flags)
|
|||||||
&& P3e(P4, addr).present
|
&& P3e(P4, addr).present
|
||||||
))
|
))
|
||||||
return -1;
|
return -1;
|
||||||
|
if(P2e(P4, addr).present && !P2e(P4,addr).huge)
|
||||||
|
return -1;
|
||||||
P2e(P4, addr).value = page | flags;
|
P2e(P4, addr).value = page | flags;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,14 @@ TEST(set_page_sets_2mb_pages)
|
|||||||
|
|
||||||
ASSERT_EQ_PTR(p2[3], 0x1234567890A00000 | PAGE_HUGE | PAGE_PRESENT);
|
ASSERT_EQ_PTR(p2[3], 0x1234567890A00000 | PAGE_HUGE | PAGE_PRESENT);
|
||||||
}
|
}
|
||||||
|
TEST(set_page_does_not_overwrite_4kb_pages_with_2mb)
|
||||||
|
{
|
||||||
|
BUILD_PT(0,0,0);
|
||||||
|
|
||||||
|
int retval = vmm_set_page(p4, 0, 0, PAGE_HUGE | PAGE_PRESENT);
|
||||||
|
|
||||||
|
ASSERT_NEQ_INT(retval, 0);
|
||||||
|
}
|
||||||
|
|
||||||
uintptr_t pmm_alloc()
|
uintptr_t pmm_alloc()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user