delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/05/17/03:47:52

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Mon, 17 May 2004 09:47:05 +0200 (MEST)
From: Gabriel Zoltan <gz331 AT hszk DOT bme DOT hu>
X-X-Sender: gz331 AT ural2
To: djgpp AT delorie DOT com
Subject: Task switch with SIGALRM
Message-ID: <Pine.GSO.4.58.0405170936310.4679@ural2>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019