I've started to implement process management into my kernel , and followed JamesM kernel tutorials to get me started ( and changed the implementation a bit ) , and to test out my process management tried to Fork() my kernel code.
The EIP is loaded at the end of the Fork() function , just before esp and eip are written to the task ,and the function makes sure to differenciate the Forked copy from the Forkee , and as long as the code remains inside the Fork() function everything runs fine but as soon as "return" is invoked the whole thing crashes with seemingly random errors depending on what the return point is.
My question really is , is it because of the stack and stack base pointers not pointing to a valid return address or is it because I'm using a faulty cloned page directory?
EDIT: Turns out I wasn't creating a stack for the new process and was using the old stack. So as soon as I requiered access to the stack , my objects were already out of scope