SlideShare a Scribd company logo
1 of 27
Interrupts
What Are Interrupts?
• Interrupts alter a program’s flow of control
   ∗ Behavior is similar to a procedure call
      » Some significant differences between the two
• Interrupt causes transfer of control to an interrupt
  service routine (ISR)
      » ISR is also called a handler
• When the ISR is completed, the original program
  resumes execution
• Interrupts provide an efficient way to handle
  unanticipated events
Interrupts versus Procedures
           Interrupts                      Procedures
•   Initiated by both software   •   Can only be initiated by
    and hardware                     software
•   Can handle anticipated       •   Can handle anticipated
    and unanticipated internal       events that are coded into
    as well as external events       the program
•   ISRs or interrupt handlers   •   Typically loaded along
    are memory resident              with the program
•   Use numbers to identify      •   Use meaningful names to
    an interrupt service             indicate their function
•   (E)FLAGS register is         •   Do not save the
    saved automatically
                                     (E)FLAGS register
A Taxonomy of Pentium Interrupts
Various Ways of Interacting with I/O Devices
Interrupt Processing in Real Mode
• Uses an interrupt vector table that stores pointers
  to the associated interrupt handlers.
   ∗ This table is located at base address zero.
• Each entry in this table consists of a CS:IP pointer
  to the associated ISRs
   ∗ Each entry or vector requires four bytes:
      » Two bytes for specifying CS
      » Two bytes for the offset
• Up to 256 interrupts are supported (0 to 255).
Interrupt Vector Table
Interrupt Number to Vector Translation
• Interrupt numbers range       Example
  from 0 to 255                 • For interrupt 2, the
                                  memory address is
• Interrupt number acts as               2 ∗ 4 = 8H
  an index into the interrupt   • The first two bytes at 8H
  vector table                    are taken as the offset
                                  value
• Since each vector takes 4     • The next two bytes (i.e., at
  bytes, interrupt number is      address AH) are used as
  multiplied by 4 to get the      the CS value
  corresponding ISR pointer
A Typical ISR Structure
• Just like procedures, ISRs should end with a return
  statement to return control back
• The interrupt return (iret) is used of this purpose
   ;save the registers used in the ISR
   sti      ;enable further interrupts
   . . .
   ISR body
   . . .
   ;restore the saved registers
   iret     ;return to interrupted program
What Happens When An Interrupt Occurs?
• Push flags register onto the stack
• Clear interrupt enable and trap flags
   ∗ This disables further interrupts
   ∗ Use sti to enable interrupts
• Push CS and IP registers onto the stack
• Load CS with the 16-bit data at memory address
      interrupt-type ∗ 4 + 2
• Load IP with the 16-bit data at memory address
      interrupt-type ∗ 4
Interrupt Enable Flag Instructions
• Interrupt enable flag controls whether the
  processor should be interrupted or not
• Clearing this flag disables all further interrupts
  until it is set
   ∗ Use cli (clear interrupt) instruction for this purpose
   ∗ It is cleared as part interrupt processing
• Unless there is special reason to block further
  interrupts, enable interrupts in your ISR
   ∗ Use sti (set interrupt) instruction for this purpose
Returning From An ISR
• As in procedures, the last instruction in an ISR
  should be iret
• The actions taken on iret are:
   ∗ pop the 16-bit value on top of the stack into IP register
   ∗ pop the 16-bit value on top of the stack into CS register
   ∗ pop the 16-bit value on top of the stack into the flags
     register
• As in procedures, make sure that your ISR does
  not leave any data on the stack
   ∗ Match your push and pop operations within the ISR
Dedicated Interrupts
• Several Pentium predefined interrupts --- called
  dedicated interrupts
• These include the first five interrupts:
   interrupt type   Purpose
       0            Divide error
       1            Single-step
       2            Nonmaskable interrupt (MNI)
       3            Breakpoint
       4            Overflow
Dedicated Interrupts (cont’d)
• Divide Error Interrupt
   ∗ CPU generates a type 0 interrupt whenever the div/idiv
     instructions result in a quotient that is larger than the
     destination specified
• Single-Step Interrupt
   ∗ Useful in debugging
   ∗ To single step, Trap Flag (TF) should be set
   ∗ CPU automatically generates a type 1 interrupt after
     executing each instruction if TF is set
   ∗ Type 1 ISR can be used to present the system state to
     the user
