From ac8a61d70b3415ce9867171e2876cabc12cbf5d4 Mon Sep 17 00:00:00 2001 From: hujun5 Date: Wed, 30 Apr 2025 13:42:02 +0800 Subject: [PATCH] arm64: add the interrupt status in the syscall Set interrupt status flag in tpidr_el1 register (bit 0 set to 1) when entering syscall handler to indicate IRQ-in-progress state, and clear it when exiting to properly track kernel execution context across all code paths. Signed-off-by: hujun5 --- arch/arm64/src/common/arm64_syscall.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm64/src/common/arm64_syscall.c b/arch/arm64/src/common/arm64_syscall.c index 166dc8963d0..6e837df1c23 100644 --- a/arch/arm64/src/common/arm64_syscall.c +++ b/arch/arm64/src/common/arm64_syscall.c @@ -164,6 +164,10 @@ uint64_t *arm64_syscall(uint64_t *regs) uint64_t spsr; #endif + /* Set irq flag */ + + write_sysreg((uintptr_t)tcb | 1, tpidr_el1); + /* Nested interrupts are not supported */ DEBUGASSERT(regs); @@ -314,6 +318,10 @@ uint64_t *arm64_syscall(uint64_t *regs) default: { svcerr("ERROR: Bad SYS call: 0x%" PRIx64 "\n", cmd); + + /* Clear irq flag */ + + write_sysreg((uintptr_t)tcb & ~1ul, tpidr_el1); return 0; } break; @@ -326,5 +334,9 @@ uint64_t *arm64_syscall(uint64_t *regs) */ (*running_task)->xcp.regs = NULL; + + /* Clear irq flag */ + + write_sysreg((uintptr_t)tcb & ~1ul, tpidr_el1); return regs; }