# HG changeset patch # User John Tsiombikas # Date 1313548383 -10800 # Node ID ef9cc2e902779edff44a07ec0e371fb960e9739d # Parent 64a57418982436da44ad49a3f3f09ceb8092bc30 added a comment describing the push of just_forked address to the stack frame of the newly-forked process. diff -r 64a574189824 -r ef9cc2e90277 src/proc.c --- a/src/proc.c Wed Aug 17 05:30:06 2011 +0300 +++ b/src/proc.c Wed Aug 17 05:33:03 2011 +0300 @@ -176,7 +176,11 @@ /* child's return from fork returns 0 */ ((struct intr_frame*)p->ctx.stack_ptr)->regs.eax = 0; - /* XXX describe */ + /* we also need the address of just_forked in the stack, so that switch_stacks + * called from context_switch, will return to just_forked when we first switch + * to a newly forked process. just_forked then just calls intr_ret to return to + * userspace with the already constructed interrupt frame (see above). + */ p->ctx.stack_ptr -= 4; *(uint32_t*)p->ctx.stack_ptr = (uint32_t)just_forked;