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

How to ensure the safety of SP_EL0

Hi experts,

In ARMv8, EL1/2/3 can use either their own stack pointer, SP_ELx or SP_EL0.

SP_EL0 can be used in EL0.

why it is safe to use SP_EL0 in EL1/2/3?  I think the applications in EL0 may get the data of kernel in EL1 through SP_EL0.   

Can anybody explain why? Thank you! 

  • The kernel uses SP_EL0 but it doesn't use the EL0 stack.

    As part of the transition between states SP_EL0 is changed to point at the kernel stack (and changed back to point at the thread's stack on return to EL0.)

  • Thank you very much. But I dont quite understand it.

    You mean, both SP_EL0 and SP_EL1 points at the kernel stack when OS is running?

    What I understand (I could be wrong) is,  when the code is running on the OS kernel (EL1), the SP_EL0 points at the kernel stack and the data push into the stack. Then, a exception occured, the SP_EL0 switches to SP_EL1 that points at a new address(new kernel stack?).

     If understood in this way, are there two stacks in EL1? 

    Please tell me where I got wrong, thanks.