You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/05/02 14:40:44 UTC

[GitHub] [incubator-nuttx-apps] patacongo commented on pull request #226: Fix nxstyle issue

patacongo commented on pull request #226:
URL: https://github.com/apache/incubator-nuttx-apps/pull/226#issuecomment-622963638


   > What I can imagine:
   > 1.Move errno to userspace(e.g. at the begining of thread stack)
   
   Except how would you find the beginning of the thread stack in user space?
   
   This is how TLS works.  TLS aligns the stack and then, by masking the current stack pointer, you can get the address of the base of the current stack.  However, this does not work in FLAT or PROTECTED modes.  That is because the size of that mask also effects the maximum size of the stack.  For example, if I use the a 4Kb mask 0x00000fff, then the maximum stack size would be 4Kb which is not big enough.  Large stack alignments effect memory usage on platforms with minimal RAM resources.
   
   So TLS can only really be used in the KERNEL build mode which has highly aligned virtual stacks.
   
   > 2.Overwrite assignment operatior(but require C++)
   
   Or use the non-standard set_errno();
   
   
   


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