This is my first post here and I am still a noob at OSDev so Il accept any advice/tips on posting. Anyway, I am currently trying to implement multitasking in my OS. I change tasks on the timer interrupt by changing the values of the registers stored on the stack before it is popped back off the stack. My IRQ handler looks like this:
Code: Select all
[extern] IRQ_HANDLER
IRQ_COMMON_STUB:
pusha ;push all common registers
mov ax, ds ;put data segment selector into AX
push eax ;save eax, which is value of ds
mov ax, 0x10 ;put us back into kernel mode (ring 0)
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
call IRQ_HANDLER ;Call the high-level handler
pop eax ;restore eax, which contains original ds in lower 16 bits (AX)
mov ds, ax ;restore data segment selector
mov es, ax
mov fs, ax
mov gs, ax
popa ;pop all common registers
add esp, 8 ;fix stack after popping the ISR number and Error Code
sti
iret]
and IRQ_HANDLER looks like this:
Code: Select all
void IRQ_HANDLER(registers_t* regs);
I am completely lost so any help at this point would be greatly appreciated.
Thank you