This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| en:multiasm:cs:chapter_3_12 [2025/12/12 11:17] – ktokarz | en:multiasm:cs:chapter_3_12 [2026/01/10 20:21] (current) – pczekalski | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Interrupt Controller, Interrupts ====== | ====== Interrupt Controller, Interrupts ====== | ||
| - | An interrupt is a request to the processor to temporarily suspend the currently executing code in order to handle the event that caused the interrupt. If the request is accepted by the processor, it saves its state and performs a function named an interrupt handler | + | An interrupt is a request to the processor to temporarily suspend the currently executing code in order to handle the event that caused the interrupt. If the request is accepted by the processor, it saves its state and executes |
| - | From a hardware perspective, | + | From a hardware perspective, |
| * Level triggered - stable low or high level signals the interrupt. While the interrupt handler is finished and the interrupt signal is still active, the interrupt is signalled again. | * Level triggered - stable low or high level signals the interrupt. While the interrupt handler is finished and the interrupt signal is still active, the interrupt is signalled again. | ||
| * Edge-triggered - the interrupt is signalled only while there is a change in the interrupt input. The falling or rising edge of the interrupt signal. | * Edge-triggered - the interrupt is signalled only while there is a change in the interrupt input. The falling or rising edge of the interrupt signal. | ||
| - | The interrupt signal | + | The interrupt signal |
| - | After finishing the interrupt subroutine processor uses the returning | + | After finishing the interrupt subroutine, the processor uses the return |
| - | The Fig. {{ref> | + | The Fig. {{ref> |
| <figure interrupt> | <figure interrupt> | ||
| Line 29: | Line 29: | ||
| Interrupts can be enabled or disabled. Disabling interrupts is often used for time-critical code to ensure the shortest possible execution time. Interrupts which can be disabled are named maskable interrupts. They can be disabled with the corresponding flag in the control register. In microcontrollers, | Interrupts can be enabled or disabled. Disabling interrupts is often used for time-critical code to ensure the shortest possible execution time. Interrupts which can be disabled are named maskable interrupts. They can be disabled with the corresponding flag in the control register. In microcontrollers, | ||
| - | If an interrupt | + | If an interrupt |
| * memory failure | * memory failure | ||
| * power down | * power down | ||
| Line 40: | Line 40: | ||
| In some processors, it is possible to signal the interrupt by executing special instructions. They are named software interrupts and can be used to test interrupt handlers. In some operating systems (DOS, Linux), software interrupts are used to implement the mechanism of calling system functions. | In some processors, it is possible to signal the interrupt by executing special instructions. They are named software interrupts and can be used to test interrupt handlers. In some operating systems (DOS, Linux), software interrupts are used to implement the mechanism of calling system functions. | ||
| - | Another group of interrupts signalled by the processor itself | + | Another group of interrupts, signalled by the processor itself, is internal interrupts. They aren't signalled with special instructions but rather in some specific situations during normal program execution. They are called exceptions and can be divided into three groups. |
| * Faults – generated by abnormal behaviour in some instructions (e.g. dividing by 0). | * Faults – generated by abnormal behaviour in some instructions (e.g. dividing by 0). | ||
| * Traps – intentionally initiated by the programmer to transfer control to a handler routine (e.g. for debugging). | * Traps – intentionally initiated by the programmer to transfer control to a handler routine (e.g. for debugging). | ||
| * Aborts – generated while detecting some serious errors in the program of computer behaviour (e.g. memory error). | * Aborts – generated while detecting some serious errors in the program of computer behaviour (e.g. memory error). | ||
| - | Faults are not real errors. They are often used by the operating system to perform normal operations | + | Faults are not real errors. They are often used by the operating system to perform normal operations, such as handling the paging mechanism. |