forked from PoliEcho-holding-org/kern
handle non-canonical addresses in vmm
This commit is contained in:
@@ -51,27 +51,6 @@ __noreturn void _start(void) {
|
||||
printk("%d: %lu\n", i, get_random_number());
|
||||
}
|
||||
|
||||
// test VMM
|
||||
{
|
||||
void* vaddr;
|
||||
int ret = vmm_alloc(&vaddr, 2, 0);
|
||||
if (ret != SUCCESS) {
|
||||
panic(NULL, "vmm_alloc returned %d", ret);
|
||||
}
|
||||
{
|
||||
uint64_t* pml4 = pag_get_pml4();
|
||||
uint64_t* pte = pag_get_pte(pml4, vaddr);
|
||||
if (!IS_ERR(pte) && (*pte & PTE_FLAG_PRESENT)) {
|
||||
printk("page allocated\n");
|
||||
} else {
|
||||
printk("page not allocated\n");
|
||||
}
|
||||
}
|
||||
memset(vaddr, 69, 2 * PAGE_SIZE);
|
||||
*(char*)((vaddr + (2 * PAGE_SIZE)) - 1) = 0;
|
||||
printk("read back:\n%s\n", (char*)vaddr);
|
||||
}
|
||||
|
||||
// The most important function in the world.
|
||||
splash();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user