".type raw_swapcontext,@function\n"
"raw_swapcontext:\n"
#endif
- " movl 4(%esp),%eax\n" /* old */
- " movl 8(%esp),%edx\n" /* new */
+ // Fetch the parameters:
+ " movl 4(%esp),%eax\n" /* old (raw_stack_t*) */
+ " movl 8(%esp),%edx\n" /* new (raw_stack_t) */
+ // Save registers of the current context on the stack:
" pushl %ebp\n"
" pushl %ebx\n"
" pushl %esi\n"
" pushl %edi\n"
+ // Save the current context (stack pointer) in *old:
" movl %esp,(%eax)\n"
+ // Switch to the stack of the new context:
" movl %edx,%esp\n"
+ // Pop the values of the new context:
" popl %edi\n"
" popl %esi\n"
" popl %ebx\n"
" popl %ebp\n"
+ // Return using the return address of the new context:
" retl\n"
);
#else