2026-06-28 17:58:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
.code32
|
2026-06-26 20:05:01 -05:00
|
|
|
.global yield
|
2026-06-28 17:58:58 -05:00
|
|
|
.extern schedule_next_task
|
|
|
|
|
yield: # void yield()
|
|
|
|
|
cli
|
|
|
|
|
|
|
|
|
|
pushfl
|
|
|
|
|
pushl %cs
|
|
|
|
|
|
|
|
|
|
movl 8(%esp), %eax
|
|
|
|
|
pushl %eax
|
|
|
|
|
|
|
|
|
|
movl 4(%esp), %ebx # Get CS
|
|
|
|
|
movl %ebx, 8(%esp) # Move CS over Old EIP
|
|
|
|
|
movl 0(%esp), %ebx # Get Return EIP
|
|
|
|
|
movl %ebx, 4(%esp) # Move Return EIP over CS
|
|
|
|
|
addl $4, %esp # Adjust stack pointer up.
|
2026-07-01 20:00:22 -05:00
|
|
|
|
2026-06-28 17:58:58 -05:00
|
|
|
pushal
|
|
|
|
|
|
|
|
|
|
pushl %esp
|
|
|
|
|
call switch_context
|
|
|
|
|
movl %eax, %esp
|
|
|
|
|
|
|
|
|
|
popal
|
|
|
|
|
sti
|
|
|
|
|
iret
|