casaroli commented on code in PR #19795: URL: https://github.com/apache/nuttx/pull/19795#discussion_r3879703239
########## arch/xtensa/src/common/xtensa_swint.c: ########## @@ -66,6 +66,15 @@ int xtensa_swint(int irq, void *context, void *arg) cmd = regs[REG_A2]; +#ifdef CONFIG_LIB_SYSCALL + /* Record the caller's register context for the duration of the call. A + * system call body runs as C code after this exception has returned, so + * this is how it reaches the registers of the thread that called it. + */ + + tcb->xcp.sregs = regs; Review Comment: yes, `xcp.regs` holds it during the exception, but `xtensa_irqdispatch.c` sets it back to NULL on the way out, "to avoid misusage". `up_fork` is itself the syscall, so its body runs as normal C after the exception has returned, and `xcp.regs` is NULL by then. that is what `sregs` is for anyway, right? it is the same thing armv7-a does, `arm_syscall.c` sets `rtcb->xcp.sregs = regs` and `arch/arm/include/armv7-a/irq.h` declares the field. I will move it into the `default` case and guard it the same way. -- 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]
