Skip to content
Snippets Groups Projects
Commit 93c00067 authored by Fache Charles's avatar Fache Charles
Browse files

WIP 4.6 a few issues left

parent 7e5fdaa4
No related branches found
No related tags found
No related merge requests found
......@@ -377,13 +377,27 @@ int load_from_file(char* file,
}
int do_allocate(pagetable_t pagetable, struct proc* p, uint64 addr){
struct vma * this_vma;
uint64 pa;
if((this_vma = get_memory_area(p, addr)) == 0){
return ENOVMA;
}
pte_t* pte = walk(pagetable, addr, 0);
if(pte == 0 || !(*pte & PTE_V)){
return ENOMEM;
if (pte) {
if(!(*pte & PTE_U))
return EBADPERM;
return 0;
}
if(!(*pte & PTE_U)){
return EBADPERM;
if((pa = (uint64)kalloc()) == 0)
return ENOMEM;
if (mappages(pagetable, PGROUNDDOWN(addr), PGSIZE, pa, PTE_R | PTE_W | PTE_X | PTE_U) == -1) {
kfree(&pa);
return EMAPFAILED;
}
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment