

.code32
.global yield 
.extern schedule_next_task 
yield: # void yield()
    cli

    popl %ecx
    
    pushfl          // EFLAGS
    pushl %cs       // CS   
    pushl %ecx      // EIP

    pushal
    call send_eoi_master

    xor %eax, %eax
    mov %ds, %ax
    pushl %eax

    mov $0x10, %ax
    mov %ax, %ds
    mov %ax, %es
    
    pushl %esp
    call switch_context
    movl %eax, %esp

    popl %eax
    mov %ax, %ds
    mov %ax, %es

    popal
    sti
    iret