masayuki2009 commented on pull request #2014:
URL: https://github.com/apache/incubator-nuttx/pull/2014#issuecomment-711456957


   > > However, I also noticed that arm_intstack_base() for imx6 and cxd56xx 
were incorrect.
   > > Currently they return "bottom" of the interrupt stack for the current 
CPU.
   > > So I will need to fix them later.
   > 
   > Yes, this is what I was reffering to. arm_intstack_base is returning the 
bottom of the stack while it was used assuming it returns the top of the stack.
   > 
   > This function is used for debugging only in arm_assert (arch_dumpstate for 
some architectures) and arm_checkstack. Its usage in xxx_checkstack is correct 
though.
   
   @Ouss4 
   
   Hmm, I also found the following code in arm_initialize.c and arm_checkstack.c
   I think we need to fix these as well.
   
   ```
   in arm_initialize.c
   ...
   #if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3       
                                                                                
                                
   static inline void up_color_intstack(void)                                   
                                                                                
                                
   {                                                                            
                                                                                
                                
   #ifdef CONFIG_SMP                                                            
                                                                                
                                
     uint32_t *ptr = (uint32_t *)arm_intstack_base();                           
                                                                                
                                
   #else                                                                        
                                                                                
                                
     uint32_t *ptr = (uint32_t *)&g_intstackalloc;                              
                                                                                
                                
   #endif                                                                       
                                                                                
                                
     ssize_t size;                                                              
                                                                                
                                
                                                                                
                                                                                
                                
     for (size = (CONFIG_ARCH_INTERRUPTSTACK & ~3);                             
                                                                                
                                
          size > 0;                                                             
                                                                                
                                
          size -= sizeof(uint32_t))                                             
                                                                                
                                
       {                                                                        
                                                                                
                                
         *ptr++ = INTSTACK_COLOR;                                               
                                                                                
                                
       }                                                                        
                                                                                
                                
   }  
   ...
   
   in arm_checkstack.c
   ...
   #if CONFIG_ARCH_INTERRUPTSTACK > 3                                           
                                                                                
                 
   size_t up_check_intstack(void)                                               
                                                                                
                 
   {                                                                            
                                                                                
                 
   #ifdef CONFIG_SMP                                                            
                                                                                
                 
     return do_stackcheck((FAR void *)arm_intstack_base(),                      
                                                                                
                 
                           INT32_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));       
                                                                                
                 
   #else                                                                        
                                                                                
                 
     return do_stackcheck((FAR void *)&g_intstackalloc,                         
                                                                                
                 
                           INT32_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK));       
                                                                                
                 
   #endif                                                                       
                                                                                
                 
   }   
   ...                               
   ```
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to