Mercurial > hg > Members > menikon > CbC_xv6
changeset 263:a78f9919fcf0
cbc_init_vmm_dummy and initContext
author | tobaru |
---|---|
date | Sun, 26 Jan 2020 16:51:46 +0900 |
parents | 3a080883a4f4 |
children | 00224d119299 |
files | src/proc.cbc |
diffstat | 1 files changed, 26 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/proc.cbc Sat Jan 25 22:39:13 2020 +0900 +++ b/src/proc.cbc Sun Jan 26 16:51:46 2020 +0900 @@ -6,6 +6,7 @@ #include "arm.h" #include "proc.h" #include "spinlock.h" +#interface "vm.h" #define __ncode __code @@ -116,21 +117,41 @@ //PAGEBREAK: 32 // hand-craft the first user process. We link initcode.S into the kernel // as a binary, the linker will generate __binary_initcode_start/_size +void dummy(struct proc *p, char _binary_initcode_start[], char _binary_initcode_size[]) +{ + // inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); + goto cbc_init_vmm_dummy(p, _binary_initcode_start, _binary_initcode_size); + +} + + + +__ncode cbc_init_vmm_dummy(struct Context* cbc_context, struct proc* p, pde_t* pgdir, char* init, uint sz, enum Code next){//:skip + + struct vm* vm = createvm_impl(&proc->cbc_context); + // goto vm->init_vmm(vm, pgdir, init, sz , next(...)); + Gearef(cbc_context, vm)->vm = (union Data*) vm; + Gearef(cbc_context, vm)->pgdir = pgdir; + Gearef(cbc_context, vm)->init = init; + Gearef(cbc_context, vm)->sz = sz ; + goto meta(cbc_context, vm->init_vmm); +} + void userinit(void) { - struct proc *p; + struct proc* p; extern char _binary_initcode_start[], _binary_initcode_size[]; p = allocproc(); + initContext(&p->cbc_context); + initproc = p; if((p->pgdir = kpt_alloc()) == NULL) { panic("userinit: out of memory?"); } - // inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); - struct vm* vm = createvm_impl(&proc->cbc_context); - goto vm->init_vmm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); + dummy(p, _binary_initcode_start, _binary_initcode_size); p->sz = PTE_SZ; @@ -189,6 +210,7 @@ if((np = allocproc()) == 0) { return -1; } + initContext(&np->cbc_context); // Copy process state from p. if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){