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/06/22 10:12:51 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 edited a comment on pull request #1009: Add support for preemptive scheduling in simulator build

xiaoxiang781216 edited a comment on pull request #1009:
URL: https://github.com/apache/incubator-nuttx/pull/1009#issuecomment-647422156


   SP modification need adjust for each host, @sebastianene07 can reference state-thread which implement user mode thread by setjmp/longjmp:
   https://github.com/ossrs/state-threads/blob/srs/md.h#L317
   But there is a portable way to modify PC like this:
   ```
   void up_initial_state(struct tcb_s *tcb)
   {
     if (setjmp((&tcb->xcp))
       {
          tcb->start();
       }
     else
       {
          tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->adj_stack_ptr - sizeof(xcpt_reg_t);
       }
   }
   ```


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