You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Kernel <strong>Structure</strong> (Cont’d)<br />
Task <br />
void <strong>OS</strong>CtxSw (void)<br />
{<br />
PUSH R1, R2, R3 and R4 onto the current stack;<br />
<strong>OS</strong>TCBCur-><strong>OS</strong>TCBStkPtr = SP;<br />
<strong>OS</strong>TCBCur = <strong>OS</strong>TCBHighRdy;<br />
SP = <strong>OS</strong>TCBHighRdy-><strong>OS</strong>TCBStkPtr;<br />
POP R4, R3, R2 and R1 from the new stack;<br />
Execute a return from interrupt instruction;<br />
}<br />
Embedded System Lab. <strong>II</strong> 22