I am trying to implement fork call in os161 but after running kernel i get following error:
pseudo flow of my sys_fork function:
create new address space, trap frame
declare new thread pointer -- ptrthread -- i have not assigned memory here
as_copy(source->destination)
thread fork(name , new trapframe, (unsigned long)ptrthread->vmspace, forkentry function, ptrthread)
return pid()
pseudo forkentry:
1.new trapframe = trap frame arg of forkentry
curthread->vmspace = addrspace arg of forkentry
actvate(curthread->vmspace)
set some vard in new trapframe
mips_usermode....
when I run kernel following error occurs and kernel stops executing:
sys161: System/161 release 1.14, compiled Aug 24 2011 10:55:58
OS/161 base system version 1.11
Copyright (c) 2000, 2001, 2002, 2003
President and Fellows of Harvard College. All rights rescheduler: Dropping thread <boot/menu>.
panic: Assertion failed: SAME_STACK(curkstack-1, (vaddr_t)tf), at ../../arch/mips/mips/trap.c:220 (mips_trap)
sys161: 930837 cycles (827682k, 0u, 103155i)
sys161: 130 irqs 20 exns 0r/0w disk 0r/279w console 0r/0w/1m emufs 0r/0w net
sys161: Elapsed real time: 0.087962 seconds (10.5823 mhz)
sys161: Elapsed virtual time: 0.037233480 seconds (25 mhz)