pussuw edited a comment on pull request #5731:
URL: https://github.com/apache/incubator-nuttx/pull/5731#issuecomment-1080564175


   Can someone please explain to me how this change is supposed to work with 
MMU and address environments ? Am I misunderstanding something ? The xcp.regs 
are now allocated from the user task's stack memory, prior to this change they 
were in the kernel's memory space.
   
   Please note the following example
   ```
   
             struct tcb_s *nexttcb = this_task();
   
   #ifdef CONFIG_ARCH_ADDRENV
             /* Make sure that the address environment for the previously
              * running task is closed down gracefully (data caches dump,
              * MMU flushed) and set up the address environment for the new
              * thread at the head of the ready-to-run list.
              */
   
             (void)group_addrenv(nexttcb);
   #endif
             /* Reset scheduler parameters */
   
             nxsched_resume_scheduler(nexttcb);
   
             /* Then switch contexts */
   
             riscv_switchcontext(&rtcb->xcp.regs, nexttcb->xcp.regs);
   ```
   If rtcb->xpc.regs points to the old task's stack, which resides in its 
address environment, how can we perform a register save there ?
   
   The old implementation saved the task context in the kernel space memory, 
which is why it is safe to change the address environment as the memory for 
xcp.regs[] exists in the kernel space and is always mapped ?


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

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to