How does context switching work?
Richi Dubey
richidubey at gmail.com
Mon Nov 2 15:25:43 UTC 2020
Thanks a lot for your reply.
But that code is okay because the floating point unit is not used during
> that sequence. it is untouched and up to a point it doesn't matter when the
> floating point unit is restored as long as it's before the thread needs it.
> And RTEMS should not be using floating point operations except in very
> special places in the code base.
> not sure that helps but the floating point unit and the integer unit are
> separate and most of the time can be contact switched separately completely
> safely.
I understand. This is smart.
The _Context_Switch() function changes the thread stack and the
> non-volatile (callee save) registers. So, the value of the executing
> local variable changes with a call to _Context_Switch().
I understand. Thank you.
On Mon, Nov 2, 2020 at 11:48 AM Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:
> On 31/10/2020 16:50, Richi Dubey wrote:
>
> >
> > I want to learn more about how context switching works in RTEMS. I saw
> > the following lines in theaddispatch.c:
> >
> > _Thread_Save_fp( executing );
> > _Context_Switch( &executing->Registers, &heir->Registers );
> > _Thread_Restore_fp( executing );
> >
> > I do not understand how it works. Here, the executing process saves
> > its context by calling _Thread_Save_fp( executing ), then if a
> > different process resumes execution after the context switch, why does
> > it get the context of previous process (executing)?
> The _Context_Switch() function changes the thread stack and the
> non-volatile (callee save) registers. So, the value of the executing
> local variable changes with a call to _Context_Switch().
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone : +49 89 189 47 41-16
> Fax : +49 89 189 47 41-09
> E-Mail : sebastian.huber at embedded-brains.de
> PGP : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20201102/bfb2953d/attachment-0001.html>
More information about the devel
mailing list