EXTERN stack EXTERN stack2 EXTERN func GLOBAL dummy_int_handler GLOBAL dummy_err_handler GLOBAL thread_int_handler GLOBAL start GLOBAL cont yield: mov [stack2], esp mov esp, [stack] ret dummy_int_handler: iret dummy_err_handler: add esp, 4 iret thread_int_handler: push eax push ebx push ecx push edx push esi push edi push ebp push ds push es push fs push gs mov al, 0x20 out 0x20, al call yield pop gs pop fs pop es pop ds pop ebp pop edi pop esi pop edx pop ecx pop ebx pop eax iret start: mov [stack], esp mov esp, [stack2] sti jmp func cont: mov [stack], esp mov esp, [stack2] sti ret