[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [rtl] rtl_sched.c: rtl_switch_to and floating point support
- To: <rtl@fsmlabs.com>
- Subject: RE: [rtl] rtl_sched.c: rtl_switch_to and floating point support
- From: "Hai Quang Nguyen" <hqn01@uark.edu>
- Date: Tue, 2 Oct 2001 10:12:01 -0500
- Importance: Normal
- In-Reply-To: <20010927104203.C1475@tigger.pooh>
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: owner-rtl@fsmlabs.com [mailto:owner-rtl@fsmlabs.com] On Behalf Of
Mario Taschwer
Sent: Thursday, September 27, 2001 3:42 AM
To: rtl@fsmlabs.com
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 majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/