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 lipengfei28 committed Sep 20, 2024
1 parent 6759fc1 commit 0cf6cb7
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 @@ -394,6 +394,26 @@ static inline void arch_nop(void)
__asm__ volatile ("nop");
}

/****************************************************************************
* Name:
* arm64_current_el()
*
* Description:
*
* Get current execute 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 0cf6cb7

Please sign in to comment.