You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gu...@apache.org on 2021/04/30 11:46:21 UTC

[incubator-nuttx] branch releases/10.1 updated: arch: k210: Fix interrupt stack corruption in SMP mode

This is an automated email from the ASF dual-hosted git repository.

gustavonihei pushed a commit to branch releases/10.1
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/releases/10.1 by this push:
     new 70984c5  arch: k210: Fix interrupt stack corruption in SMP mode
70984c5 is described below

commit 70984c525483f5c0621e179e8e78ce486deed2ed
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Sun Apr 11 21:11:58 2021 +0900

    arch: k210: Fix interrupt stack corruption in SMP mode
    
    Summary:
    - I noticed that stack corruption happens due to recent refactoring
    - This commit fixes this issue
    
    Impact:
    - SMP only
    
    Testing:
    - Tested with maix-bit:smp (QMU and dev board)
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 arch/risc-v/src/k210/k210_head.S | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/risc-v/src/k210/k210_head.S b/arch/risc-v/src/k210/k210_head.S
index 7c2aa36..aa5f06a 100644
--- a/arch/risc-v/src/k210/k210_head.S
+++ b/arch/risc-v/src/k210/k210_head.S
@@ -223,9 +223,17 @@ normal_irq:
   .type   g_intstackalloc, object
   .type   g_intstackbase, object
 g_intstackalloc:
-  .skip  (((CONFIG_ARCH_INTERRUPTSTACK * 2) & ~7))
+#ifndef CONFIG_SMP
+  .skip  ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+#else
+  .skip  (((CONFIG_ARCH_INTERRUPTSTACK * CONFIG_SMP_NCPUS) + 4) & ~7)
+#endif
 g_intstackbase:
   .skip  8
   .size  g_intstackbase, 8
-  .size  g_intstackalloc, ((CONFIG_ARCH_INTERRUPTSTACK * 2) & ~7)
+#ifndef CONFIG_SMP
+  .size  g_intstackalloc, (CONFIG_ARCH_INTERRUPTSTACK & ~7)
+#else
+  .size  g_intstackalloc, ((CONFIG_ARCH_INTERRUPTSTACK * CONFIG_SMP_NCPUS) & ~7)
+#endif
 #endif