Search code examples
linuxlinux-kernellinux-device-driverdevice-driver

Does during the software interrupt cpu switches to the interrupt context?


I know that when a system call occurs then a software interrupt is generated. This software interrupt makes the cpu mode to switch from user mode to kernel mode. As per my understanding, during the hardware interrupt context switch happens from the user (process) context to interrupt context. But does the same thing happens during the software interrupt also? I tried lot of documentation also but I could not infer a satisfied answer.


Solution

  • The system call interrupt handler is run in interrupt context, just like any other interrupt handler, but it just switches to the kernel code and then immediately leaves interrupt context.

    Please note that most modern CPUs do not implement system calls with software interrupts but with something like SYSCALL.