xiaoxiang781216 commented on a change in pull request #5782:
URL: https://github.com/apache/incubator-nuttx/pull/5782#discussion_r834643637



##########
File path: arch/risc-v/src/common/riscv_assert.c
##########
@@ -338,6 +338,10 @@ static void riscv_dumpstate(void)
   else
     {
       riscv_saveusercontext(rtcb->xcp.regs);
+
+      /* riscv_saveusercontext modifies the local context (a0), restore it */
+
+      rtcb = running_task();

Review comment:
       It doesn't matter whether riscv_saveusercontext return or not return 
value. a0 is a caller saved register, the callee is free to change a0 as they 
want without restore a0. It's the caller's responsibility to save a0 to the 
callee saved register or the stack if the variable will be used after the 
function return, not the programmer.
   BTW, you can't even assume rtcb is held in a0 at all. Compilers can save 
rtcb to any registers or even save rtcb to stack if they like.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to