[rtems commit] score/aarch64: Fix interrupt level reads
Joel Sherrill
joel at rtems.org
Fri Mar 5 14:43:28 UTC 2021
Module: rtems
Branch: master
Commit: 9aff7e5685164f062b34d24e1002b7137d6f8496
Changeset: http://git.rtems.org/rtems/commit/?id=9aff7e5685164f062b34d24e1002b7137d6f8496
Author: Alex White <alex.white at oarcorp.com>
Date: Mon Jan 11 10:23:16 2021 -0600
score/aarch64: Fix interrupt level reads
---
cpukit/score/cpu/aarch64/cpu.c | 2 +-
cpukit/score/cpu/aarch64/include/rtems/score/cpu.h | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/cpukit/score/cpu/aarch64/cpu.c b/cpukit/score/cpu/aarch64/cpu.c
index b977875..75b1125 100644
--- a/cpukit/score/cpu/aarch64/cpu.c
+++ b/cpukit/score/cpu/aarch64/cpu.c
@@ -166,7 +166,7 @@ uint64_t _CPU_ISR_Get_level( void )
: [level] "=&r" (level)
);
- return level & AARCH64_PSTATE_I;
+ return ( level & AARCH64_PSTATE_I ) != 0;
}
void _CPU_ISR_install_vector(
diff --git a/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h b/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h
index 380d138..ceb831a 100644
--- a/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h
@@ -215,10 +215,14 @@ void AArch64_interrupt_flash( uint64_t level );
#else
static inline uint64_t AArch64_interrupt_disable( void )
{
- uint64_t level = _CPU_ISR_Get_level();
+ uint64_t level;
+
__asm__ volatile (
+ "mrs %[level], DAIF\n"
"msr DAIFSet, #0x2\n"
+ : [level] "=&r" (level)
);
+
return level;
}
@@ -250,7 +254,7 @@ static inline void AArch64_interrupt_flash( uint64_t level )
RTEMS_INLINE_ROUTINE bool _CPU_ISR_Is_enabled( uint64_t level )
{
- return ( level & AARCH64_PSTATE_I ) == 0;
+ return level == 0;
}
void _CPU_Context_Initialize(
More information about the vc
mailing list