xiaoxiang781216 commented on a change in pull request #1369:
URL: https://github.com/apache/incubator-nuttx/pull/1369#discussion_r452894490



##########
File path: arch/arm/src/arm/arm_initialstate.c
##########
@@ -52,13 +52,7 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
+#define IDLETHREAD_STACKMARGIN    128

Review comment:
       > @xiaoxiang781216 I am thinking along theses lines:
   > 
   > Auto size it.
   > 
   > If the passed pointer is on the current stack. I guess (pid == 0) would 
work, but generic would be better;
   > 
   > If you write from stack botom to current lowest marker on the stack.
   > 
   > ```
   > int arm_stack_color(stack, size)
   > {
   > volatile uint32_t marker1;
   > register real vars...;
   > uint32_t nos;
   > volatile uint32_t marker2;
   > if (check stack is is mine)
   > {
   > /* make no assumptions */
   >   nos = min( &marker2, &marker1);
   >    size = nos - stack;
   > }
   > ```
   
   Two issues here:
   1.Many arch don't have xxx_stack_color, but call memset directly.
   2.The code isn't portable at least in the theroy, because the compiler 
permit to move "register real vars...;" out of the marker.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to