At a certain point in time I believed that the switch occurs when the "ret" instruction of the rtl_switch_to(). I don't think that the switch occurs when the register contents are restored though. The stack may be changed but the change will not take any effect until the "ret" instruction which return the IP register to the caller which now changes to the other tasks instructions. However, now, I am not so sure about that. It seems to me that the switch actually occurs after the rtl_schedule() returns. Although the rtl_switch_to() code suggests other wise. You can see this by turn on the tracer. You will see after the rtl_switch event there is schedule_out event which is occur at the end of the rtl_schedule() code.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Mario Taschwer Sent: Thursday, September 27, 2001 3:42 AM To: [EMAIL PROTECTED] Subject: Re: [rtl] rtl_sched.c: rtl_switch_to and floating point support On Wed, Sep 26, 2001 at 10:38:57AM +0200, Franz Hollerer wrote: > Hi! > > I have some troubles understanding the scheduler source code. > Maybe someone can give me some hints. Thx. > > Task switching > -------------- > > Task switching is done in rtl_schedule by calling > rtl_switch_to(). The switch occurs when the "ret" instruction of > rtl_switch_to() > is carried out. At this point a new task runs. The remainder of > rtl_schedule is > postponed until the previous task is activated again. Actually, the switch occurs when the register contents (including the stack pointer) of the new task are restored. This happens inside rtl_switch_to. > > Right? If so I have problems with the floating point support. Why are > the > floating point registers saved and restored after the call to > rtl_switch_to(). > Isn't it to late to do this here, because the switch to the task has > already occurred and > been carried out? RTLinux only switches the FP context if the new task needs the FPU. Note that the Linux task is always assumed to use the FPU. The FP switch is not too late, because the new task will not use the FP registers before control returns to the application module (or to Linux). Mario Taschwer -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] -- For more information on Real-Time Linux see: http://www.rtlinux.org/ -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] -- For more information on Real-Time Linux see: http://www.rtlinux.org/