Dedicated Interrupts (cont’d)
• Breakpoint Interrupt
   ∗ Useful in debugging
   ∗ CPU generates a type 3 interrupt
   ∗ Generated by executing a special single-byte version of
     int 3 instruction (opcode CCH)
• Overflow Interrupt
   ∗ Two ways of generating this type 4 interrupt
      » int 4 (unconditionally generates a type 4 interrupt)
      » into (interrupt is generated only if the overflow flag is set)
   ∗ We do not normally use into as we can use jo/jno
     conditional jumps to take care of overflow
A Single-Step Interrupt Example
• Objectives:
   ∗ To demonstrate how ISRs can be defined and installed
     (i.e., user defined ISRs)
   ∗ How trap flag can be manipulated
      » There are no instruction to set/clear the trap flag unlike the
        interrupt enable flag sti/cli
• We write our own type 1 ISR that displays the
  contents of AX and BX registers after each
  instruction has been executed
Hardware Interrupts
• Software interrupts are synchronous events
   ∗ Caused by executing the int instruction
• Hardware interrupts are of hardware origin and
  asynchronous in nature
   ∗ Typically caused by applying an electrical signal to the
     processor chip
• Hardware interrupts can be
   ∗ Maskable
   ∗ Non-maskable
      » Causes a type 2 interrupt
How Are Hardware Interrupts Triggered?
• Non-maskable interrupt is triggered by applying
  an electrical signal to the MNI pin of Pentium
   ∗ Processor always responds to this signal
   ∗ Cannot be disabled under program control
• Maskable interrupt is triggered by applying an
  electrical signal to the INTR (INTerrupt Request)
  pin of Pentium
   ∗ Pentium recognizes this interrupt only if IF (interrupt
     enable flag) is set
   ∗ Interrupts can be masked or disabled by clearing IF
How Does the CPU Know the Interrupt Type?
• Interrupt invocation process is common to all
  interrupts
   ∗ Whether originated in software or hardware
• For hardware interrupts, CPU initiates an interrupt
  acknowledge sequence
   ∗ CPU sends out interrupt acknowledge (INTA) signal
   ∗ In response, interrupting device places interrupt type
     number on the data bus
   ∗ CPU uses this number to invoke the ISR that should
     service the device (as in software interrupts)
How can More Than One Device Interrupt?
• Processor has only one INTR pin to receive
  interrupt signal
• Typical system has more than one device that can
  interrupt --- keyboard, hard disk, floppy, etc.
• Use a special chip to prioritize the interrupts and
  forward only one interrupt to the CPU
• 8259 Programmable Interrupt Controller chip
  performs this function (more details later)
8259 Programmable Interrupt Controller
• 8259 can service up to eight hardware devices
   ∗ Interrupts are received on IRQ0 through IRQ7
• 8259 can be programmed to assign priorities in
  several ways
   ∗ Fixed priority scheme is used in the PC
      » IRQ0 has the highest priority and IRQ7 lowest
• 8259 has two registers
   ∗ Interrupt Command Register (ICR)
      » Used to program 8259
   ∗ Interrupt Mask Register (IMR)
8259 PIC (cont’d)
8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller Block Diagram

More Related Content

What's hot

Pt 51 kit - Peripheral self-test
Pt 51 kit - Peripheral self-testPt 51 kit - Peripheral self-test
Pt 51 kit - Peripheral self-testrajbabureliance
 
Embedded c & working with avr studio
Embedded c & working with avr studioEmbedded c & working with avr studio
Embedded c & working with avr studioNitesh Singh
 
Interfacing with Atmega 16
Interfacing with Atmega 16Interfacing with Atmega 16
Interfacing with Atmega 16Ramadan Ramadan
 
Interrupt programming with 8051 microcontroller
Interrupt programming with 8051  microcontrollerInterrupt programming with 8051  microcontroller
Interrupt programming with 8051 microcontrollerAnkit Bhatnagar
 
At 89s51
At 89s51At 89s51
At 89s51Mr Giap
 
Tutorial for Quartus II’s SignalTap II Logic Analyzer
Tutorial for Quartus II’s SignalTap II Logic AnalyzerTutorial for Quartus II’s SignalTap II Logic Analyzer
Tutorial for Quartus II’s SignalTap II Logic AnalyzerJoon Lee
 
