Loading ...
Sorry, an error occurred while loading the content.
 

Re: [nuttx] Re: the syscall is implemented with pendsv or other else except svc, is it possible?

Expand Messages
  • Paul.Y.Zhang
    Hi, Greg, ... No, thanks. ... -- Paul
    Message 1 of 66 , Mar 21, 2013
      Hi, Greg,

      > A problem with this idea just occurred to me. I just remembered that that existing exception handler modifies MSP. It sets to either the PSP or MSP of the interrupted task. It may or may not restore the MSP before it returns.
      >
      > That would also have to change. That is another issue that must be thought through too. Tomorrow.

      I did not do anything further with this today. This last observation is important. With the other changes we talked about, we could support nested interrupts but ONLY if either:

      (1) All of the threads us the MSP, or
      (2) If you were to re-initialize the MSP on each entry in your handler and restore it upon return, OR
      (3) Re-write everything (which I don't plan to do now).

      That is because the existing handler sets the MSP to either the PSP or MSP on entry. Then it sets/restores the MSP or PSP on exit depending upon the type of thread that was interrupted. In the case of a thread using the PSP, the MSP is not restored at all but left in an invalid state.

      Is there still something that you like me to do?

      No, thanks.

      ,___

      -- 
      Paul
    • Gregory N
      Hi, Paul, ... For your purposes, you an modify up_initialstate.c as we have discussed before to force all threads to use the MSP. Currently, I use the
      Message 66 of 66 , Mar 21, 2013
        Hi, Paul,

        > Excuse me, I want to ask again. Why not simply let all threads (both
        > kenerl threads and user-space threads, if I understand correctly) use
        > the PSP, leave MSP for irq handlers?

        For your purposes, you an modify up_initialstate.c as we have discussed before to force all threads to use the MSP.

        Currently, I use the EXC_RETURN value to decide if I want the thread to run in privileged or unprivileged mode. Threads need to be able to switch from one mode to another to execute and return from syscalls. But it is true, I could come up with a different design to do that an always use the PSP.

        But with the current design, using only the PSP would break the kernel build.

        Greg
      Your message has been successfully submitted and would be delivered to recipients shortly.