From 87d9dac81722ca19c65fc733ef91bbfcf78f2870 Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Fri, 6 Sep 2024 14:43:40 +0300 Subject: [PATCH] arm64/syscall: (Re-)enable interrupts only if they were previously enabled Don't change the CPU state unexpectedly --- arch/arm64/src/common/arm64_vectors.S | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/src/common/arm64_vectors.S b/arch/arm64/src/common/arm64_vectors.S index 6f308ee8628..025e4cb3372 100644 --- a/arch/arm64/src/common/arm64_vectors.S +++ b/arch/arm64/src/common/arm64_vectors.S @@ -222,7 +222,13 @@ SECTION_FUNC(text, arm64_sync_exc) /* Call dispatch_syscall() on the kernel stack with interrupts enabled */ + mrs x10, spsr_el1 + and x10, x10, #IRQ_SPSR_MASK + cmp x10, xzr + bne 1f msr daifclr, #IRQ_DAIF_MASK /* Re-enable interrupts */ + +1: bl dispatch_syscall msr daifset, #IRQ_DAIF_MASK /* Disable interrupts */