handle another out-of-memory in fork(). the policy here is not consistent,

since other calls (e.g. exec()) panic on out of memory.
This commit is contained in:
Robert Morris 2020-08-13 10:22:07 -04:00
parent 4c22c54480
commit adee82c3e7
3 changed files with 10 additions and 3 deletions

View file

@ -161,6 +161,8 @@ proc_pagetable(struct proc *p)
// An empty page table.
pagetable = uvmcreate();
if(pagetable == 0)
return 0;
// map the trampoline code (for system call return)
// at the highest user virtual address.

View file

@ -195,13 +195,14 @@ uvmunmap(pagetable_t pagetable, uint64 va, uint64 npages, int do_free)
}
// create an empty user page table.
// returns 0 if out of memory.
pagetable_t
uvmcreate()
{
pagetable_t pagetable;
pagetable = (pagetable_t) kalloc();
if(pagetable == 0)
panic("uvmcreate: out of memory");
return 0;
memset(pagetable, 0, PGSIZE);
return pagetable;
}