scheduler_entry: # store program counter in current_running->programCounter pushl %eax pushl %ebx movl current_running, %eax movl 8(%esp), %ebx movl %ebx, PCBOFF_PROGRAM_COUNTER(%eax) popl %ebx popl %eax backup_process_registers: pushl %ds pushl %es pushl %fs pushl %gs pushal pushfl backup_process_stack_pointer: # current_running->stackPointer_k = %esp movl current_running, %eax movl %esp, PCBOFF_STACKPOINTER_K(%eax) call_scheduler: call scheduler dispatch_or_something: # Load the process stack movl current_running, %eax movl PCBOFF_STACKPOINTER_K(%eax), %esp # Load registers if process state is not STATUS_FIRST_TIME movl PCBOFF_PROCESS_STATE(%eax), %ecx movl $0, %ebx cmp %ecx, %ebx je resume_process load_process_registers: popfl popal popl %gs popl %fs popl %es popl %ds resume_process: movl current_running, %eax jmp *PCBOFF_PROGRAM_COUNTER(%eax)