SlideShare uma empresa Scribd logo
1 de 2
Baixar para ler offline
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.

Mais conteúdo relacionado

Destaque

Manual do pedal Mooer MRDD Reecho (PORTUGUÊS)
Manual do pedal Mooer MRDD Reecho (PORTUGUÊS)Manual do pedal Mooer MRDD Reecho (PORTUGUÊS)
Manual do pedal Mooer MRDD Reecho (PORTUGUÊS)Habro Group
 
Ижма: вчера и сегодня
Ижма: вчера и сегодняИжма: вчера и сегодня
Ижма: вчера и сегодняLexKanev
 
Better burger
Better burgerBetter burger
Better burgerSoapman10
 
Manual do pedal Mooer MBSD Black Secret (PORTUGUÊS)
Manual do pedal Mooer MBSD Black Secret (PORTUGUÊS)Manual do pedal Mooer MBSD Black Secret (PORTUGUÊS)
Manual do pedal Mooer MBSD Black Secret (PORTUGUÊS)Habro Group
 
L'energia elèctrica i la seva distribució
L'energia elèctrica i la seva distribucióL'energia elèctrica i la seva distribució
L'energia elèctrica i la seva distribucióHIchi El Hamdouni
 
Minor’s rights under ip laws
Minor’s rights under ip lawsMinor’s rights under ip laws
Minor’s rights under ip lawsAltacit Global
 
Torsdag - el-fri dag
Torsdag - el-fri dagTorsdag - el-fri dag
Torsdag - el-fri dagcamekh
 
China Survey 2014, Published by China First Capital
China Survey 2014, Published by China First CapitalChina Survey 2014, Published by China First Capital
China Survey 2014, Published by China First CapitalPeter Fuhrman
 
Social media director performance appraisal
Social media director performance appraisalSocial media director performance appraisal
Social media director performance appraisaldawnpeter46
 
Concurso de relatos qué es un libro para ti
Concurso de relatos qué es un libro para tiConcurso de relatos qué es un libro para ti
Concurso de relatos qué es un libro para tiBIBLIOTECAIESSIERRAMIJAS
 
A biblioteca escolar
A biblioteca escolar A biblioteca escolar
A biblioteca escolar aliceserra
 
Trends in military expenditure 2014
Trends in military expenditure 2014Trends in military expenditure 2014
Trends in military expenditure 2014Michael Crosby
 
Business Models & the RFP Process
Business Models & the RFP ProcessBusiness Models & the RFP Process
Business Models & the RFP ProcessMandySmithSF
 

Destaque (20)

Evaluation q2
Evaluation q2Evaluation q2
Evaluation q2
 
Manual do pedal Mooer MRDD Reecho (PORTUGUÊS)
Manual do pedal Mooer MRDD Reecho (PORTUGUÊS)Manual do pedal Mooer MRDD Reecho (PORTUGUÊS)
Manual do pedal Mooer MRDD Reecho (PORTUGUÊS)
 
NOCIONES DEL DERECHO SOCIAL
NOCIONES DEL DERECHO SOCIALNOCIONES DEL DERECHO SOCIAL
NOCIONES DEL DERECHO SOCIAL
 
Elections
ElectionsElections
Elections
 
Ижма: вчера и сегодня
Ижма: вчера и сегодняИжма: вчера и сегодня
Ижма: вчера и сегодня
 
Better burger
Better burgerBetter burger
Better burger
 
Manual do pedal Mooer MBSD Black Secret (PORTUGUÊS)
Manual do pedal Mooer MBSD Black Secret (PORTUGUÊS)Manual do pedal Mooer MBSD Black Secret (PORTUGUÊS)
Manual do pedal Mooer MBSD Black Secret (PORTUGUÊS)
 
Audacity
AudacityAudacity
Audacity
 
Untitled Presentation
Untitled PresentationUntitled Presentation
Untitled Presentation
 
L'energia elèctrica i la seva distribució
L'energia elèctrica i la seva distribucióL'energia elèctrica i la seva distribució
L'energia elèctrica i la seva distribució
 
Minor’s rights under ip laws
Minor’s rights under ip lawsMinor’s rights under ip laws
Minor’s rights under ip laws
 
Torsdag - el-fri dag
Torsdag - el-fri dagTorsdag - el-fri dag
Torsdag - el-fri dag
 
