Where are the interrupts disabled in the kernel mode?
Hi experts, The sel4 whitepaper says "seL4, like most members of the L4 microkernel family, executes with interrupts disabled while in kernel mode.". But I didn't find the code which disabled interrupts when entering kernel mode, for example, when a syscall is triggered. Can anybody help to point out? Thanks.
Hello Chen Ping Yuan, On 2023-11-08 13:16, chenpingyuan--- via Devel wrote:
But I didn't find the code which disabled interrupts when entering kernel mode, for example, when a syscall is triggered.
Interrupts are disabled automatically when trapping, so there is no need to explicitly do that. The comment just means that seL4 doesn't do nested interrupt handling. Greetings, Indan
Hi Indan, Thanks a lot for your quick reply. And will interrupts be enabled again automatically after exiting trapping? (Is this done automatically by the CPU? So invisible from the source code.)
On 2023-11-09 01:11, chenpingyuan--- via Devel wrote:
And will interrupts be enabled again automatically after exiting trapping? (Is this done automatically by the CPU? So invisible from the source code.)
That depends on the platform, but usually yes, as the hardware state is restored to what it was before taking the trap. ARM has ERET and x86 has IRET to return from interrupts exactly to restore the state. On x86 when returning from a system call via the sysexit instruction, interrupts do need to be enabled manually with sti. Greetings, Indan
participants (2)
-
chenpingyuan@xiaomi.com
-
Indan Zupancic