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 2024/02/23 15:04:59 UTC

(nuttx) branch master updated (a7fbf7c5cf -> 3e5d558f4c)

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

acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


    from a7fbf7c5cf DOC: Fix https://github.com/apache/nuttx/issues/11760
     new c3d41195c7 arch/intel64/stackframe.c: fix memset size
     new 16e47d6c8b arch/intel64: fix stack alignment
     new 53fcaede28 qemu-intel64/qemu.ld: align _ebss to 16
     new 3e5d558f4c qemu-intel64/ostest: enable DEBUG_FULLOPT

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/x86_64/src/intel64/intel64_createstack.c               | 5 +++--
 arch/x86_64/src/intel64/intel64_stackframe.c                | 4 ++--
 arch/x86_64/src/intel64/intel64_usestack.c                  | 5 +++--
 boards/x86_64/intel64/qemu-intel64/configs/ostest/defconfig | 1 +
 boards/x86_64/intel64/qemu-intel64/scripts/qemu.ld          | 2 +-
 5 files changed, 10 insertions(+), 7 deletions(-)


(nuttx) 01/04: arch/intel64/stackframe.c: fix memset size

Posted by ac...@apache.org.
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/nuttx.git

commit c3d41195c747bd620f742525bc9aee7215e5321b
Author: p-szafonimateusz <p-...@xiaomi.com>
AuthorDate: Wed Feb 7 15:00:07 2024 +0100

    arch/intel64/stackframe.c: fix memset size
    
    this is a follow up to the change from 2335b69120a which missed
    updating stack frame length for this memset
    
    Signed-off-by: p-szafonimateusz <p-...@xiaomi.com>
---
 arch/x86_64/src/intel64/intel64_stackframe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86_64/src/intel64/intel64_stackframe.c b/arch/x86_64/src/intel64/intel64_stackframe.c
index 4ebc9c4066..2381aeef2f 100644
--- a/arch/x86_64/src/intel64/intel64_stackframe.c
+++ b/arch/x86_64/src/intel64/intel64_stackframe.c
@@ -85,7 +85,7 @@ void *up_stack_frame(struct tcb_s *tcb, size_t frame_size)
     }
 
   ret = tcb->stack_base_ptr;
-  memset(ret, 0, tcb->adj_stack_size);
+  memset(ret, 0, frame_size);
 
   /* Save the adjusted stack values in the struct tcb_s */
 


(nuttx) 03/04: qemu-intel64/qemu.ld: align _ebss to 16

Posted by ac...@apache.org.
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/nuttx.git

commit 53fcaede28725a9047df81654d0eed0b10bfe21a
Author: p-szafonimateusz <p-...@xiaomi.com>
AuthorDate: Wed Feb 7 15:00:51 2024 +0100

    qemu-intel64/qemu.ld: align _ebss to 16
    
    Align _ebss to 16, otherwise g_idle_topstack is not correctly aligned.
    For some reason the previous alignment worked with make buit but in case
    of cmake with optimization enabled, the IDLE stack was misaligned which
    caused vector instruction misalignment exception.
    
    Signed-off-by: p-szafonimateusz <p-...@xiaomi.com>
---
 boards/x86_64/intel64/qemu-intel64/scripts/qemu.ld | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/boards/x86_64/intel64/qemu-intel64/scripts/qemu.ld b/boards/x86_64/intel64/qemu-intel64/scripts/qemu.ld
index 92b9a985c6..0ac3abd72b 100644
--- a/boards/x86_64/intel64/qemu-intel64/scripts/qemu.ld
+++ b/boards/x86_64/intel64/qemu-intel64/scripts/qemu.ld
@@ -98,7 +98,7 @@ SECTIONS
         *(.bss .bss.*)
         *(.gnu.linkonce.b.*)
         *(COMMON)
-        . = ALIGN(4);
+        . = ALIGN(16);
         _ebss = ABSOLUTE(.);
     }
 


(nuttx) 02/04: arch/intel64: fix stack alignment

Posted by ac...@apache.org.
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/nuttx.git

commit 16e47d6c8bab04848471971dcda6c68714806c12
Author: p-szafonimateusz <p-...@xiaomi.com>
AuthorDate: Wed Feb 7 15:00:42 2024 +0100

    arch/intel64: fix stack alignment
    
    The stack pointer must be aligned to 16 bytes, otherwise the system crash on the first unaligned data access with vector instruction.
    The problem is only observable with optimization enabled, when vector instructions are generated.
    
    Signed-off-by: p-szafonimateusz <p-...@xiaomi.com>
    Signed-off-by: Bowen Wang <wa...@xiaomi.com>
