<div dir="ltr">Hi Mr. Dörfler,<div><br></div><div>Thanks for your reply. </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">When the first task is reactivated, it leaves the contextswitch function. Therefore all the code around the context switch function handles the same task it was called for.</blockquote><div>When I am debugging sp16.exe,after TA1 calls task_wake_after, it calls the _Context_Switch() function, and I think (correct me if I am wrong) TA5 follows the execution after TA1 calls _Context_Switch. </div><div><br></div><div>I have attached the gdb trace with this mail. Let me know what you think.</div><div><br></div><div>Thanks,</div><div>Richi.</div><div> </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Nov 1, 2020 at 12:35 AM Thomas Dörfler <<a href="mailto:thomas.doerfler@embedded-brains.de">thomas.doerfler@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>Richi,<div dir="auto"><br></div><div dir="auto">inside the contextswitch function, the current context ist suspended (so it is stuck/frozen die nside the context switch code) and execution switches to a different task. When the first task is reactivated, it leaves the contextswitch function. Therefore all the code around the context switch function handles the same task it was called for.<br><br><div dir="auto">-------------------------------------------- <br>embedded brains GmbH <br>Thomas Doerfler <br>Dornierstr. 4 <br>D-82178 Puchheim <br>Germany <br>email: <a href="mailto:Thomas.Doerfler@embedded-brains.de" target="_blank">Thomas.Doerfler@embedded-brains.de</a> <br>Phone: +49-89-18 94 741-12 <br>Fax:   +49-89-18 94 741-09 <br>PGP: Public key available on request. <br><br>Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. <br><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">Am 31.10.2020 16:49 schrieb Richi Dubey <<a href="mailto:richidubey@gmail.com" target="_blank">richidubey@gmail.com</a>>:<br type="attribution"><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I want to learn more about how context switching works in RTEMS. I saw the following lines in theaddispatch.c:</div><div><br></div><div>    _Thread_Save_fp( executing );<br>    _Context_Switch( &executing->Registers, &heir->Registers );<br>    _Thread_Restore_fp( executing );<br></div><div><br></div><div>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)?</div><div><br></div><div>Can someone help me learn more about this?</div><div><br></div><div>Thanks,</div><div>Richi.   </div></div>
</blockquote></div><br></div></div></div></blockquote></div>