To: blp@cs.stanford.edu, joshwise@stanford.edu
Date: Fri, 3 Mar 2006 17:09:21 -0800
-QUESTION 1
-
-In the section
-
- # Save current stack pointer to old thread's stack, if any.
- movl SWITCH_CUR(%esp), %eax
- test %eax, %eax
- jz 1f
- movl %esp, (%eax,%edx,1)
-1:
-
- # Restore stack pointer from new thread's stack.
- movl SWITCH_NEXT(%esp), %ecx
- movl (%ecx,%edx,1), %esp
-
-why are we saving the current stack pointer only if the "cur" thread pointer
-is non-NULL ? Isn't it gauranteed to be non-NULL because switch_threads() is
-only called form schedule(), where we have
-
- struct thread *cur = running_thread ();
-
-which should always be non-NULL (given the way kernel pool is laid out).
-
QUESTION 2
# This stack frame must match the one set up by thread_create().