1 #### 0(%esp) - old registers
2 #### 16(%esp) - return address
3 #### 20(%esp) - current thread
4 #### 24(%esp) - new thread
8 # Save caller's register state.
9 # Note that the SVR4 ABI allows us to destroy %eax, %ecx, %edx.
10 # This stack frame must match the one set up by thread_create().
16 # Get offsetof (struct thread, stack).
17 .globl thread_stack_ofs
18 mov thread_stack_ofs, %edx
20 # Save current stack pointer to old thread's stack, if any.
24 movl %esp, (%eax,%edx,1)
27 # Restore stack pointer from new thread's stack.
29 movl (%ecx,%edx,1), %esp
31 # Restore caller's register state.