sebastianene07 commented on pull request #1009: URL: https://github.com/apache/incubator-nuttx/pull/1009#issuecomment-662997794
> 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); > } > } > ``` > > Or like QEMU mix ucontext and sigsetjmp/siglongjmp API. I removed the ucontext API completely from my patch and I used the current solution with sigsetjmp/siglongjmp. I reused the setjmp/longjmp only for the initialization part (setting up the stack) ---------------------------------------------------------------- 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