Simplify inituvm and userinit by assuming initcode fits on a page

This commit is contained in:
Austin Clements 2010-09-02 15:37:05 -04:00
parent b3cfd7fc37
commit f53e6110be
3 changed files with 10 additions and 19 deletions

7
proc.c
View file

@ -120,11 +120,8 @@ userinit(void)
initproc = p;
if(!(p->pgdir = setupkvm()))
panic("userinit: out of memory?");
if(!allocuvm(p->pgdir, 0x0, (int)_binary_initcode_size))
panic("userinit: out of memory?");
inituvm(p->pgdir, 0x0, _binary_initcode_start,
(int)_binary_initcode_size);
p->sz = PGROUNDUP((int)_binary_initcode_size);
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
p->sz = PGSIZE;
memset(p->tf, 0, sizeof(*p->tf));
p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
p->tf->ds = (SEG_UDATA << 3) | DPL_USER;