system call, exception, divided by 0, etc they all have the same vector entry in linux. If in x86, it is 0x80, right ? So what about signal ? Does OS also use int 0x80 for signal to a process ? if yes, who calls it ? We know if you want trap in kernel, you have to call int 0x80 or its wrapper like system call, but for the case of signal, who calls 0x80 ?
Share
First of all,. int 0x80 is not used by modern OS on modern Intel CPUs for a long time now. the sysenter instruction is typically used noways (see: http://siyobik.info/main/reference/instruction/SYSENTER).
As for signals, you have two cases –
If the target of the signal is NOT running on the CPU when the signal is sent, then sending a signal is nothing more then marking a bit in a kernel data structure that indicated to the kernel that when it schedules that process back into the CPU to put the program counter to the signal handling routine rather then the original PC.
If however the program you send the signal to is running on a CPU when a signal is sent, the signal is triggered as an interrupt – if the signal is synchronous (such as divide by zero exception), the interrupt is the exception interrupt that is generated from the CPU core. If the signal is async (such as another process running on another core sending a signal), the interrupt is the inter processor interrupt sent from that other core.
So, no int 0x80 anywhere then 🙂