5 # Save caller's register state.
6 # Note that the SVR4 ABI allows us to destroy %eax, %ecx, %edx.
7 # This stack frame must match the one set up by thread_create().
13 # Get offsetof (struct thread, stack).
14 .globl thread_stack_ofs
15 mov thread_stack_ofs, %edx
17 # Save current stack pointer to old thread's stack, if any.
18 movl SWITCH_CUR(%esp), %eax
21 movl %esp, (%eax,%edx,1)
24 # Restore stack pointer from new thread's stack.
25 movl SWITCH_NEXT(%esp), %ecx
26 movl (%ecx,%edx,1), %esp
28 # Restore caller's register state.
37 # Discard switch_threads() arguments.
40 # Call schedule_tail(prev).
46 # Start thread proper.