26
1 CS318 Project #3 Interrupts

CS318 Project #3

  • Upload
    elu

  • View
    25

  • Download
    1

Embed Size (px)

DESCRIPTION

Interrupts. CS318 Project #3. Credits. Google http://www.beyondlogic.org/interrupts/interupt.htm. On a Interrupt Request. Processor finishes current instruction Pushes stuff on stack Think of only EFLAGS and EIP for now Invokes appropriate Interrupt Service Routine - PowerPoint PPT Presentation

Citation preview

Page 1: CS318 Project #3

1

CS318 Project #3

Interrupts

Page 2: CS318 Project #3

2

Credits Google http://www.beyondlogic.org/interrupts/

interupt.htm

Page 3: CS318 Project #3

3

On a Interrupt Request Processor finishes current

instruction Pushes stuff on stack

Think of only EFLAGS and EIP for now

Invokes appropriate Interrupt Service Routine

iret – pops stuff off of stack

Page 4: CS318 Project #3

4

How many Interrupts ? 256 total Most of them software interrupts 15 hardware interrupts The Programmable Interrupt

Controller (PIC) handles hardware interrupts

Page 5: CS318 Project #3

INT (Hex) IRQ Common Uses

00 - 01 Exception Handlers -

02 Non-Maskable IRQ Non-Maskable IRQ (Parity Errors)

03 - 07 Exception Handlers -

08 Hardware IRQ0 System Timer

09 Hardware IRQ1 Keyboard

0A Hardware IRQ2 Redirected

0B Hardware IRQ3 Serial Comms. COM2/COM4

0C Hardware IRQ4 Serial Comms. COM1/COM3

0D Hardware IRQ5 Reserved/Sound Card

0E Hardware IRQ6 Floppy Disk Controller

0F Hardware IRQ7 Parallel Comms.

10 - 6F Software Interrupts -

70 Hardware IRQ8 Real Time Clock

71 Hardware IRQ9 Redirected IRQ2

72 Hardware IRQ10 Reserved

73 Hardware IRQ11 Reserved

74 Hardware IRQ12 PS/2 Mouse

75 Hardware IRQ13 Math's Co-Processor

76 Hardware IRQ14 Hard Disk Drive

77 Hardware IRQ15 Reserved

78 - FF Software Interrupts -

Page 6: CS318 Project #3

6

Hardware Interrupts Two 8259 PIC IC chips Base addresses 0x20h and

0xA0h

Page 7: CS318 Project #3

7

PIC

Page 8: CS318 Project #3

IRQ 0 is asserted

Control logic

Page 9: CS318 Project #3

Check if IRQ is masked

Interrupt Mask

Register (IMR)

Control logic

Page 10: CS318 Project #3

Hold in IRR until processed

Interrupt Mask

Register (IMR)

Interrupt Request Register

(IRR)

Control logic

Page 11: CS318 Project #3

Send INT to processor

Interrupt Mask

Register (IMR)

Interrupt Request Register

(IRR)

Control logic

Priority Resolver

Page 12: CS318 Project #3

After finishing current instruction, checks if interrupts disabled in

EFLAGS

Page 13: CS318 Project #3

Processor replies with INTA

Interrupt Mask

Register (IMR)

Interrupt Request Register

(IRR)

Control logic

Priority Resolver

Page 14: CS318 Project #3

Store in ISR, reset bit in IRR

Interrupt Mask

Register (IMR)

Interrupt Request Register

(IRR)

Control logic

Priority Resolver

In Service Register

(ISR)

Page 15: CS318 Project #3

Processor asks for data

Interrupt Mask

Register (IMR)

Interrupt Request Register

(IRR)

Control logic

Priority Resolver

In Service Register

(ISR)

Page 16: CS318 Project #3

PIC supplies data

Interrupt Mask

Register (IMR)

Interrupt Request Register

(IRR)

Control logic

Priority Resolver

In Service Register

(ISR)

Page 17: CS318 Project #3

Processor sends EOI

Interrupt Mask

Register (IMR)

Interrupt Request Register

(IRR)

Control logic

Priority Resolver

In Service Register

(ISR)

Page 18: CS318 Project #3

PIC resets ISR

Interrupt Mask

Register (IMR)

Interrupt Request Register

(IRR)

Control logic

Priority Resolver

In Service Register

(ISR)

Page 19: CS318 Project #3

19

Small matter of cascading PICs

2nd PIC at 0xA0 was a later addition Setup in master-slave configuration

to preserve compatibility You don’t need to worry about it

Page 20: CS318 Project #3
Page 21: CS318 Project #3

IRQ 2 routed via IRQ9

Page 22: CS318 Project #3

INT of PIC2 via IRQ2

Page 23: CS318 Project #3

All interrupts from PIC2 routed via PIC1 to

processor

Page 24: CS318 Project #3

EOI for interrupts from PIC2 must be sent to

both PICs

Page 25: CS318 Project #3

25

The End Questions?

Page 26: CS318 Project #3