Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
en:multiasm:cs:chapter_3_12 [2025/12/12 11:17] ktokarzen: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 or interrupt service routine (ISR). Interrupts are usually signalled by peripheral devices in a situation when they have some data to process. Often, peripheral devices do not send an interrupt signal directly to the processor, but there is an interrupt controller in the system that collects requests from various peripheral devices. The interrupt controller prioritises the peripherals to ensure that the more important requests are handled first.+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 an interrupt handler, also known as an interrupt service routine (ISR). Interrupts are usually signalled by peripheral devices in a situation when they have some data to process. Often, peripheral devices do not send an interrupt signal directly to the processor; instead is an interrupt controller in the system collects requests from various peripheral devices. The interrupt controller prioritises the peripherals to ensure that the more important requests are handled first.
  
-From a hardware perspective, an interrupt can be signalled with the signal state or change.+From a hardware perspective, an interrupt can be signalled by a change in the signal state.
   * 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 comes asynchronously, which means that it can come during the execution of the instruction. Usually, the processor finishes this instruction and then calls the interrupt handler. To be able to handle interrupts, the processor must implement the mechanism of storing the address of the next instruction to be executed in the interrupted code. Some implementations use the stack, while others use a special register to store the return address. The latter approach requires software support if interrupts can be nested (if the interrupt can be accepted while already in another ISR).+The interrupt signal arrives asynchronously, meaning it can occur during instruction execution. Usually, the processor finishes this instruction and then calls the interrupt handler. To handle interrupts, the processor must store the address of the next instruction to be executed in the interrupted code. Some implementations use the stack, while others use a special register to store the return address. The latter approach requires software support if interrupts can be nested (if the interrupt can be accepted while already in another ISR).
  
-After finishing the interrupt subroutine processor uses the returning address to return program control back to the interrupted code.+After finishing the interrupt subroutine, the processor uses the return address to restore program control to the interrupted code.
  
-The Fig. {{ref>interrupt}} shows how interrupt works with stack use. The processor executes the program. When an interrupt comes, it saves the return address on the stack. Next jumps to the interrupt handler. With //return// instruction processor returns to the program, taking the address of an instruction to execute from the stack.+The Fig. {{ref>interrupt}} shows how interrupts work with stack usage. The processor executes the program. When an interrupt comes, it saves the return address on the stack. Next jumps to the interrupt handler. With //return// instruction processor returns to the program, taking the address of an instruction to execute from the stack.
  
 <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, there are separate bits for different interrupts. 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, there are separate bits for different interrupts.
  
-If an interrupt can not be disabled is named a non-maskable interrupt. Such interrupts are implemented for critical situations:+If an interrupt cannot be disabledis called a non-maskable interrupt. Such interrupts are implemented for critical situations:
   * 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 are 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.+Another group of interruptssignalled 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 like handling the paging mechanism.+Faults are not real errors. They are often used by the operating system to perform normal operations, such as handling the paging mechanism.
  
  
  
  
en/multiasm/cs/chapter_3_12.1765531028.txt.gz · Last modified: 2025/12/12 11:17 by ktokarz
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0