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

ARMv8-A: Some questions of changing exception level.

Hi, I do really upset for a long time because of failing to change the exception level from EL2 to EL1/EL0.

The processor is cortex-A53 and the board is i.MX8M, I have begun to suspect that it is the problem of hardware.

It starts up in EL2. I try to use the following code to change it to EL1:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
.macro arm64_el2_to_el1
/* set a vaild sp_el0 */
/* it is just a temp way */
mov x6, sp
sub x6,x6, #4096
msr sp_el0, x6
/* always use SP_EL0 */
msr SPsel, #0
bl print2 //debug
/* lower EL is 64bits */
mov x4, #(1 << 31)
msr hcr_el2, x4
/* set RES1 */
mov x4, #0x0800
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

* The function printx is to print number x through UART on board.
* In fact, I don't want to use SP_EL0 forever, but it is easy to test changing EL.

I test so many times and come to the following conclusions:

  1. when the spsr_el2 is set to 0x3c8, which means that we will return to the same EL(EL2). And it works. the print is 2,3,1.
  2. when the spsr_el2 is set to 0x3c4, which means that we will change the EL to EL1. However, it just print 2,3 and nothing.

I have no idea what should I do next, can you give me some help?

Thanks a lot.

0