You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2020/09/29 12:11:00 UTC
[incubator-nuttx] branch master updated: arch/xtensa: Fix task
signal process preemption A0 modification error
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new a266dc9 arch/xtensa: Fix task signal process preemption A0 modification error
a266dc9 is described below
commit a266dc9629c1c4a96f5f31a47af6290a005942a7
Author: Dong Heng <do...@espressif.com>
AuthorDate: Mon Sep 28 11:55:32 2020 +0800
arch/xtensa: Fix task signal process preemption A0 modification error
---
arch/xtensa/src/common/xtensa_sigdeliver.c | 34 ++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/arch/xtensa/src/common/xtensa_sigdeliver.c b/arch/xtensa/src/common/xtensa_sigdeliver.c
index 3bc3998..5afdd23 100644
--- a/arch/xtensa/src/common/xtensa_sigdeliver.c
+++ b/arch/xtensa/src/common/xtensa_sigdeliver.c
@@ -155,6 +155,40 @@ void xtensa_sig_deliver(void)
regs[REG_PS] = rtcb->xcp.saved_ps;
rtcb->xcp.sigdeliver = NULL; /* Allows next handler to be scheduled */
+ /* Issue:
+ *
+ * Task1 --> process
+ * --> xtensa_context_save(S1)
+ * --> s32i a0, a2, (4 * REG_A0)
+ * --> rtcb->xcp.regs[REG_A0] = A0
+ *
+ * Task preemption
+ *
+ * Task2 --> Post signal to Task1
+ * --> Wake up Task1
+ *
+ * Task1 --> xtensa_sig_deliver
+ * --> up_irq_enable()
+ * --> Task preemption
+ *
+ * Task preemption --> xtensa_context_save
+ * --> rtcb->xcp.regs[REG_A0] = A0 of "xtensa_sig_deliver"
+ * = _xtensa_sig_trampoline + 6
+ * = "j 1b"
+ *
+ * Process ...
+ *
+ * Task1 --> xtensa_sig_deliver
+ * --> xtensa_context_restore
+ * --> xtensa_context_save(S1)
+ * --> l32i a0, a2, (4 * REG_A0)
+ * --> a0 = "j 1b"
+ * --> ret
+ * --> run "j 1b"
+ */
+
+ rtcb->xcp.regs[REG_A0] = regs[REG_A0];
+
#ifdef CONFIG_SMP
/* Restore the saved 'irqcount' and recover the critical section
* spinlocks.