ARM exceptions and interrupt controls
ARM exceptions and interrupt controlsARM exceptions and interrupt controls
ARM exceptions and interrupt controlsMahima Shastri
 
AVR Fundamentals
AVR FundamentalsAVR Fundamentals
AVR FundamentalsVinit Vyas
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming IIOmar Sanchez
 
AVR Micro controller Interfacing
AVR Micro controller Interfacing AVR Micro controller Interfacing
AVR Micro controller Interfacing Raghav Shetty
 
Chap 4 lesson02emsysnewinterruptbasedi_os
Chap 4 lesson02emsysnewinterruptbasedi_osChap 4 lesson02emsysnewinterruptbasedi_os
Chap 4 lesson02emsysnewinterruptbasedi_osMontassar BEN ABDALLAH
 

What's hot (20)

Pt 51 kit - Peripheral self-test
Pt 51 kit - Peripheral self-testPt 51 kit - Peripheral self-test
Pt 51 kit - Peripheral self-test
 
Embedded c & working with avr studio
Embedded c & working with avr studioEmbedded c & working with avr studio
Embedded c & working with avr studio
 
IEEE Std 1581 VTS 2011 slides
IEEE Std 1581   VTS 2011 slidesIEEE Std 1581   VTS 2011 slides
IEEE Std 1581 VTS 2011 slides
 
Linux interrupts
Linux interruptsLinux interrupts
Linux interrupts
 
Interfacing with Atmega 16
Interfacing with Atmega 16Interfacing with Atmega 16
Interfacing with Atmega 16
 
Interrupt programming with 8051 microcontroller
Interrupt programming with 8051  microcontrollerInterrupt programming with 8051  microcontroller
Interrupt programming with 8051 microcontroller
 
dspAt89 s52
dspAt89 s52dspAt89 s52
dspAt89 s52
 
89c5131datasheet
89c5131datasheet89c5131datasheet
89c5131datasheet
 
At 89s51
At 89s51At 89s51
At 89s51
 
Tutorial for Quartus II’s SignalTap II Logic Analyzer
Tutorial for Quartus II’s SignalTap II Logic AnalyzerTutorial for Quartus II’s SignalTap II Logic Analyzer
Tutorial for Quartus II’s SignalTap II Logic Analyzer
 
ARM exceptions and interrupt controls
ARM exceptions and interrupt controlsARM exceptions and interrupt controls
ARM exceptions and interrupt controls
 
Assembler4
Assembler4Assembler4
Assembler4
 
Timers
TimersTimers
Timers
 
Interrupts and types of interrupts
Interrupts and types of interruptsInterrupts and types of interrupts
Interrupts and types of interrupts
 
8051 archi
8051 archi8051 archi
8051 archi
 
AVR Fundamentals
AVR FundamentalsAVR Fundamentals
AVR Fundamentals
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
 
AVR Micro controller Interfacing
AVR Micro controller Interfacing AVR Micro controller Interfacing
AVR Micro controller Interfacing
 
Class9
Class9Class9
Class9
 
Chap 4 lesson02emsysnewinterruptbasedi_os
Chap 4 lesson02emsysnewinterruptbasedi_osChap 4 lesson02emsysnewinterruptbasedi_os
Chap 4 lesson02emsysnewinterruptbasedi_os
 

Viewers also liked

Viewers also liked (13)

Presentation on
Presentation onPresentation on
Presentation on
 
Interrupts
InterruptsInterrupts
Interrupts
 
Fit unit 2 interrupts
Fit unit 2 interruptsFit unit 2 interrupts
Fit unit 2 interrupts
 
Handling Interrupts in Microchip MCUs
Handling Interrupts in Microchip MCUsHandling Interrupts in Microchip MCUs
Handling Interrupts in Microchip MCUs
 
System quality attributes
System quality attributes System quality attributes
System quality attributes
 
37471656 interrupts
37471656 interrupts37471656 interrupts
37471656 interrupts
 
Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)
 
Interrupt
InterruptInterrupt
Interrupt
 
Interrupts
Interrupts Interrupts
Interrupts
 
Flags registor of 8086 processor
Flags registor of 8086 processorFlags registor of 8086 processor
Flags registor of 8086 processor
 
Interrupts
InterruptsInterrupts
Interrupts
 
Minimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 MicroprocessorMinimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 Microprocessor
 
Interrupts
InterruptsInterrupts
Interrupts
 

