kern

changeset 59:ef9cc2e90277

added a comment describing the push of just_forked address to the stack frame of the newly-forked process.
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 17 Aug 2011 05:33:03 +0300
parents 64a574189824
children 39188bbe8638
files src/proc.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/src/proc.c	Wed Aug 17 05:30:06 2011 +0300
     1.2 +++ b/src/proc.c	Wed Aug 17 05:33:03 2011 +0300
     1.3 @@ -176,7 +176,11 @@
     1.4  	/* child's return from fork returns 0 */
     1.5  	((struct intr_frame*)p->ctx.stack_ptr)->regs.eax = 0;
     1.6  
     1.7 -	/* XXX describe */
     1.8 +	/* we also need the address of just_forked in the stack, so that switch_stacks
     1.9 +	 * called from context_switch, will return to just_forked when we first switch
    1.10 +	 * to a newly forked process. just_forked then just calls intr_ret to return to
    1.11 +	 * userspace with the already constructed interrupt frame (see above).
    1.12 +	 */
    1.13  	p->ctx.stack_ptr -= 4;
    1.14  	*(uint32_t*)p->ctx.stack_ptr = (uint32_t)just_forked;
    1.15