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

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

commit ce8fae28420b69c2795f7075cac776a02fa8f9dd
Author: Abdelatif Guettouche <abdelatif.guettou...@espressif.com>
AuthorDate: Fri Mar 18 14:54:58 2022 +0100

    xtensa_coproc.S: Adjust the save reserved for local variables when
    restoring/saving coprocessor state.
    
    These function don't use call8 or call12 and thus need to create just 16
    bytes for the base save area, however they do use one variable so we
    need a space for that.  The `entry` instruction works in unit of 8 bytes
    so we add whole 8 bytes for one variable.
    
    Signed-off-by: Abdelatif Guettouche <abdelatif.guettou...@espressif.com>
---
 arch/xtensa/src/common/xtensa_coproc.S | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/arch/xtensa/src/common/xtensa_coproc.S 
b/arch/xtensa/src/common/xtensa_coproc.S
index b6329a8..722700e 100644
--- a/arch/xtensa/src/common/xtensa_coproc.S
+++ b/arch/xtensa/src/common/xtensa_coproc.S
@@ -251,7 +251,12 @@ xtensa_coproc_savestate:
    * a13-a15.  So a13-a15 may need to be preserved.
    */
 
-       ENTRY(32 /*16*/)                                                /* 
REVISIT: Why 32? */
+       /* Allocate the stack frame.  This function needs to allocate the usual 
16
+        * byte for the base save area + space for one variable.
+        * NOTE: entry works in multiples of 8 bytes.
+        */
+
+       ENTRY(24)
        s32i    a0,  sp, LOCAL_OFFSET(1)                /* Save return address 
*/
 
        /* Call _xtensa_coproc_savestate() with A2=address of co-processor
@@ -263,7 +268,7 @@ xtensa_coproc_savestate:
        /* Restore a0 and return */
 
        l32i    a0,  sp, LOCAL_OFFSET(1)                /* Recover return 
address */
-       RET(32 /*16*/)                                                  /* 
REVISIT: Why 32? */
+       RET(24)
 
 #endif
 
@@ -450,7 +455,12 @@ xtensa_coproc_restorestate:
    * a13-a15.  So a13-a15 may need to be preserved.
    */
 
-       ENTRY(32 /*16*/)                                                /* 
REVISIT: Why 32? */
+       /* Allocate the stack frame.  This function needs to allocate the usual 
16
+        * byte for the base save area + space for one variable.
+        * NOTE: entry works in multiples of 8 bytes.
+        */
+
+       ENTRY(24)
        s32i    a0,  sp, LOCAL_OFFSET(1)                /* Save return address 
*/
 
        /* Call _xtensa_coproc_restorestate() with A2=address of co-processor
@@ -462,7 +472,7 @@ xtensa_coproc_restorestate:
        /* Restore a0 and return */
 
   l32i a0,  sp, LOCAL_OFFSET(1)                /* Recover return address */
-  RET(32 /*16*/)                                                       /* 
REVISIT: Why 32? */
+  RET(24)
 
 #endif
 

Reply via email to