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

Difference between SP_EL1 and SPSEL + MOV

Let's say that I'm running in EL1 and I want to change the stack location used by the exception code.

Using the SP_EL1 register is actually not permitted when running in EL1, so something like this is not permitted according to the ARM ARM:

ldr     x0, =(some_location)
msr     sp_el1, x0

But I can still do something like this:

msr     SPSel, #1
ldr     x0, =(some_location)
mov     sp, x0
msr     SPSel, #0

After setting the new location for SP_ELx I go back to the SP_EL0 stack.

This is confusing to me. Why reading / writing the SP_EL1 register is not permitted from EL1 when I can still use SPSEL + MOV?

Parents
  • Hi ,

    Regarding SP_EL1, the "Arm Architecture Reference Manual for Armv8-A architecture profile" states that "When the value of SPSel.SP is 1, this register is also accessible at EL1 as the current stack pointer."

    Why are you not able to use SP_EL1 at EL1?

Reply
  • Hi ,

    Regarding SP_EL1, the "Arm Architecture Reference Manual for Armv8-A architecture profile" states that "When the value of SPSel.SP is 1, this register is also accessible at EL1 as the current stack pointer."

    Why are you not able to use SP_EL1 at EL1?

Children