Similar to 63071507 interrupts-up

Direct Memory Access & Interrrupts
Direct Memory Access & InterrruptsDirect Memory Access & Interrrupts
Direct Memory Access & InterrruptsSharmilaChidaravalli
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the ArduinoWingston
 
Computer Organization : CPU, Memory and I/O organization
Computer Organization : CPU, Memory and I/O organizationComputer Organization : CPU, Memory and I/O organization
Computer Organization : CPU, Memory and I/O organizationAmrutaMehata
 
CNIT 127 Ch 1: Before you Begin
CNIT 127 Ch 1: Before you BeginCNIT 127 Ch 1: Before you Begin
CNIT 127 Ch 1: Before you BeginSam Bowne
 
CNIT 127 Ch Ch 1: Before you Begin
CNIT 127 Ch Ch 1: Before you BeginCNIT 127 Ch Ch 1: Before you Begin
CNIT 127 Ch Ch 1: Before you BeginSam Bowne
 
Unit 3 se pai_ivt and idt
Unit 3 se pai_ivt and idtUnit 3 se pai_ivt and idt
Unit 3 se pai_ivt and idtKanchanPatil34
 
SOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC ToolsSOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC ToolsA B Shinde
 
Let's write a Debugger!
Let's write a Debugger!Let's write a Debugger!
Let's write a Debugger!Levente Kurusa
 
Assembly programming
Assembly programmingAssembly programming
Assembly programmingOmar Sanchez
 
INTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSORINTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSORGurudev joshi
 
introductiontoarduino-111120102058-phpapp02.pdf
introductiontoarduino-111120102058-phpapp02.pdfintroductiontoarduino-111120102058-phpapp02.pdf
introductiontoarduino-111120102058-phpapp02.pdfHebaEng
 
Abusing Interrupts for Reliable Windows Kernel Exploitation (en)
Abusing Interrupts for Reliable Windows Kernel Exploitation (en)Abusing Interrupts for Reliable Windows Kernel Exploitation (en)
Abusing Interrupts for Reliable Windows Kernel Exploitation (en)inaz2
 
Interrupts for PIC18
Interrupts for PIC18Interrupts for PIC18
Interrupts for PIC18raosandy11
 

Similar to 63071507 interrupts-up (20)

Pentium processor
Pentium processorPentium processor
Pentium processor
 
Interrupts.ppt
Interrupts.pptInterrupts.ppt
Interrupts.ppt
 
Direct Memory Access & Interrrupts
Direct Memory Access & InterrruptsDirect Memory Access & Interrrupts
Direct Memory Access & Interrrupts
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
 
Computer Organization : CPU, Memory and I/O organization
Computer Organization : CPU, Memory and I/O organizationComputer Organization : CPU, Memory and I/O organization
Computer Organization : CPU, Memory and I/O organization
 
CNIT 127 Ch 1: Before you Begin
CNIT 127 Ch 1: Before you BeginCNIT 127 Ch 1: Before you Begin
CNIT 127 Ch 1: Before you Begin
 
CNIT 127 Ch Ch 1: Before you Begin
CNIT 127 Ch Ch 1: Before you BeginCNIT 127 Ch Ch 1: Before you Begin
CNIT 127 Ch Ch 1: Before you Begin
 
Interrupts in 8051
Interrupts in 8051Interrupts in 8051
Interrupts in 8051
 
Unit 3 se pai_ivt and idt
Unit 3 se pai_ivt and idtUnit 3 se pai_ivt and idt
Unit 3 se pai_ivt and idt
 
It322 intro 1
It322 intro 1It322 intro 1
It322 intro 1
 
SOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC ToolsSOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC Tools
 
Architecture of pentium family
Architecture of pentium familyArchitecture of pentium family
Architecture of pentium family
 
Let's write a Debugger!
Let's write a Debugger!Let's write a Debugger!
Let's write a Debugger!
 
Assembly programming
Assembly programmingAssembly programming
Assembly programming
 
Al2ed chapter14
Al2ed chapter14Al2ed chapter14
Al2ed chapter14
 
INTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSORINTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSOR
 
introductiontoarduino-111120102058-phpapp02.pdf
introductiontoarduino-111120102058-phpapp02.pdfintroductiontoarduino-111120102058-phpapp02.pdf
introductiontoarduino-111120102058-phpapp02.pdf
 
