① Hard interruptions are caused by external events, so they are random and unexpected. Soft interruptions are generated by executing interrupt commands, and interrupt request signals are applied to non-external entities.ProgramArranged.
② For the interrupt response cycle of a hard interrupt, the CPU needs to send the interrupt round signal (NMI does not need), the Soft Interrupt interrupt response cycle, and the CPU does not need to send the interrupt round signal.
③ The interrupt number of a hard interrupt is provided by the interrupt controller (the NMI hard interrupt number system is designated as 02 h). The interrupt number of a Soft Interrupt is provided directly by the command without the need to use the interrupt controller.
④ Hard interrupt is shielded (NMI hard interrupt is unblocked), and Soft Interrupt is unshielded.
Soft Interrupt is a mechanism for pushing back and executing. The processing of timer and NIC data is a typical soft interrupt, which is totally different from the interruption in the interrupt vector table, taking network data processing as an example, when the network adapter receives a packet, the disconnected processing program only copies the data to the buffer zone and then tells the network adapter that you can transmit the data to me, that is, the interrupt return, but before that, the NIC interrupt handler should set a flag to tell the operating system to do something, which is soft interrupt, however, soft interruptions are only one of the things to be done when a lot of interruptions are returned. Each time the operating system returns an interruption, a flag is checked to see if something has to be done. If yes, it will be processed, as mentioned above, the operating system calls the Soft Interrupt Processing Function at this time.
The Soft Interrupt program is used to analyze data packets. Who should the data be transferred to? No, it will be returned, except for the necessary parts.
Differences between writing two interrupt service functions
1. the time when a soft interrupt occurs is controlled by the program, while the time when a hard interrupt occurs is random.
2. Soft interruptions occur by program calls, while hard interruptions are caused by peripherals.
3. The hardware interrupt handler must ensure that it can quickly complete its tasks so that the program will not wait for a long time for execution.
I don't think there is a big difference between writing these two types of Interrupt handlers.