You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2019/11/22 07:49:12 UTC

[GitHub] [mynewt-core] kasjer commented on a change in pull request #2108: Hardware stack limiter for CM33

kasjer commented on a change in pull request #2108: Hardware stack limiter for CM33
URL: https://github.com/apache/mynewt-core/pull/2108#discussion_r349458407
 
 

 ##########
 File path: kernel/os/src/arch/cortex_m33/m33/HAL_CM33.s
 ##########
 @@ -183,6 +183,11 @@ PendSV_Handler:
         STR     R12,[R1,#0]             /* Update stack pointer in current task */
         STR     R2,[R3]                 /* g_current_task = highest ready */
 
+        LDR     R12,[R2,#4]             /* get stack top of task we will start */
+        LDRH    R3,[R2,#8]              /* calculate stack size */
+        LSL     R3,R3,#2
 
 Review comment:
   LSL R3, R3, #2
   SUB R12, R12, R3
   could be change to
   SUB R12, R12, R3, LSL #2
   saving 4 bytes
   
   If on the other hand os_task_t stored stack bottom instead of stack top (what could be understood from @wes3 comment), code would be even shorter, and coverity tool would not issue false positive issues about out of bound access somewhere during task creation.

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


With regards,
Apache Git Services