Abusing Interrupts for Reliable Windows Kernel Exploitation (en)
Abusing Interrupts for Reliable Windows Kernel Exploitation (en)Abusing Interrupts for Reliable Windows Kernel Exploitation (en)
Abusing Interrupts for Reliable Windows Kernel Exploitation (en)
 
Windows kernel
Windows kernelWindows kernel
Windows kernel
 
Interrupts for PIC18
Interrupts for PIC18Interrupts for PIC18
Interrupts for PIC18
 

More from tt_aljobory (20)

Homework 2 sol
Homework 2 solHomework 2 sol
Homework 2 sol
 
Lecture12
Lecture12Lecture12
Lecture12
 
Lecture11
Lecture11Lecture11
Lecture11
 
Lecture10
Lecture10Lecture10
Lecture10
 
Lecture9
Lecture9Lecture9
Lecture9
 
Lecture7
Lecture7Lecture7
Lecture7
 
Lecture8
Lecture8Lecture8
Lecture8
 
Lecture6
Lecture6Lecture6
Lecture6
 
Lecture5
Lecture5Lecture5
Lecture5
 
Lecture4
Lecture4Lecture4
Lecture4
 
Lecture3
Lecture3Lecture3
Lecture3
 
Lecture2
Lecture2Lecture2
Lecture2
 
Lecture1
Lecture1Lecture1
Lecture1
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Good example on ga
Good example on gaGood example on ga
Good example on ga
 
Lect3
Lect3Lect3
Lect3
 
Lect4
Lect4Lect4
Lect4
 
Lect4
Lect4Lect4
Lect4
 
Above theclouds
Above thecloudsAbove theclouds
Above theclouds
 
Inet prog
Inet progInet prog
Inet prog
 

Recently uploaded

Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 

Recently uploaded (20)

Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 

