hujun260 commented on code in PR #14596:
URL: https://github.com/apache/nuttx/pull/14596#discussion_r1825766236


##########
arch/arm/src/arm/arm_syscall.c:
##########
@@ -54,19 +54,23 @@
 
 uint32_t *arm_syscall(uint32_t *regs)
 {
-  struct tcb_s *tcb = this_task();
+  struct tcb_s **running_task = &g_running_tasks[this_cpu()];
+  FAR struct tcb_s *tcb = this_task();
   uint32_t cmd;
-  int cpu;
 
   /* Nested interrupts are not supported */
 
   DEBUGASSERT(up_current_regs() == NULL);
 
+  if (*running_task != NULL)
+    {
+      (*running_task)->xcp.regs = regs;

Review Comment:
   In many cases tcb->xcp.regs is the regs that we are ready to use, It 
shouldn't be changed to an incorrect value.
   The reason why there is no error currently is because we use (uint32_t 
*)regs[REG_R2], which is tcb->xcp.regs. Therefore, we made this change



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to