kzinti wrote:
Wouldn't it make sense to just have the PIC interrupt handler call your thread_yield() function?
For example:
Code:
static void pic_interrupt_handler()
{
pic_eoi(); // end-of-interrupt
thread_yield(); // call scheduler to yield the current thread
}
Yes, I tried but for something reason my Yield function doesn't work without EOI, and eoi only be sent on IRQ scope right?
So I thought to use the same interrupt structure with trap gate thinking in reuse code but my function below probably wrong.
Your tip will be perfect if my function below works without EOI.
Code:
.extern gos_task_schedule
.global gos_port_yield
gos_port_yield:
cli
push $0
push $0
pusha
push %ds
push %es
push %fs
push %gs
movw $0x10, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %fs
movw %ax, %gs
movl %esp, %eax
push %eax
call gos_task_schedule
movl %eax, %esp
/* ---- ----
movb $0x20, %al
out %al, $0x20
*/
pop %gs
pop %fs
pop %es
pop %ds
popa
addl $8, %esp
sti
retl