Linux interrupt support-general Linux technology-Linux programming and kernel information. The following is a detailed description. The doors used in the Linux kernel are further refined on the basis of the i386 platform, as shown below:
1. Interrupt door: the DPL In the processor is set to 0 and cannot be accessed in user mode. In Linux, all (hard) interrupt handlers are activated through the interrupt gate in the core state.
2. System Gate: the trap gate where DPL is set to 3 in the processor, which can be accessed in user mode. The three exception handling functions (Interrupt numbers 4, 5, and 128) in Linux are called through the system gate, that is, the commands into, bound, and int $0x80 can be executed in the user State.
3. system interrupt Gate: the DPL In the processor is set to 3 and can be accessed in user mode. In Linux, the interrupt vector 3 (int3) is called through the system interrupt gate and can be executed in user mode.
4. Trap Door: the DPL In the processor is set to 0, and cannot be accessed in user mode. In Linux, most exception handling functions are activated through the trap gate.
5. Task Gate: the DPL In the processor is set to 0 and cannot be accessed in user mode. In Linux, only the "Double Fault" exception handler is called through the task gate.
During system boot, the kernel calls the trap_init function in the/arch/i386/kernel/traps. c file to initialize the interrupt. This function initializes the Interrupt Descriptor by calling set_trap_gate and other functions in the same file.
The essence of set_trap_gate is to call the _ set_gate function in the include/asm-i386/desc. h file to initialize the Interrupt Descriptor. The code of this function is as follows: