lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

index.md (1661B)


      1 +++
      2 title = 'Interrupts'
      3 +++
      4 # Interrupts
      5 if the program was just waiting for a signal from an I/O device it would be an insane waste of time. that’s why they invented interrupts.
      6 
      7 interrupt request — hardware signal sent by I/O device
      8 
      9 after a processor receives this signal, it responds through an interrupt-service routine
     10 
     11 after interrupt-service routine is done, an interrupt acknowledge signal is sent to the device
     12 
     13 interrupts can be enabled/disabled by setting the IE bit of the status register PS
     14 
     15 btw, also used in exceptions and debugging!
     16 
     17 Example execution:
     18 
     19 1. Device raises an interrupt request, interrupt request arrives during execution of instruction *i*
     20 
     21 2. Processor completes execution of instruction *i*
     22 3. Saves contents of PC (counter) and PS (status)
     23 4. Interrupts are disabled by setting IE bit of PS to 0
     24 
     25 5. Processor loads PC with address of first instruction of interrupt-service routine, routine is executed
     26 
     27 6. After execution, PC and PS are restored (including setting IE bit to 1)
     28 7. Processor continues from instruction *i*+1
     29 
     30 ![screenshot.png](screenshot-32.png)
     31 
     32 ## Multiple devices
     33 organised in a priority structure
     34 
     35 priority level of processor is priority of program that is being executed
     36 
     37 only interrupts from higher priorities than the processor's are accepted
     38 
     39 option 1 — polling
     40 
     41 - poll all devices
     42 - the first to set the IRQ bit of PS to 1 is serviced
     43 
     44 option 2 — vectored interrupts
     45 
     46 - allocate area in memory to hold addresses of interrupt-service routines (interrupt vectors)
     47 - each device identifies itself on request
     48 - the info provided by requesting device is a pointer into the interrupt-vector table