Skip to content

Commit

Permalink
arm64: add arm64_current_el to obtain current EL
Browse files Browse the repository at this point in the history
Summary
  Add a macro to obtain current execute level

Signed-off-by: qinwei1 <[email protected]>
  • Loading branch information
qinwei2004 authored and xiaoxiang781216 committed Sep 26, 2024
1 parent c535fb1 commit 8ae3575
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions arch/arm64/src/common/arm64_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,26 @@ static inline void arch_nop(void)
__asm__ volatile ("nop");
}

/****************************************************************************
* Name:
* arm64_current_el()
*
* Description:
*
* Get current execution level
*
****************************************************************************/

#define arm64_current_el() \
({ \
uint64_t __el; \
int __ret; \
__asm__ volatile ("mrs %0, CurrentEL" \
: "=r" (__el)); \
__ret = GET_EL(__el); \
__ret; \
})

/****************************************************************************
* Name:
* read_/write_/zero_ sysreg
Expand Down

0 comments on commit 8ae3575

Please sign in to comment.