From ec024adfffc3833b64e3f3a4b20054d78d62bf67 Mon Sep 17 00:00:00 2001 From: Paul Mathieu Date: Sun, 19 Jun 2022 09:46:30 +0200 Subject: [PATCH] arm: interrupt lock fix --- arm/lock.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arm/lock.h b/arm/lock.h index bd6c6b6..ac06a17 100644 --- a/arm/lock.h +++ b/arm/lock.h @@ -3,13 +3,11 @@ #include "aum1_cm1.h" struct InterruptLock { - bool was_locked; + uint32_t old_primask; - InterruptLock() : was_locked(__get_PRIMASK() != 0) { __disable_irq(); } + InterruptLock() : old_primask(__get_PRIMASK()) { __disable_irq(); } ~InterruptLock() { - if (!was_locked) { - __enable_irq(); - } + __set_PRIMASK(old_primask); } };