My timer ISR basically pops the IP off the stack into a register, then jumps to my function ('resched'). Resched then saves the current state (including the popped IP) then jumps to the next task's IP.
This works when I am using cooperative multitasking, but preemptive multitasking doesn't work at all . Any ideas? (The OS is written purely in NASM).
Note: I run this in Bochs, the scheduler prints out the value of SI (CS) and DI (IP) as well as the first task's IP (p1) and the second's (p2). Snapshot:
Code: Select all
si:80=di:1486=p1:1486=p2:1550
-ZAAAAAAAAAAAAA
si:61440=di:65247=p1:58347=p2:35080
+AAAAAAAAAAAAAAAAAAAAAAAAAA
You can see that the IP's of the two tasks have been really wrecked by something.
Any ideas?