China Survey 2014, Published by China First Capital
China Survey 2014, Published by China First CapitalChina Survey 2014, Published by China First Capital
China Survey 2014, Published by China First Capital
 
Social media director performance appraisal
Social media director performance appraisalSocial media director performance appraisal
Social media director performance appraisal
 
Concurso de relatos qué es un libro para ti
Concurso de relatos qué es un libro para tiConcurso de relatos qué es un libro para ti
Concurso de relatos qué es un libro para ti
 
A biblioteca escolar
A biblioteca escolar A biblioteca escolar
A biblioteca escolar
 
Trends in military expenditure 2014
Trends in military expenditure 2014Trends in military expenditure 2014
Trends in military expenditure 2014
 
Las tics
Las ticsLas tics
Las tics
 
Business Models & the RFP Process
Business Models & the RFP ProcessBusiness Models & the RFP Process
Business Models & the RFP Process
 
Garapan anak unness
Garapan anak unnessGarapan anak unness
Garapan anak unness
 

Semelhante a Exception handling on the x86

AAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced FeaturesAAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced FeaturesAnh Dung NGUYEN
 
Best-embedded-corporate-training-in-mumbai
Best-embedded-corporate-training-in-mumbaiBest-embedded-corporate-training-in-mumbai
Best-embedded-corporate-training-in-mumbaiUnmesh Baile
 
IRQs: the Hard, the Soft, the Threaded and the Preemptible
IRQs: the Hard, the Soft, the Threaded and the PreemptibleIRQs: the Hard, the Soft, the Threaded and the Preemptible
IRQs: the Hard, the Soft, the Threaded and the PreemptibleAlison Chaiken
 
Interrupts of 8085
Interrupts of 8085Interrupts of 8085
Interrupts of 8085ShivamSood22
 
How Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protectionsHow Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protectionsJonathan Salwan
 
Embedded system - Introduction To ARM Exception Handling and Software Interru...
Embedded system - Introduction To ARM Exception Handling andSoftware Interru...Embedded system - Introduction To ARM Exception Handling andSoftware Interru...
Embedded system - Introduction To ARM Exception Handling and Software Interru...Vibrant Technologies & Computers
 
Austin c-c++-meetup-feb2018-spectre
Austin c-c++-meetup-feb2018-spectreAustin c-c++-meetup-feb2018-spectre
Austin c-c++-meetup-feb2018-spectreKim Phillips
 
Embedded Application : An Autonomous Robot or Line Follower Bot
Embedded Application : An Autonomous Robot or Line Follower BotEmbedded Application : An Autonomous Robot or Line Follower Bot
Embedded Application : An Autonomous Robot or Line Follower BotEr. Raju Bhardwaj
 
Buffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the StackBuffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the StackironSource
 
Escalating Privileges in Linux using Fault Injection - FDTC 2017
Escalating Privileges in Linux using Fault Injection - FDTC 2017Escalating Privileges in Linux using Fault Injection - FDTC 2017
Escalating Privileges in Linux using Fault Injection - FDTC 2017Cristofaro Mune
 

Semelhante a Exception handling on the x86 (20)

AAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced FeaturesAAME ARM Techcon2013 002v02 Advanced Features
AAME ARM Techcon2013 002v02 Advanced Features
 
Linux interrupts
Linux interruptsLinux interrupts
Linux interrupts
 
Microcontroller part 2
Microcontroller part 2Microcontroller part 2
Microcontroller part 2
 
Linux interrupts
Linux interruptsLinux interrupts
Linux interrupts
 
8086 Interrupts ...
8086 Interrupts                                                              ...8086 Interrupts                                                              ...
8086 Interrupts ...
 
W10: Interrupts
W10: InterruptsW10: Interrupts
W10: Interrupts
 
Best-embedded-corporate-training-in-mumbai
Best-embedded-corporate-training-in-mumbaiBest-embedded-corporate-training-in-mumbai
Best-embedded-corporate-training-in-mumbai
 
IRQs: the Hard, the Soft, the Threaded and the Preemptible
IRQs: the Hard, the Soft, the Threaded and the PreemptibleIRQs: the Hard, the Soft, the Threaded and the Preemptible
IRQs: the Hard, the Soft, the Threaded and the Preemptible
 