---
 arch/x86_64/src/intel64/intel64_createstack.c | 5 +++--
 arch/x86_64/src/intel64/intel64_stackframe.c  | 2 +-
 arch/x86_64/src/intel64/intel64_usestack.c    | 5 +++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/x86_64/src/intel64/intel64_createstack.c b/arch/x86_64/src/intel64/intel64_createstack.c
index f95086f5ff..f1c05da1fd 100644
--- a/arch/x86_64/src/intel64/intel64_createstack.c
+++ b/arch/x86_64/src/intel64/intel64_createstack.c
@@ -192,8 +192,9 @@ int up_create_stack(struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 
       /* The intel64 stack must be aligned at word (16 byte) boundaries. If
        * necessary top_of_stack must be rounded down to the next boundary.
-       * We intentionally align at 8 byte boundary, because at task_start,
-       * only frame pointer will be pushed, not instruction pointer.
+       * We intentionally align at 8 byte boundary (look at up_stack_frame())
+       * , because at task_start, only frame pointer will be pushed, not
+       * instruction pointer.
        */
 
       top_of_stack &= ~0x0f;
diff --git a/arch/x86_64/src/intel64/intel64_stackframe.c b/arch/x86_64/src/intel64/intel64_stackframe.c
index 2381aeef2f..a0c6909799 100644
--- a/arch/x86_64/src/intel64/intel64_stackframe.c
+++ b/arch/x86_64/src/intel64/intel64_stackframe.c
@@ -90,7 +90,7 @@ void *up_stack_frame(struct tcb_s *tcb, size_t frame_size)
   /* Save the adjusted stack values in the struct tcb_s */
 
   tcb->stack_base_ptr  = (uint8_t *)tcb->stack_base_ptr + frame_size;
-  tcb->adj_stack_size -= frame_size;
+  tcb->adj_stack_size -= frame_size + 8;
 
   /* And return the pointer to the allocated region */
 
diff --git a/arch/x86_64/src/intel64/intel64_usestack.c b/arch/x86_64/src/intel64/intel64_usestack.c
index d05d89d1fd..386d7c77cd 100644
--- a/arch/x86_64/src/intel64/intel64_usestack.c
+++ b/arch/x86_64/src/intel64/intel64_usestack.c
@@ -110,8 +110,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
 
   /* The intel64 stack must be aligned at word (16 byte) boundaries. If
    * necessary top_of_stack must be rounded down to the next boundary.
-   * We intentionally align at 8 byte boundary, because at task_start, only
-   * frame pointer will be pushed, not instruction pointer.
+   * We intentionally align at 8 byte boundary (look at up_stack_frame()),
+   * because at task_start, only frame pointer will be pushed, not
+   * instruction pointer.
    */
 
   top_of_stack &= ~0x0f;


(nuttx) 04/04: qemu-intel64/ostest: enable DEBUG_FULLOPT

Posted by ac...@apache.org.
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/nuttx.git

commit 3e5d558f4c71cbd7debd41b5bbfad5b156b4e542
Author: p-szafonimateusz <p-...@xiaomi.com>
AuthorDate: Wed Feb 7 15:19:57 2024 +0100

    qemu-intel64/ostest: enable DEBUG_FULLOPT
    
    DEBUG_FULLOPT enables many x86 related optimizations which can
    be broken in many ways (eg. not aligned stack).
    With this change it's easier to catch changes that breaks x86_64.
    
    Signed-off-by: p-szafonimateusz <p-...@xiaomi.com>
---
 boards/x86_64/intel64/qemu-intel64/configs/ostest/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/boards/x86_64/intel64/qemu-intel64/configs/ostest/defconfig b/boards/x86_64/intel64/qemu-intel64/configs/ostest/defconfig
index dcd95a1fe8..8e89eacf86 100644
--- a/boards/x86_64/intel64/qemu-intel64/configs/ostest/defconfig
+++ b/boards/x86_64/intel64/qemu-intel64/configs/ostest/defconfig
@@ -24,6 +24,7 @@ CONFIG_ARCH_X86_64=y
 CONFIG_BOARD_LOOPSPERMSEC=999
 CONFIG_BOOT_RUNFROMEXTSRAM=y
 CONFIG_CONSOLE_SYSLOG=y
+CONFIG_DEBUG_FULLOPT=y
 CONFIG_DEBUG_SYMBOLS=y
 CONFIG_IDLETHREAD_STACKSIZE=4194304
 CONFIG_INIT_ENTRYPOINT="ostest_main"