<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-08-17 22:07 GMT+02:00 Gedare Bloom <span dir="ltr"><<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">On Thu, Aug 17, 2017 at 1:48 PM, Denis Obrezkov <<a href="mailto:denisobrezkov@gmail.com">denisobrezkov@gmail.com</a>> wrote:<br>
> 2017-08-17 17:25 GMT+02:00 Gedare Bloom <<a href="mailto:gedare@rtems.org">gedare@rtems.org</a>>:<br>
>><br>
>> On Wed, Aug 16, 2017 at 11:13 AM, Denis Obrezkov<br>
>> <<a href="mailto:denisobrezkov@gmail.com">denisobrezkov@gmail.com</a>> wrote:<br>
>> > ---<br>
>> > cpukit/score/cpu/riscv32/<wbr>riscv-context-switch.S | 12 ++++++++++--<br>
>> > 1 file changed, 10 insertions(+), 2 deletions(-)<br>
>> ><br>
>> > diff --git a/cpukit/score/cpu/riscv32/<wbr>riscv-context-switch.S<br>
>> > b/cpukit/score/cpu/riscv32/<wbr>riscv-context-switch.S<br>
>> > index a199596..bcdfe0e 100644<br>
>> > --- a/cpukit/score/cpu/riscv32/<wbr>riscv-context-switch.S<br>
>> > +++ b/cpukit/score/cpu/riscv32/<wbr>riscv-context-switch.S<br>
>> > @@ -46,6 +46,7 @@ PUBLIC(restore)<br>
>> ><br>
>> > SYM(_CPU_Context_switch):<br>
>> > /* Disable interrupts and store all registers */<br>
>> > + csrci mstatus, 0x8<br>
>> Why is this necessary?<br>
>><br>
>> > SREG x1, 4(a0)<br>
>> > SREG x2, 8(a0)<br>
>> > SREG x3, 12(a0)<br>
>> > @@ -78,8 +79,9 @@ SYM(_CPU_Context_switch):<br>
>> > SREG x30, 120(a0)<br>
>> > SREG x31, 124(a0)<br>
>> ><br>
>> > -SYM(restore):<br>
>> ><br>
>> > +SYM(restore):<br>
>> > +<br>
>> > LREG x1, 4(a1)<br>
>> > LREG x2, 8(a1)<br>
>> > LREG x3, 12(a1)<br>
>> > @@ -111,9 +113,15 @@ SYM(restore):<br>
>> > LREG x29, 116(a1)<br>
>> > LREG x30, 120(a1)<br>
>> > LREG x31, 124(a1)<br>
>> > - ret<br>
>> > +<br>
>> > +<br>
>> > + csrsi mstatus, 0x8<br>
>> > + nop<br>
>> > + nop<br>
>> Why the nops?<br>
>><br>
>> > + ret<br>
>> ><br>
>> > SYM(_CPU_Context_restore):<br>
>> > + csrci mstatus, 0x8<br>
>> > mv a1, a0<br>
>> > j restore<br>
>> > nop<br>
>> > --<br>
>> > 2.1.4<br>
>> ><br>
>> > ______________________________<wbr>_________________<br>
>> > devel mailing list<br>
>> > <a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
>> > <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/<wbr>mailman/listinfo/devel</a><br>
><br>
> So, don't we turn off interrupts during the context switch?<br>
<br>
</div></div>Nope, and turning them back on unconditionally is wrong too.<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
> Yes, nops are unnecessary.<br>
><br>
><br>
> --<br>
> Regards, Denis Obrezkov<br>
</div></div></blockquote></div>Ok, I was confused by this obsolete comment:</div><div class="gmail_extra"><span style="color:rgb(80,0,80)">/* Disable interrupts and store all registers */</span><br></div><div class="gmail_extra"><font color="#500050">Will remove all that enabling/disabling.</font></div><div class="gmail_extra"><font color="#500050"><br></font></div><div class="gmail_extra"><font color="#500050">Is the same true for start.S file with interrupted task's stack saving? </font></div><div class="gmail_extra"> <br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Regards, Denis Obrezkov</div>
</div></div>