I'm debugging the ARM Cortex A53 on the QEMU emulator using gdb debugger, any idea on how to get what exception level I'm running on (EL3/2/1/0) ?
Hi Boon Khai,
In gdb the PSTATE is available as CPSR:
(gdb) info registers x0 0x1 1 ... cpsr 0x60000000 [ EL=0 C Z ] ...
Hi Vstehle,
I'm able to dump out the cpsr register, but I don't have the decoded register value like yours in the square bracket, referring to the document you shared, I don't find any bit specifying the Exception Level, only the NZVC APSR, etc...
Here is my cpsr at EL3 (i guess)
And here is my cpsr at EL0 (i guess, because it is now running the baremetal application)
gdb gets EL from CPSR bits 3:2.
(See also SPSR_EL1.M[3:2].)
CPSR 0x400003cd has indeed EL == 3,
CPSR 0x60000045 has EL == 1.
Got it! Thanks a lot!