hujun260 commented on code in PR #14596:
URL: https://github.com/apache/nuttx/pull/14596#discussion_r1825820666
##########
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:
yes,
Another reason why there isn't a problem currently is because the parameter
we pass through the system call is &this_task()->xcp.regs. However, in some
architectures, such as RISC-V, the parameter passed is this_task(). In such
cases, once we modify this_task()->xcp.regs to an incorrect value, we cannot
restore it to the correct value.
In the future, we hope to align the parameters passed by the system call
with RISC-V and pass the TCB (Task Control Block), for example:
riscv_switchcontext(rtcb, tcb);
--
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]