Any Message $ test TEST: pid 3 test: trap 14 err 5 on cpu ? eip 0xffffffff addr 0xffffffff?kill pr oc What's the reason this trap is occured? This is my xv6 thread_create code. int...

Any Message $ test TEST: pid 3 test: trap 14 err 5 on cpu ? eip 0xffffffff addr 0xffffffff?kill pr oc What's the reason this trap is occured? This is my xv6 thread_create code. int thread_create(void*(*function)(void*), void* arg, void* stack){ int i, tid, cnt=0: struct proc *np, *p: struct proc *curproc = myproc(): //check #threads for(p=ptable.proc: p if(p->pid == curproc->pid) cnt++: } if(cnt > 8) return -1: if((np = allocproc()) == 0) return -1: if (stack == 0 || (uint)stack % PGSIZE != 0 || (uint)stack + PGSIZE > curproc->sz) return -1: //copy np->pgdir = curproc->pgdir: np->sz = curproc->sz: np->parent = curproc: *np->tf = *curproc->tf: np->tf->eax = 0: np->nice = curproc->nice: np->ustack = stack: np->pid = curproc->pid: np->tid = nexttid++: *((uint *)(stack + PGSIZE - sizeof(uint))) = (uint)arg: *((uint *)(stack + PGSIZE - 2 * sizeof(uint))) = 0xffffffff: np->tf->esp = (uint)stack + PGSIZE - 2 * sizeof(uint): np->tf->eip = (uint)function: for(i=0: i if(curproc->ofile[i]) np->ofile[i] = filedup(curproc->ofile[i]): } np->cwd = idup(curproc->cwd): tid = np->tid: acquire(&ptable.lock): np->state = RUNNABLE: safestrcpy(np->name, curproc->name, sizeof(curproc->name)): release(&ptable.lock): return tid: } What code do I have to add to remove the trap?
Nov 11, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here