Mail Archives: djgpp/2004/05/17/03:47:52
Hi!
I'm trying to implement a small real-time kernel. I previously tried to
switch tasks from timer interrupts, but then I realised based on the
mailing list that it's not going to work. Now I try to do it using
signals.
Sadly it still won't work :(. I use setitimer() and signal(). The signal
handler function looks like this:
_Handler:
cli
pushal
movl %esp, _tos_task
call _TickHandler
movl _tos_task, %esp
popal
sti
ret
Here _tos_task is the top of stack for the task, which gets changed during
_TickHandler appropriately (the stack for the previous task is saved, and
then the variable is loaded with the new task's stack value).
My problem is that tasks run OK for the first time, but when the scheduler
tries to run them again, the system crashes (with various reasons:
stack fault, GPF). Also if there is no stack switch it runs OK (_tos_task
doesn't get changed in tickhandler).
Do you have an idea what I'm doing wrong?
Thanks for your help.
Zoltan
- Raw text -