Interrupts.ppt
Interrupts.pptInterrupts.ppt
Interrupts.ppt
 
Interrupts of 8085
Interrupts of 8085Interrupts of 8085
Interrupts of 8085
 
How Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protectionsHow Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protections
 
Embedded system - Introduction To ARM Exception Handling and Software Interru...
Embedded system - Introduction To ARM Exception Handling andSoftware Interru...Embedded system - Introduction To ARM Exception Handling andSoftware Interru...
Embedded system - Introduction To ARM Exception Handling and Software Interru...
 
Lecture10.ppt
Lecture10.pptLecture10.ppt
Lecture10.ppt
 
arm_exp.ppt
arm_exp.pptarm_exp.ppt
arm_exp.ppt
 
Intel Quark HSUART
Intel Quark HSUARTIntel Quark HSUART
Intel Quark HSUART
 
Austin c-c++-meetup-feb2018-spectre
Austin c-c++-meetup-feb2018-spectreAustin c-c++-meetup-feb2018-spectre
Austin c-c++-meetup-feb2018-spectre
 
Embedded Application : An Autonomous Robot or Line Follower Bot
Embedded Application : An Autonomous Robot or Line Follower BotEmbedded Application : An Autonomous Robot or Line Follower Bot
Embedded Application : An Autonomous Robot or Line Follower Bot
 
Buffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the StackBuffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the Stack
 
Escalating Privileges in Linux using Fault Injection - FDTC 2017
Escalating Privileges in Linux using Fault Injection - FDTC 2017Escalating Privileges in Linux using Fault Injection - FDTC 2017
Escalating Privileges in Linux using Fault Injection - FDTC 2017
 
Embedded system
Embedded  systemEmbedded  system
Embedded system
 

Mais de Shehrevar Davierwala

Mais de Shehrevar Davierwala (20)

Introduction_Swift
Introduction_SwiftIntroduction_Swift
Introduction_Swift
 
PsudoCode.pptx
PsudoCode.pptxPsudoCode.pptx
PsudoCode.pptx
 
Number System.pptx
Number System.pptxNumber System.pptx
Number System.pptx
 
Java Script (Module 1).pptx
Java Script (Module 1).pptxJava Script (Module 1).pptx
Java Script (Module 1).pptx
 
Website in Clicks Day 2
Website in Clicks Day 2Website in Clicks Day 2
Website in Clicks Day 2
 
Develop Website in Clicks
Develop Website in ClicksDevelop Website in Clicks
Develop Website in Clicks
 
Build Virtual Assistant Using AI
Build Virtual Assistant Using AI Build Virtual Assistant Using AI
Build Virtual Assistant Using AI
 
Build brand reputation using facebook
Build brand reputation using facebookBuild brand reputation using facebook
Build brand reputation using facebook
 
Digital Marketing Session 2
Digital Marketing Session 2Digital Marketing Session 2
Digital Marketing Session 2
 
Learn Digital Marketing : 0 to Hero Day 1
Learn Digital Marketing :  0 to Hero Day 1 Learn Digital Marketing :  0 to Hero Day 1
Learn Digital Marketing : 0 to Hero Day 1
 
Standard template
Standard templateStandard template
Standard template
 
Digital Marketing for Sustainable Business - Afghan Perspective
Digital Marketing for Sustainable Business - Afghan Perspective  Digital Marketing for Sustainable Business - Afghan Perspective
Digital Marketing for Sustainable Business - Afghan Perspective
 
Developing stunning website in clicks - 2
Developing stunning website in clicks - 2Developing stunning website in clicks - 2
Developing stunning website in clicks - 2
 
Developing stunning website in clicks
Developing stunning website in clicksDeveloping stunning website in clicks
Developing stunning website in clicks
 
Google forms for data analysis
Google forms for data analysisGoogle forms for data analysis
Google forms for data analysis
 
Webdesign session1
Webdesign session1Webdesign session1
Webdesign session1
 
Tech talk webtech
Tech talk webtechTech talk webtech
Tech talk webtech
 
Tech talk php_cms
Tech talk php_cmsTech talk php_cms
Tech talk php_cms
 
Ph pbasics
Ph pbasicsPh pbasics
Ph pbasics
 
Php mysql
Php mysqlPhp mysql
Php mysql
 

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.