SlideShare a Scribd company logo
X86 Interrupts Notes By: Shehrevar Davierwala
Exception Handling on the x86
x86 Interrupt Vectors::
- Every Exception/Interrupt type is assigned a number:
- its vector
- When an interrupt occurs, the vector determines what code is invoked to handle the interrupt.
- JOS example: vector 14 → page fault handler
vector 32 → clock handler → scheduler
0 -Divide Error
2 -Non-Maskable Interrupt
3 -Breakpoint Exception
6 -Invalid Opcode
11- Segment Not Present
12 -Stack-Segment Fault
13 -General Protection Fault
14 -Page Fault
18 -Machine Check
32-255 -User Defined Interrupts
Sources: Hardware Interrupts:
Hardware Interrupt Types:
Non-Maskable Interrupt
- Never ignored
INTR Maskable
- Ignored when IF is 0
PIC: Programmable Interrupt Controller (8259A)
- Has 16 wires to devices (IRQ0 – IRQ15)
- Can be programmed to map IRQ0-15 → vector number
- Vector number is signaled over INTR line.
- In JOS/lab4:
vector ← (IRQ# + OFFSET)
Sources: Software-generated Interrupts:
Programmed Interrupts
- x86 provides INT instruction.
- Invokes the interrupt handler for vector N (0-255)
- JOS: we use 'INT 0x30' for system calls
Software Exceptions
- Processor detects an error condition while executing an instruction.
X86 Interrupts Notes By: Shehrevar Davierwala
- Ex: divl %eax, %eax
- Divide by zero if EAX = 0
- Ex: movl %ebx, (%eax)
- Page fault or seg violation if EAX is un-mapped virtual address.
- Ex: jmp $BAD_JMP
- General Protection Fault (jmp'd out of CS)
Enabling / Disabling Interupts:
Maskable Hardware Interrupts
- Clearing the IF flag inhibits processing hardware interrupts delivered on the INTR line.
- Use the STI (set interrupt enable flag) and CLI (clear interrupt enable flag) instructions.
- IF affected by: interrupt/task gates, POPF, and IRET.
Non-Maskable Interrupt
- Invoked by NMI line from PIC.
- Always Handled immediately.
- Handler for interrupt vector 2 invoked.
- No other interrupts can execute until NMI is
done.
IDT: Interrupt Descriptor Table:
IDT:
- Table of 256 8-byte entries (similar to the
GDT).
- In JOS: Each specifies a protected entry-point
into the kernel.
- Located anywhere in memory.
IDTR register:
- Stores current IDT.
lidt instruction:
- Loads IDTR with address and size of the IDT.
- Takes in a linear address.

More Related Content

PPTX
Arduino
DOCX
Lampiran 1.programdocx
PPT
Embedded system - introduction to arm7
PPTX
Exception handling in Pipelining in COA
TXT
Ir remote kit_blink.pde
DOCX
Wire Cut Device
PDF
AVR Micro controller Interfacing
DOCX
Arduino
Lampiran 1.programdocx
Embedded system - introduction to arm7
Exception handling in Pipelining in COA
Ir remote kit_blink.pde
Wire Cut Device
AVR Micro controller Interfacing

Similar to Exception handling on the x86 (20)

PDF
Unit 3 (Complete) - 8086 Interrupt Structure.pdf
PDF
Chapter 7 Interrupts in microprocessor and assembly language.pdf
PPT
63071507 interrupts-up
PPT
Al2ed chapter14
PPT
Ch12 microprocessor interrupts
PDF
SE PAI Unit 2_Data Structures in 80386 segmentation
PPT
Vino's 8086 interrupts
PDF
Linux interrupts
PDF
Unit 6 assembly language programming
PPTX
LECTURE_8 Interrupts.pptx hello and thanks for the University of
PPTX
3.12_8086 microprocessor Interrupts.pptx
PPTX
New Microsoft PowerPoint Presentation.pptx
PPTX
8086 interrupts in assembly language‏‏ lecture8.pptx
PPSX
8086 Interrupts ...
PPTX
Interrupts on 8086 microprocessor by vijay kumar.k
PDF
Micro unit 8
PPTX
Interrupts of 8086
PPTX
Interrupts
PDF
Microcontroller part 2
PDF
Direct Memory Access & Interrrupts
Unit 3 (Complete) - 8086 Interrupt Structure.pdf
Chapter 7 Interrupts in microprocessor and assembly language.pdf
63071507 interrupts-up
Al2ed chapter14
Ch12 microprocessor interrupts
SE PAI Unit 2_Data Structures in 80386 segmentation
Vino's 8086 interrupts
Linux interrupts
Unit 6 assembly language programming
LECTURE_8 Interrupts.pptx hello and thanks for the University of
3.12_8086 microprocessor Interrupts.pptx
New Microsoft PowerPoint Presentation.pptx
8086 interrupts in assembly language‏‏ lecture8.pptx
8086 Interrupts ...
Interrupts on 8086 microprocessor by vijay kumar.k
Micro unit 8
Interrupts of 8086
Interrupts
Microcontroller part 2
Direct Memory Access & Interrrupts
Ad

More from Shehrevar Davierwala (20)

PDF
Introduction_Swift
PPTX
PsudoCode.pptx
PPTX
Number System.pptx
PPTX
Java Script (Module 1).pptx
PPTX
Website in Clicks Day 2
PPTX
Develop Website in Clicks
PPTX
Build Virtual Assistant Using AI
PPTX
Build brand reputation using facebook
PPTX
Digital Marketing Session 2
PPTX
Learn Digital Marketing : 0 to Hero Day 1
DOC
Standard template
PPT
Digital Marketing for Sustainable Business - Afghan Perspective
PPT
Developing stunning website in clicks - 2
PPT
Developing stunning website in clicks
PPTX
Google forms for data analysis
PPT
Webdesign session1
PPT
Tech talk webtech
PPT
Tech talk php_cms
PPT
PPT
Introduction_Swift
PsudoCode.pptx
Number System.pptx
Java Script (Module 1).pptx
Website in Clicks Day 2
Develop Website in Clicks
Build Virtual Assistant Using AI
Build brand reputation using facebook
Digital Marketing Session 2
Learn Digital Marketing : 0 to Hero Day 1
Standard template
Digital Marketing for Sustainable Business - Afghan Perspective
Developing stunning website in clicks - 2
Developing stunning website in clicks
Google forms for data analysis
Webdesign session1
Tech talk webtech
Tech talk php_cms
Ad

Recently uploaded (20)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Cloud computing and distributed systems.
PDF
Empathic Computing: Creating Shared Understanding
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPT
Teaching material agriculture food technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
sap open course for s4hana steps from ECC to s4
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Reach Out and Touch Someone: Haptics and Empathic Computing
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Network Security Unit 5.pdf for BCA BBA.
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Programs and apps: productivity, graphics, security and other tools
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Machine learning based COVID-19 study performance prediction
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Cloud computing and distributed systems.
Empathic Computing: Creating Shared Understanding
Diabetes mellitus diagnosis method based random forest with bat algorithm
Teaching material agriculture food technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The AUB Centre for AI in Media Proposal.docx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Big Data Technologies - Introduction.pptx
sap open course for s4hana steps from ECC to s4

Exception handling on the x86

  • 1. X86 Interrupts Notes By: Shehrevar Davierwala Exception Handling on the x86 x86 Interrupt Vectors:: - Every Exception/Interrupt type is assigned a number: - its vector - When an interrupt occurs, the vector determines what code is invoked to handle the interrupt. - JOS example: vector 14 → page fault handler vector 32 → clock handler → scheduler 0 -Divide Error 2 -Non-Maskable Interrupt 3 -Breakpoint Exception 6 -Invalid Opcode 11- Segment Not Present 12 -Stack-Segment Fault 13 -General Protection Fault 14 -Page Fault 18 -Machine Check 32-255 -User Defined Interrupts Sources: Hardware Interrupts: Hardware Interrupt Types: Non-Maskable Interrupt - Never ignored INTR Maskable - Ignored when IF is 0 PIC: Programmable Interrupt Controller (8259A) - Has 16 wires to devices (IRQ0 – IRQ15) - Can be programmed to map IRQ0-15 → vector number - Vector number is signaled over INTR line. - In JOS/lab4: vector ← (IRQ# + OFFSET) Sources: Software-generated Interrupts: Programmed Interrupts - x86 provides INT instruction. - Invokes the interrupt handler for vector N (0-255) - JOS: we use 'INT 0x30' for system calls Software Exceptions - Processor detects an error condition while executing an instruction.
  • 2. X86 Interrupts Notes By: Shehrevar Davierwala - Ex: divl %eax, %eax - Divide by zero if EAX = 0 - Ex: movl %ebx, (%eax) - Page fault or seg violation if EAX is un-mapped virtual address. - Ex: jmp $BAD_JMP - General Protection Fault (jmp'd out of CS) Enabling / Disabling Interupts: Maskable Hardware Interrupts - Clearing the IF flag inhibits processing hardware interrupts delivered on the INTR line. - Use the STI (set interrupt enable flag) and CLI (clear interrupt enable flag) instructions. - IF affected by: interrupt/task gates, POPF, and IRET. Non-Maskable Interrupt - Invoked by NMI line from PIC. - Always Handled immediately. - Handler for interrupt vector 2 invoked. - No other interrupts can execute until NMI is done. IDT: Interrupt Descriptor Table: IDT: - Table of 256 8-byte entries (similar to the GDT). - In JOS: Each specifies a protected entry-point into the kernel. - Located anywhere in memory. IDTR register: - Stores current IDT. lidt instruction: - Loads IDTR with address and size of the IDT. - Takes in a linear address.