linux信号与软中断(Linux signal and soft interrupt).doc
linux信号与软中断(Linux signal and soft interrupt)Soft interrupt
Soft interrupt is generally referred to as a pseudo interrupt action caused by instruction int - an artifact that interrupts CPU, while a hard interrupt is a real interrupt triggered by a 8259 line. Therefore, strictly speaking, int and IRQ have nothing to do with each other, but the two are related to the interrupt vector. Int induced disruption of CPU, is the interrupt vector number from the instruction in IRQ; the break caused by CPU from the data line must retrieve the interrupt number (hardware interrupt triggered first to 8259 A IRQ pin 8259, according to the defined rules conversion interrupt vector number, the corresponding place in the data line then notify the CPU interrupt arrival). Next, CPU works just the same: protecting the scene, breaking the program address, executing interrupt processing, restoring the field, and continuing to execute the interrupted instructions. The Windows driver can not take over the interrupt directly. The interrupt is taken over by the VPICD of the kernel. The driver just registers the interrupt service to the VPICD, and the interrupt service will be called by VPICD. This can effectively implement virtual devices: virtual devices that do not exist or change the behavior of existing physical devices.
Linux uses int $80 to implement system call exceptions. This instruction transfers the control to the kernel by using interrupt / exception vector number 128 (i.e., 80 of 16). In order to achieve the system call without using machine instruction programming, in the standard C language library for each system call provides a short subroutine, complete the machine code programming. In fact, the machine code section is very short. All it has to do is load the parameters that call the system into the CPU register, and then execute the int $0x80 instructions. Then, the system call is invoked, and the return value of the system call is sent to a register in CPU. The standard li