This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit e38f2b2a6dadd48608682184cf5e4633a5d135ce Author: qinwei1 <[email protected]> AuthorDate: Mon Oct 30 17:44:57 2023 +0800 arm64: add arm64_current_el to obtain current EL Summary Add a macro to obtain current execute level Signed-off-by: qinwei1 <[email protected]> --- arch/arm64/src/common/arm64_arch.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm64/src/common/arm64_arch.h b/arch/arm64/src/common/arm64_arch.h index 35c4cdc105..d2310128e8 100644 --- a/arch/arm64/src/common/arm64_arch.h +++ b/arch/arm64/src/common/arm64_arch.h @@ -394,6 +394,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
