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

CurrentEL value on android armv8-a

Hello Everyone, I'm trying to get CurrentEL register value(Current Exception Level) on android but it doesn't print anything, how can i fix that?

My references:
developer.arm.com/.../CurrentEL--Current-Exception-Level

https://krinkinmu.github.io/2021/01/04/aarch64-exception-levels.html

my code:

.arch armv8-a
.align 4

.text
.global main

main:
  mrs x0, CurrentEL
  cmp x0, #0b00
  lsr x0, x0, 2
  beq el0
  cmp x0, #0b01
  beq el1
  cmp x0, #0b10
  beq el2
  cmp x0, #0b11
  beq el3

el3:
  mov x0, #1
  adr x1, word1
  mov x2, #3
  mov x8, #0x40
  svc #0
  b end
el2:
  mov x0, #1
  adr x1, word2
  mov x2, #3
  mov x8, #0x40
  svc #0
  b end
el1:
  mov x0, #1
  adr x1, word3
  mov x2, #3
  mov x8, #0x40
  svc #0
  b end
el0:
  mov x0, #1
  adr x1, word4
  mov x2, #3
  mov x8, #0x40
  svc #0

end:
  mov x8, #93
  mov x0, #0
  svc #0

.section .data
.align 4
word1:
  .ascii "a\0"
.align 4
word2:
  .ascii "b\0"
.align 4
word3:
  .ascii "c\0"
word4:
.align 4
  .ascii "d\0"