func (q *Process) Dawn(flags uint64, c chan bool) { highest := q.highest pml4 := q.PML4 q.highest = USERSTART q.NewPML4() q.Allocate(uint64(highest - USERSTART)) buf := make([]byte, PAGESIZE) bufh := (*runtime.SliceHeader)(unsafe.Pointer(&buf)) for v := uintptr(USERSTART); v < highest; v += PAGESIZE { runtime.SetLocalCR3(pml4) runtime.Memmove(bufh.Data, v, PAGESIZE) runtime.SetLocalCR3(q.PML4) runtime.Memmove(v, bufh.Data, PAGESIZE) } q.ProcState.ax = 0 c <- false q.Run() }
func (p *Process) NewPML4() { p.PML4 = p.KAllocate(1) _pml := runtime.MapTmp(p.PML4) runtime.Memclr(_pml, PAGESIZE) pdp := p.KAllocate(1) Write64(_pml, pdp|PAGEAVAIL|PAGEWRITE|PAGEUSER) _pdp := runtime.MapTmp(pdp) runtime.Memclr(_pdp, PAGESIZE) Write64(_pdp, runtime.KernelPD|PAGEAVAIL|PAGEWRITE|PAGEUSER) runtime.FreeTmp(_pdp) runtime.FreeTmp(_pml) runtime.SetLocalCR3(p.PML4) }