This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

The reason why the exception frame forms on PSP?

Hello experts,


I would like to ask the reason why the exception frame forms on PSP in the Cortex-M architecture.
My understanding is that MSP (Main Stack Pointer) is the interrupt stack pointer and PSP (Porcess Stack Pointer) is the normal (user) stack pointer.
From my little experiences, the exception frame was formed on the interrupt stack.
However, the ARM forms it on the user stack.

Best regards,
Yasuhiko Kouoto.

Parents
  • The overhead is pretty straightforward. This isn't exactly what happens but it illustrates the main point.

    Context switch if interrupt data is stored on MSP

    Timer interrupt. Interrupt data stored on MSP

    Copy some registers to old process specific area

    Copy interrupt data from MSP to old process specifc area

    Set PSP for new process

    Copy interrupt data for new process to MSP

    Copy some registers from new process specific area

    exit to continue new process, restore state from MSP

    Context switch if interrupt data is stored on PSP

    Timer interrupt Interrupt data stored on old process PSP

    Copy some registers to old process specific area

    Set PSP for new process

    Copy some registers from new process specific area

    exit to continue new process, restore state from new process PSP

    The way Cortex-M does it is just not what a person used to Linux or some other such operating system would expect. It could be simulated on Cortex-A series but it requires hardware support to work well.

Reply
  • The overhead is pretty straightforward. This isn't exactly what happens but it illustrates the main point.

    Context switch if interrupt data is stored on MSP

    Timer interrupt. Interrupt data stored on MSP

    Copy some registers to old process specific area

    Copy interrupt data from MSP to old process specifc area

    Set PSP for new process

    Copy interrupt data for new process to MSP

    Copy some registers from new process specific area

    exit to continue new process, restore state from MSP

    Context switch if interrupt data is stored on PSP

    Timer interrupt Interrupt data stored on old process PSP

    Copy some registers to old process specific area

    Set PSP for new process

    Copy some registers from new process specific area

    exit to continue new process, restore state from new process PSP

    The way Cortex-M does it is just not what a person used to Linux or some other such operating system would expect. It could be simulated on Cortex-A series but it requires hardware support to work well.

Children
No data