63071507 interrupts-up

  • 2. What Are Interrupts? • Interrupts alter a program’s flow of control ∗ Behavior is similar to a procedure call » Some significant differences between the two • Interrupt causes transfer of control to an interrupt service routine (ISR) » ISR is also called a handler • When the ISR is completed, the original program resumes execution • Interrupts provide an efficient way to handle unanticipated events
  • 3. Interrupts versus Procedures Interrupts Procedures • Initiated by both software • Can only be initiated by and hardware software • Can handle anticipated • Can handle anticipated and unanticipated internal events that are coded into as well as external events the program • ISRs or interrupt handlers • Typically loaded along are memory resident with the program • Use numbers to identify • Use meaningful names to an interrupt service indicate their function • (E)FLAGS register is • Do not save the saved automatically (E)FLAGS register
  • 4. A Taxonomy of Pentium Interrupts
  • 5. Various Ways of Interacting with I/O Devices
  • 6. Interrupt Processing in Real Mode • Uses an interrupt vector table that stores pointers to the associated interrupt handlers. ∗ This table is located at base address zero. • Each entry in this table consists of a CS:IP pointer to the associated ISRs ∗ Each entry or vector requires four bytes: » Two bytes for specifying CS » Two bytes for the offset • Up to 256 interrupts are supported (0 to 255).
  • 8. Interrupt Number to Vector Translation • Interrupt numbers range Example from 0 to 255 • For interrupt 2, the memory address is • Interrupt number acts as 2 ∗ 4 = 8H an index into the interrupt • The first two bytes at 8H vector table are taken as the offset value • Since each vector takes 4 • The next two bytes (i.e., at bytes, interrupt number is address AH) are used as multiplied by 4 to get the the CS value corresponding ISR pointer
  • 9. A Typical ISR Structure • Just like procedures, ISRs should end with a return statement to return control back • The interrupt return (iret) is used of this purpose ;save the registers used in the ISR sti ;enable further interrupts . . . ISR body . . . ;restore the saved registers iret ;return to interrupted program
  • 10. What Happens When An Interrupt Occurs? • Push flags register onto the stack • Clear interrupt enable and trap flags ∗ This disables further interrupts ∗ Use sti to enable interrupts • Push CS and IP registers onto the stack • Load CS with the 16-bit data at memory address interrupt-type ∗ 4 + 2 • Load IP with the 16-bit data at memory address interrupt-type ∗ 4
  • 11. Interrupt Enable Flag Instructions • Interrupt enable flag controls whether the processor should be interrupted or not • Clearing this flag disables all further interrupts until it is set ∗ Use cli (clear interrupt) instruction for this purpose ∗ It is cleared as part interrupt processing • Unless there is special reason to block further interrupts, enable interrupts in your ISR ∗ Use sti (set interrupt) instruction for this purpose
  • 12. Returning From An ISR • As in procedures, the last instruction in an ISR should be iret • The actions taken on iret are: ∗ pop the 16-bit value on top of the stack into IP register ∗ pop the 16-bit value on top of the stack into CS register ∗ pop the 16-bit value on top of the stack into the flags register • As in procedures, make sure that your ISR does not leave any data on the stack ∗ Match your push and pop operations within the ISR
  • 13. Dedicated Interrupts • Several Pentium predefined interrupts --- called dedicated interrupts • These include the first five interrupts: interrupt type Purpose 0 Divide error 1 Single-step 2 Nonmaskable interrupt (MNI) 3 Breakpoint 4 Overflow
  • 14. Dedicated Interrupts (cont’d) • Divide Error Interrupt ∗ CPU generates a type 0 interrupt whenever the div/idiv instructions result in a quotient that is larger than the destination specified • Single-Step Interrupt ∗ Useful in debugging ∗ To single step, Trap Flag (TF) should be set ∗ CPU automatically generates a type 1 interrupt after executing each instruction if TF is set ∗ Type 1 ISR can be used to present the system state to the user
  • 15. Dedicated Interrupts (cont’d) • Breakpoint Interrupt ∗ Useful in debugging ∗ CPU generates a type 3 interrupt ∗ Generated by executing a special single-byte version of int 3 instruction (opcode CCH) • Overflow Interrupt ∗ Two ways of generating this type 4 interrupt » int 4 (unconditionally generates a type 4 interrupt) » into (interrupt is generated only if the overflow flag is set) ∗ We do not normally use into as we can use jo/jno conditional jumps to take care of overflow
  • 16. A Single-Step Interrupt Example • Objectives: ∗ To demonstrate how ISRs can be defined and installed (i.e., user defined ISRs) ∗ How trap flag can be manipulated » There are no instruction to set/clear the trap flag unlike the interrupt enable flag sti/cli • We write our own type 1 ISR that displays the contents of AX and BX registers after each instruction has been executed
  • 17. Hardware Interrupts • Software interrupts are synchronous events ∗ Caused by executing the int instruction • Hardware interrupts are of hardware origin and asynchronous in nature ∗ Typically caused by applying an electrical signal to the processor chip • Hardware interrupts can be ∗ Maskable ∗ Non-maskable » Causes a type 2 interrupt
  • 18. How Are Hardware Interrupts Triggered? • Non-maskable interrupt is triggered by applying an electrical signal to the MNI pin of Pentium ∗ Processor always responds to this signal ∗ Cannot be disabled under program control • Maskable interrupt is triggered by applying an electrical signal to the INTR (INTerrupt Request) pin of Pentium ∗ Pentium recognizes this interrupt only if IF (interrupt enable flag) is set ∗ Interrupts can be masked or disabled by clearing IF
  • 19. How Does the CPU Know the Interrupt Type? • Interrupt invocation process is common to all interrupts ∗ Whether originated in software or hardware • For hardware interrupts, CPU initiates an interrupt acknowledge sequence ∗ CPU sends out interrupt acknowledge (INTA) signal ∗ In response, interrupting device places interrupt type number on the data bus ∗ CPU uses this number to invoke the ISR that should service the device (as in software interrupts)
  • 20.
  • 21.
  • 22. How can More Than One Device Interrupt? • Processor has only one INTR pin to receive interrupt signal • Typical system has more than one device that can interrupt --- keyboard, hard disk, floppy, etc. • Use a special chip to prioritize the interrupts and forward only one interrupt to the CPU • 8259 Programmable Interrupt Controller chip performs this function (more details later)
  • 23.
  • 24. 8259 Programmable Interrupt Controller • 8259 can service up to eight hardware devices ∗ Interrupts are received on IRQ0 through IRQ7 • 8259 can be programmed to assign priorities in several ways ∗ Fixed priority scheme is used in the PC » IRQ0 has the highest priority and IRQ7 lowest • 8259 has two registers ∗ Interrupt Command Register (ICR) » Used to program 8259 ∗ Interrupt Mask Register (IMR)
  • 27. 8259 Programmable Interrupt Controller Block Diagram