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 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2025-04-30 13:42:02 +08:00 committed by Alan C. Assis
parent 54ff28a47f
commit ac8a61d70b

View file

@ -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;
}